Sign in to follow this  

**************Two player pong***********

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

hi, I'm beginner in the field of directx (game programming). I'm facing problem in implementing PONG game in network. As I posted the message before that my PONG works fine in same computer(in which one window is server and other is client).But as I try to play the game between two machine it's become too slow. What actually I'm doing is as follows:- 1)I'm using TCP. 2)server side:- for loop { a)receive data(size of message from client and message paddle2) b)send data(paddle1 position and ball x,y position) c)rendering(displaying the paddle and ball) } 3)client side:- for loop { a)send data(paddle 2) b)receive data(paddle1 and ball ) c)rendering. Kindly ,help me .

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
TCP is a relatively slow protocol. But that shouldn't be a problem as you can get TCP to go very fast. Especially on a local network.

http://www.compuware.com/products/devpartner/profiler/default.asp?cid=3019X36&focus=DevPartner&source=Web+%2D+Evaluation+Request&desc=Download+%2D+%27DevPartner+Profiler+Community+Edition%27&offering=DevPartner&sf=1&p=0

DevPartnet Community Profiler is what you want to see where your bottleneck is. Your program will run horribly slow when it's profiling but the results are accurate for how long various things took to complete.

My guess is that you're using blocking sockets which causes Winsock to halt the program while it waits for a message to come in.

You may also be making the mistake of treating TCP like a messaging protocol. e.g. you expect to send and recieve single whole messages at a time instead of a stream of bytes which could be more than one message or an incomplete message.

It's a streaming protocol. Treat it like one and it will do very well for you.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
thanks a lot,
But here I'm using nonblocking socket.
Select() function.
for sending paddle position and ball position I have
different send and receive function

Share this post


Link to post
Share on other sites
sorry I did'nt log in
that's why Im
thanking again.
thanks a lot,
But here I'm using nonblocking socket.
Select() function.
for sending paddle position and ball position I have
different send and receive function

Share this post


Link to post
Share on other sites

This topic is 4862 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.

Guest
This topic is now closed to further replies.
Sign in to follow this