Sign in to follow this  

client server question

This topic is 1270 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Greetings,

I am doing research for a project I have a question to see how people would do something.

So my question is let's say I have a orpg game my client moves to xy cord it sends apacket to server client will assume that it can move etc server checks data moves player back if need be now What is the best practice for broadcasting to the other players in the location that a player moved without large amount of lag I see games do this but can't wrap my head around it. Please explain.

Share this post


Link to post
Share on other sites
The server keeps some information about each connected client. X times a second, the server will iterate over all connected clients, and send them updates for things that have changed that they see. The more frequent X is, the less lag there is. ORPGs can get away with X in 1 .. 5 times a second. FPS games go from 10 on the low end to 120 on the high end, with a happy mean around 30 in many cases.

Share this post


Link to post
Share on other sites
Basically how it would work would be something like this

Client A moves to x1 y2 sends movement packet
Game server recv packet broadcasts to all clients that client a moved clients then do there thing etc.

Share this post


Link to post
Share on other sites
You really don't want to broadcast the move command as soon as it comes in, because then you will have N clients broadcasting to N-1 other clients, for N-squared number of packets coming out. You want it to work like this:

Clients send inputs at some interval (client send rate)
Server processes inputs so they affect the world at some period (simulation tick rate)
Periodic timer sends updates about world changing to clients (network tick rate)

The three rates do not need to be the same. It's common that client send and network tick rate is the same. It's common that the simulation tick rate is some integer multiple of the network tick rate.

Share this post


Link to post
Share on other sites
So it's common that clients are out of sync with each other by a few mms? Should the server send the world update to everyone or just to clients it would effect

Share this post


Link to post
Share on other sites

So it's common that clients are out of sync with each other by a few mms?


The out-of-sync is typically measured in TIME, not in SPACE. If your physics simulation rate is fixed and everyone gets the same control commands, they will all display the entities in the same locations. However, those that get the commands later, will display those entities in those locations, later.

Should the server send the world update to everyone or just to clients it would effect


For small games, it's easiest to always send all players to all players. For large games, an interest management layer is typically added to send data only for entities that the target client can interact with and should know about.

Share this post


Link to post
Share on other sites

This topic is 1270 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this