I am planning a network Space Sim game and I am wondering what the best way to design the back end would be.
I am planning to have multiple ships controlled by multiple users and have the ability for AI/stationary ships to be piloted by any of the users.
I will run a dedicated server for saving stats etc and running server code.
I’m ok with accessing stats etc from a database on the server but how should I go about updating positions, orientations and actions of one player to the other and have it rendering on the other players screen?
Also about how many players could I hope to be able to handle?
Thanks! I have little to no Idea about networking.
Well i suggest gamasutra and gamedev (google them) and read all articels you find about this,a s there can be several dozen books be filled with this topic.
First thing is you should come to the decision if the logic runs mostly server or mostly clientside, if it is peer to peer or server client , (tcp,udp? string serializedobject or object-to-binarybased? What functions do ur entitiys need?
Ect, only after taht I would go on and try to find soemthing or code it myself. (as you wil else probably need to rewrite everything in a later stage, I can tell)
Now I don’t mean to advertise in a profitable way, but allow me to advertise in a helpful way.
What Empire Phoenix says is definitely correct, but let me just give you a few things most games do:
- Most games use UDP, especially games that require a lot of messages (FPS, MMORPG)
- Most games run as much as possible on the server, to avoid client-side hacks. It is of course still possible to do things on the client, and you have to aswell, but when it is important information (like player locations/actions), you may want to check those on the server.
- You don't really have to concern yourself over the type of serialization used, unless you're writing it yourself.
Please note that I do not say you have to follow the advice I just gave. If you want, have a look at SpiderMonkey. It is a networking library I currently develop and maintain. I feel it has everything you need.
I would personally suggest starting with SpiderMonkey. While its still a relatively young project, the enthusiasm around it from both @Levia and the community has meant increasing momentum in the past few weeks
Before I forget, you should make yourself clear what you need for the second layer (Object synchronisation(First layer is for me just the data over network))
Keyvalues?
Events?
Passive Replication of object state?
When you transfer same strings often, how about a StringPool (aka class names)
Up to wich distance should objects be transmitted?(This can be extended, if you use BSP for example you can reduce the objects to the ones that are actually visible)