Jump to content
  • Advertisement
Sign in to follow this  
Florian22222

P2P Ping Pong

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

Hey!

I want to do a network ping pong where 2 players can play together. the only purpose is to introduce myself in network programming and p2p. Now i have a question. In the game there are 3 main object. 2 paddles and a ball. every client controls his own paddle. but who controls the ball? what is if the 2 clients are asynchrounous about the ball. like this:
A:"hey my ball is on 245,100"
B:"but my ball is on 200,150"
what should they do then?
do i have to make a master and slave concept too although i am in a p2p concept?

thank you for your answers, best regards florian.

Share this post


Link to post
Share on other sites
Advertisement

paddles and a ball. every client controls his own paddle. but who controls the ball? what is if the 2 clients are asynchrounous about the ball. like this:


Typically, you'll want to hand off responsibility for the ball. For example, as soon as I've hit the ball, I send a "I hit the ball, and it's now yours" message to the other side.
For various reasons, the simulation will work smoother when you're responsible for simulating the ball while it's incoming to your paddle.
Also, you will probably end up drawing the ball as if it is traveling faster when it's on the way in, and as if it's traveling slower when it's on the way out, to "hide" the latency in the simulation.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!