Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

help with lag in multinetwork ping pong game

 
Bruno Mesta
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
we are developing a multi networked ping pong game in java for class and the problems we are facing is that the game lags for some reason and it ruins the whole game. Our server is responsible for controlling the game and etc. We are using TCP to send messages constantly to the server with the following info: paddle x and y coordinate, paddle length, paddle height, ball x and y coordinate, and ball radius. Then the server broadcast the message to everyone the gui can be updated with the info that the server sent. The client and server are sending and receiving messages to each other every 40ms. We have tried running our program in different comp and we still have the same problem. does anyone have an idea how we can resolve this issue? We are thinking that the buffer can handle this constant messaging. We might be overflowing the tc buffer. If you need me to post some code let me know. I really need t fix this bug its driving me insane
 
lil Yaure
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i think 40ms is a bit too frequent, for my rpg the server sends messages on average every 200ms, the client just sends message whenever through the tcp socket.
I do implement path prediction tho.
 
Mich Robinson
Ranch Hand
Posts: 260
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also why are you sending the paddle length and height and ball radius each time? does these things change during the game? Would it be better just to send some info giving the speed and bearing of the ball then this info only needs to be sent when the ball direction etc changes rather than 25 times a second.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic