Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


client server question


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 Tivoilos   Members   -  Reputation: 112

Like
0Likes
Like

Posted 20 June 2014 - 09:00 PM

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.

Sponsor:

#2 hplus0603   Moderators   -  Reputation: 5723

Like
3Likes
Like

Posted 20 June 2014 - 09:09 PM

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.
enum Bool { True, False, FileNotFound };

#3 Tivoilos   Members   -  Reputation: 112

Like
0Likes
Like

Posted 20 June 2014 - 11:04 PM

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.

#4 hplus0603   Moderators   -  Reputation: 5723

Like
0Likes
Like

Posted 21 June 2014 - 10:46 AM

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.
enum Bool { True, False, FileNotFound };

#5 Tivoilos   Members   -  Reputation: 112

Like
0Likes
Like

Posted 22 June 2014 - 06:26 PM

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

#6 hplus0603   Moderators   -  Reputation: 5723

Like
0Likes
Like

Posted 23 June 2014 - 10:25 AM

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.
enum Bool { True, False, FileNotFound };




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS