So I'm working on my first network game and I'm using TCP. It's a netmaze clone. Netmaze is a game where the players control a tank that moves on a grid. The tanks always moves as long as they doesn't collide with a wall.
I send the tanks coordinates everytime they move one square. Before I only sent that data when a tank turned or stopped, but for some reason it all got messed up with diffrent positions on server and clients...
The movement is very choppy even on a LAN. I can't understand that... With a constantly low ping I would thought it might jump a little at turns since it would be a little bit off sync with the server but not else.
Hi daniel,
From your description, I'm still not sure if your game is turn-based or realtime. If it is realtime, you may want to consider switching protocols (ie. use UDP). This way, you don't have to eat up your bandwidth with all the TCP retransmission stuff.
But, you did say that you tried it on LAN and it still doesn't work. With typical LAN pings, it shouldn't be jerky at all (at least in my tests). Perhaps your code is sending out packets too much and not "every time they move one square". In the past, I've found that odd jerky behaviour on low ping settings is the result of my code flooding the client or server with packets.
btw, how often is it that a tank will move one square?
-j
From your description, I'm still not sure if your game is turn-based or realtime. If it is realtime, you may want to consider switching protocols (ie. use UDP). This way, you don't have to eat up your bandwidth with all the TCP retransmission stuff.
But, you did say that you tried it on LAN and it still doesn't work. With typical LAN pings, it shouldn't be jerky at all (at least in my tests). Perhaps your code is sending out packets too much and not "every time they move one square". In the past, I've found that odd jerky behaviour on low ping settings is the result of my code flooding the client or server with packets.
btw, how often is it that a tank will move one square?
-j
Is it possible that you didn't turn on the TCP_NODELAY option, like the FAQ says you should?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement