Realtime networking architecture for space shooter

Hi!

I’m thinking about writing a descent clone. That is, you fly around in your futuristic ship in a maze and blast the other players with futuristic weapons. However, when really thinking about networking, I have some problems.

  • How smart is the server? Does it handle more than connections, scores and shuffling messages around.
  • What is a good solution for determining hits? (bullets can be both lightspeed and “slow” (slow =~ 200 m/s)
    Should this be on the client that fired the bullet? (potential cheat problem and it works to good when the network is congested)
    Should it be on the server? (the server need to have a complete physical representation of the game, otherwise the safest solution)
    Should it be on the client that is hit? (similar problems as when it is on the client that fired the shot).
    Should it be a combination? The firing client determines the exact hit (with the 3D geometry) and the server checks that the shot is within bounds.

I am thinking something like this:

  • When connected, the server tries to determine the average ping of the client. Then server tells the client the server time. Everybody knows about the server time. Every state update package includes the server time, like: “I am Here at this Time”.
  • Every time a client updates its state (not counting simply traveling forward) such as turning ever so slightly, it sends a message to the server to update this. The server makes sure this is reasonably (to prevent cheat) and forwards it to the other clients. Kind of like dead reckoning, but always sending updates with player input.
  • All clients simulate physics.
  • When a client finds that the new packet from the server mismatches with where it is in the local simulation, it is eased to the new position over a few frames. It can be that a ship collided with something static in the local simulation but the player really avoided the obstacle.

If you haven’t already you should probably start with reading how some FPS style games do it. I imagine they already solve a lot of your problems (‘lightspeed’ bullets, etc.):

Source Multiplayer Networking
Latency Compensating Methods…
Quake 3 Networking
Unreal Networking Architecture

I think you are on the right track with some of your latter points but I do have a few suggestions (although take these with a grain of salt as I have yet to implement a multiplayer fps). A completely authoritative server is a good idea as it will limit cheating. Thus it should definitely handle more than just connections and in fact should simulate the whole game. The client should only be sending user input to the server (take a look at the data structure they use in the second article); for this to work the server has to simulate everything. You can use client side prediction to make the game feel responsive to the user whilst you await the outcome of the predictions. Also I’d use UDP for the transport if you’re not already.

Thanks, I have just started reading, and it looks like a good set of links for my purpose!

Thank you!