Jump to content
  • Advertisement
Sign in to follow this  

packets frame

This topic is 4294 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

Hello gamers, I am starting on developing y first simple p2p game. I am using the SDL_net library. I am trying to develope a 2D game where each player (a pad) shoots at the other person. It is very simple game. Now my question is, how often should I send the information to the other side? is it at the rate of 10 msec? Also I a thinking that the only info I need to transmit is the player position and the bullet position... am I missing anything else? Please let me know of you think and any help is appreciated. Thanks alot PS: I am using TCP as using UDP in sdl_net sux big time ( Never relly understood it, if u recoomend a tutorial (otehr than the offical one) then tha will be great). Cheers!

Share this post

Link to post
Share on other sites
I've found that sending 10 or so position updates per second is usually sufficient, especialy with good prediction in place. In terms of actual messages that need to be sent, there are a few that I can think of off the top of my head:
Player position
Player fired a bullet
Player hit another player/got hit
Player scored a point
Player sent a chat message

Of course, things like chat messages depend on your game and if you support chat in the first place.

For p2p, you'll need to make some decisions about how collisions are handled. Since the game is being played over a network, if you have lag issues, one player may think they hit another player when that other player disagrees. In that case, since there is no natural central authority, you need to decide who to trust, the person who thinks they hit someone else or the person who thinks they did/did not get hit.

Also, as long as your physics is deterministic, you don't need to send bullet position every update, just a single message indicating when, where, and at what it was fired.

I'm not too familiar with SDL_net, but for this type of game I would encourage the use of UDP, especialy if SDL_net supplies its own reliability layer.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!