Building my own server

Hi all,

Me, and my team, are working on a multiplayer realtime cardgame for PC. We are using Unity3D as the game engine for the project.

I have already done a few client/server communication for a couple of apps from scratch, Always TCP. With the server running locally already preconfigured(windows or linux), so it was just installing the app, “make” and job done. And here comes the problem…

We want to build and authoritative server so the game workflow will be: Clients in the same match will join a"room" and a unity server instance will catch all clients messages and broadcast the modifications to all the clients in that room.
We don’t need to run any physics in the server, the server will receive RPC from the clients when they press any key, and run the method specified. Then send an RCP broadcasted back to all clients in the room to tell them what has happened into the scene(ex: a card has been used). It will also connect to the database to manage the persistent data.

Also, the game must be installed on a cloud server(because we don’t own one).

With this comes a lot of questions, some are more server oriented rather than unity, but I hope someone will be able to help(any help is apreciated):

1: Is there any host server that is the best for our porpuse? We thought about using Amazon EC2 as our host server because of the number of client and good reputation, is there any problem on doing that? Maybe we should pick windows server?
Unity3d game + amazon AWS EC2 == ??? - Unity Answers I read at this link that there are some problems if your running physics on the server, but that is not our case. Any other problem?
1.1: Once we pick our host server how do we run the game on it? I’ve seen several options but not sure which is the best one. A window EC2 instance where we just install the game and run in -nographic batch mode? a linux server with a headless instance? Is running windows or linux in the server machine a must or can I just install the unity master server and run the game?(I have really small knowledge about server host usage)

2: I have implemented a server and a client, that works in a local area (both at the same computer). To move this to the global server is it possible (notice my unexperience here) to just install the compiled version of the server(.exe + Data) in the server and just run it?
2.1: Must I also install the master server? or that is just if I want to run multiple instances of the server? I my case, the rooms will be with 10 clients at the same time.
2.2: Should I bother about the facilitator? I have read that most routers handle the public IP issues by their own there are just a few cases when NAT punchthrough is needed. And in those cases not always work.

3: I have seen some middleware solutions, such as Photon Server. I feel that in my case I don’t really need that cause I will basically send RPC from the client when a key is pressed, and the answer from the server will be the animation that must be display, or new values that must be display on screen.

4: I have the same problem with the database, I don’t really know how to run it on a host server, but I will ask that in an other topic if I cannot find a way to do it. I advance it just in case it helps to answer the question. (I have no problem on running a PhP database locally with Xammp and access it wiht unity)

5: this is the big question and a result of all the others. Should I use unity to implement the server side? or is a better option to do it in C++(f.ex) and communicate with Unity clients and MySQL database. I feel that unity is really helpful, but not sure if there is a “simple” way to make it run on the server side.

TL;DR: I don’t know how to run unity, well, or any app on a server. So, which is the “best” way of doing it? What should I install on the machine? Any host preferences/problems?

Really thanks in advance, I know is a really specific topic and might not be that much related with unity, but I have seen a lot of people around the forum with insane computer science knowledge, so I hope someone will bring some light to me into this topic.

Greeting,
Eduardo

Nice question, Eduardo!

The idea of a server is to make players play together providing synchronization of game state. So if you will look on it from the point of the game states it will help you to find the right answer.

If your game is pretty complex, has some physics, and you need it’s state to be controlled to avoid glitches and errors, you may want your server to run a master-instance of the world, which will be updated by getting players’ actions and then broadcasting changes to them.

But if you are making a card game consider making a server-side application as simple as possible. It will help to preserve server resources and also will make your server application easy to program, modify, and understand.

Take a sheet of paper and wright down how the game state can be described: players’ life counts, their points, hands, etc. That is what you may want to hold and process on a server-side. Everything else can be processed by rich client app based on Unity.

Hope that will help. If you have any questions just ask.