🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Packet send frequency

Started by
7 comments, last by BartC 22 years, 5 months ago
To teach myself network programming I''ve made a little snake game. Client-server architecture. Client sends movement to the server, server sends an updated world to every client. Currently, the server sends a snapshot every 50ms. Is this too much, to little ?
Advertisement
Too fast or too slow? Hmmm. How many players do you anticipate playing the game simultaneously, and how is the current performance? Some top games currently use 100ms updates, but there is nothing inherently wrong with 50ms update cycles, as long as performance meets your requirements. Although, the difference between 50 and 100 isn''t going to be too noticable on the client side, and its almost always better to send less data, less often.

hope this helps.
Thanks for the info. I have indeed brought the snapshot freq down to once per 100ms. Now to find a solution to the lag problem ;-)
Why don''t you send data when the world change (on client command or an event idependant from client)? Of course, you have problems when the world can never change, in that case, you must send a ping to know if yours clients are still alive.

For your snake game, the only event is the snakes moves with eventually a new direction (which come from an early client message).

---
Sorry for my english
---Sorry for my english :)
I know send a compressed image of the world every 100 msec.
This seems to work relatively fine. On some computers the snake seems to be ''hopping around'' instead of crawling. The biggest problem however is the control lag. When a remote player changes direction, he wants to notice that immediately so I send a message to the server. This is where lag can really hurt the game.
umm a 100ms delay is quite long
thats 1/10 of a second
thats like running the game at 10fps
I may be way off here, but I am working on a FPS and client movement works pretty fine with client-updates even less often then you guys are saying. What you need to do is add AI to the players (sound dumb? it''s not.)

The theory behind adding an AI is you don''t send so many updates just to make movements look smooth, your client keeps moving the person in the direction they were heading, at the speed they were moving until the next update.

This is why in some MMORPG if you lose your connection, until your client realizes it you may see monsters or even players walking endlessly in one direction.

Another thing some games do is send pings to the server, then the server adjusts how often it sends updates to the players based on their latency. This allows players with better connections to get data at a quicker pace (Cable / DSL users) with out flooding those with slower connections.

Hope that gives you some help. =)

Best,IronDragonShocking Games Game Centerwww.Shocking-Games.com
Thx IronDragon, I tried client prediction in the first version
of the game, but it doesn''t work for a game like snake.
In a FPS game you can make a character follow a predicted path and adjust that path when the server tells you. Most of the time this will go unnoticed. In a game as simple as snake the movement has to be correct all the time.
hehe
but in a snake game there are only 4 directions
so it would be even easier to implement
the whole point of prediction is to make the whole game seem non jerky
so if u lag lots it wont show as much
and if u dont then u dont

This topic is closed to new replies.

Advertisement