Game Development Community

Screen "shakes" in network play

by John Cooney · in Torque Game Engine · 04/12/2005 (1:34 pm) · 19 replies

A weird problem has crept into my game just recently and I can't determine what the cause is. During network play (and only in network play), the graphics seem to "shake" up and down just by a few pixels. The shaking is definitely more noticeable when my car is idle than in motion. I've examined the console logs and cannot determine anything that would be affecting this.

I do not believe this is a bandwidth issue, as I tried running both the server and client on the same machine and connecting to localhost and the problem was still just as evident.

How does one best go about debugging an issue such as this?

#1
04/12/2005 (2:24 pm)
Try turning the DEBUG_NET define on in sim/netConnection.h. Compile it, and check for errors in the console.
#2
04/12/2005 (3:21 pm)
I did that and all I am getting is this message, continually during network play server-side:

packetDataChecksum disagree!

What sort of issues could cause this?
#3
04/12/2005 (11:19 pm)
If I recall correctly, that indicates that the client and server are disagreeing on the simulation of the car. Check your prediction code.
#4
04/13/2005 (11:08 am)
Prediction code? I haven't messed much with the vehicle internals. What exactly would I be looking for?
#5
04/13/2005 (2:53 pm)
Well, the physics code is run both on server and client to get proper vehicle movement in both cases, so it might be that something is being taken into account in the one case that isn't in the other. If this sounds very crazy and complicated it might be better to shelve the issue for a while... :)
#6
04/13/2005 (3:03 pm)
Sounds like my car, whenever I sit in it while idling the whole world seems to shake a little... Oh yeah forgot to turn down the volume :)
www.cartoonstock.com/lowres/gpi0031l.jpg
#7
04/13/2005 (3:11 pm)
I was under the impression that packetDataChecksum was used to verify the data sent/received over the network. Have a look through any network-related changes you've made. Most likely you're sending (or trying to receive) something extra and it's putting the values you are getting from the server (or are sending to the client) out of whack. Odds are it's something small like an extra flag being sent (because bigger errors tend to result in the game not running at all =)).
#8
04/13/2005 (3:24 pm)
Daniel:

The main change that I have made that would be anything related to this is changed MaxMountedImages back to 8 from 4. In a previous CVS checkout I had of Torque, it was 8. When I recently downloaded the 1.3 release, it was 4.

I have tested it with versions with and without that change and I am still getting the checksum errors, though.
#9
04/13/2005 (4:23 pm)
This sounds related to a network bug I've been tracking down with Tim for a while.

Try commenting out the following lines in GameConnection::getMoveList()

*numMoves = (mMoveList.size() < mMoveCredit)?
mMoveList.size(): mMoveCredit;

and replacing with:

*numMoves = mMoveList.size();

I've also seen problems with initially synching the physics across the network, try letting your car stay idle for a few seconds before you move it and see if the checksum errors stop.
#10
04/14/2005 (8:59 am)
Brian:

Unfortunately, that did not fix the problems. I am still having the checksum errors. These errors (including the video "shaking") start immediately, before I even have a chance to start the car moving.
#11
04/14/2005 (3:29 pm)
OK, well it could be a physics oscillation problem with the car's suspension. There's another problem I've seen where the client and server have trouble synching up if the object is moving up and down right off the bat. Is the car bouncing in place a little bit even when you are in a localhost game?
#12
04/15/2005 (12:19 pm)
If you are referring to a "single player" game where both client and server are in the same process, there is no detectable bouncing when the car is idle and the only bouncing that happens when the car is moving is that which one would expect with the interactions with the terrain.

Interestingly, I am still getting the packet checksum errors when I run it in single player mode, just not as frequently. So, I'm not sure if they are related to this issue or not. :(
#13
04/18/2005 (4:17 pm)
I've run out of ideas John;) This should not be happening with a stock Torque vehicle. Tim and I are going to be tracking down some networking issues we know about. Hopefully our fixes will solve your problem.
#14
04/24/2005 (12:58 am)
Well... it is not entirely a stock Torque vehicle. The cars in the game are actually derived from the wheeled vehicle class. Most of the functions make callbacks to the parent class however there are a few modifications to the physics update. #1 Gravity has been changed from a hard coded value in the c++ code to a value that can be set in the script upon the vehicles creation. #2 A value has been added to decrease the friction on the back tires of the vehicle so that the car can still grip and have turn control but slightly allow for the tail in to fishtail. If this is related to the prediction code at what point does the server and client take a different path? To me I would assume that the same block of code is preformed on both sides without any differences.
#15
05/03/2005 (4:53 pm)
I've checked in a change that Clark Fagot made to WinTimer that fixed a lot of problems we have been seeing with synching the client and server.

See:

www.garagegames.com/mg/forums/result.thread.php?qt=19886
#16
05/03/2005 (6:08 pm)
Quote:#1 Gravity has been changed from a hard coded value in the c++ code to a value that can be set in the script upon the vehicles creation.

Is this value being properly synchronized between server and client? If it isn't, that'll cause the bad packet checksum and the jumpy vehicle because the client and server would be acting on different values.
#17
05/09/2005 (11:14 am)
Im new and all, but maybe you are looking in the wrong place? i find that if i edit the terrain file then run in a new client - which doesnt seem to update the terrain on the client - the area shakes when the client walks through the bit that is different on the server
#18
06/14/2005 (6:07 pm)
Just an update on the problem, there was a small modification to the vehicles data structure which did not get packed for the network data. Totally missed it the first look, thanks for all the help!
#19
06/15/2005 (8:07 pm)
I was just about to start typing when I read the final post... :)

I've done this so many times in the past I recognized this problem instantly.

The Simplest answers are usually correct (Ben =p).

Now you can't flame a guy for not remembering every problem he ever helped someone solve... But after being a member of the GG community it is indeed funny to watch the devs go through the same thought processes to solve problems they solved a year ago. :)

To sum up, if your vehicles/players/weapons begin some kind of crazy jitter RECHECK the pack/unpack data methods! Make sure everything you pack gets unpacked and vise versa. This issue has been a boon to so many GG programmers I think I'm going to bookmark this thread. :)