network design

Hi,

I m working on a multiplayer space game.
I design a server, and a client.
By now, I try to send information between client server, and others players.
I was wondering which good pratices to have about this.
Indeed, I can’t send each frame the position/hpr of all ships (AI and Players). It will an insane traffic, and moreover, time to cut the msg String to interprate what to do, will take an infinité time, more than the render lol.
Do you have some advices, good pratices on network communication in a game?

This is what i did, coordinates are stored server side, and the client tells the server when to move forward, and speed is calculated serverside also.

Instead of sending coordinates of all the players to all the clients, just send them to players within the vacinity of the players. Do coordinate sending via UDP, because its faster, but it doesn’t check to make sure the packet made it, but thats ok. If a packet of coords fails to send the next one will pick up in its place, it will look like a little lagg when that happens, but packets barely ever get dropped.

The method above is needed only when players start cheat in a multiplayer game. And possible only with several fast, low-ping servers available on-request.

Until this happens, let the player client do the stuff. Do it for your psychical health.

Thanks for reply!
How can I configure UDP in panda Network?
It seems that the problem is also the frequency of pascket to send? If I send at each frame, I think I will send very lot of stuff…

I think the way I will do, is to send initial pos, speed, hpr. And send synchronize elements each Seconde for example. The client, will calculate each further position and resynchronize with new position sent by server.

What do you think about?

Congratulations, you’ve rediscovered the wheel :slight_smile: Yeah if you really want the server-calculated coord then do it.

Basically it’s the same most other games do. But if you’re going commercial, try punkbuster or something like that. I don’t remember if punkbuster isn’t only for iD engine based games.

OMG, I found the wheel?
Great. I made some tests, and it really enjoy me… So, good time!

thanks

No need to use punk buster or some other ridiculous nonsense. There is a reason why client/server games are programmed that way, it works very very well and is simple to do.

Shimrod, you will also want to have the client and server send more frequent updates every time direction or speed changes in addition to your syncing packet.

yeah I think, I will tune the communication step by step.
I have to determine whih information is important to allow a quick game.
effectively speed and orientation allow to calculate on client side the different move of the different objects.
I test it yesterday on the night, and I thin I got something pretty cool.
So I go back to a lot of work, and lot of fun I hope.

thanks for advice

Yes there is. PunkBuster&etc doesn’t just power the cheat protection, they often power the servers and support. It’s basically cheaper for you, as a commercial developer.

I think I have no need of such libs. It will be not a professional project, and don’t know if I will deliver it one day.
So…

Don’t let the players start cheating, stop it before it happens. If you do more server side then only the server needs to send it out instead of recieving from the clients, then sending it out, it should actually take less network traffic.

You should keep most or all of the players stats (items, health, ext.) server side so the players can’t change the values. This prevents cheating, and if everything is server side, as I said before the client doesn’t need to send the data to the server before the server can send it out. Really it shouldn’t take too much processor or network.

Don’t user punk buster it will destroy cross platform ability. And the problem with sending a packet every frame, you just need to set a task that goes off every few seconds(about 1-2)

Even most of informations are server side, some of them can only be on client side, cause it comes from interactivity with users (input, movement, …). And that is this information which generate lot of traffic, not information like money, account, or other stuff.

At your mind, what you said, is that even users’s movement are managed by server. Client just send out speed and new orientation for example. And next Server will calculate everything, and send all this stuff to client? It seems to be a huge traffic, more than if client manage NPC and his movement, with sync traffic only.

Clients should have some ability to predict the world state. In theory if none of the clients make any changes, then there is no network activity and everything on the server and clients will always be the same. Heck, every client could be identical to the server (this is how openttd does it), but only one of them is the actual server and is the final authority of the game state.

Another trick, as mentioned, is only sending the data that the player can see. This is where sensor range and zoning is useful. If a player can’t see a ship then there is no reason why a another player on the other side of the galaxy needs their information.

ASCII flowchart:

Client makes a change --> Server verifies change as a legal move --> server checks who can see player --> server sends update to those players.

Interesting stuff here. Effectively, I can incorporate notions of radar range. It would limit the number of information to transmit. I already limit to players into the same zone.
But, it would create lot of calculs on server side.
But I think it is better than network traffic.

Thanks for your experience and advices!

Yes, just make the calculations for physics and anything visual(animations) client side. As for movement it should be calculated serverside to prevent speed hacking, but it can, of course, be done client side also.

OK, i saw punkbuster noticed…
I played wolf:ET for quite some time, and i used to see a cheater every couple of days… And cheater gets banned in minute or two of gameplay (aimbot-wallhack).

Depending on what kind of game you are trying to make, you might want to check et source to get some idea how it works.

And considering cross-platform, i know for a fact that punkbuster works fine on win, linux and mac.

writing cheat detectoin algorithms is comparebly easy if you know the game rules and the “average” player behavings.

for wallhacks this can be as easy as calcualting the screen-coordinate distance between crosshair and enemy, and if there is a line of sight. even pro-gamers only reach a certain level of pre-aiming. wallhackers clearly drop out. simmilar things work for audible things.

so you dont need to rely on tools such as punkbuster. making sure the data you get from the client is sane would do the same thing. more or less.