Client/Server physics
by Snowman · in Torque Game Engine · 11/02/2001 (5:34 pm) · 2 replies
Hi. I've messed with the physics a little bit in my quest to adapt them for my skiing game. They're ok. Not perfect, still need plenty of refining, but getting there.
Anyway, it works fine in a single player game, but in multiplayer it doesn't. If I play by myself in multiplayer it works ok, but when I play with others, it gets messy. Especially for the others.
It is fairly obvious that the client and server are getting out of sync, which is why I get the ugly popping (skipping). But my question is why do they get out of sync? Are there more then one place to change the physics? If both sides are executing the same physics why would it get out of sync?
I just change the physics inside the updateMove() function in player.cc
The true clients are the worst. They experience a lot of popping, and the move functions don't really work. The client on the server machine is a bit better, avoiding a lot of the popping (a lag issue I assume), but still the move functions are funny.
I had to up the runforce because I upped gravity, however in multiplayer with other people it doesn't seem to be using the new and improved runforce.
Any help would be great. Thanks!
-Snowman
Anyway, it works fine in a single player game, but in multiplayer it doesn't. If I play by myself in multiplayer it works ok, but when I play with others, it gets messy. Especially for the others.
It is fairly obvious that the client and server are getting out of sync, which is why I get the ugly popping (skipping). But my question is why do they get out of sync? Are there more then one place to change the physics? If both sides are executing the same physics why would it get out of sync?
I just change the physics inside the updateMove() function in player.cc
The true clients are the worst. They experience a lot of popping, and the move functions don't really work. The client on the server machine is a bit better, avoiding a lot of the popping (a lag issue I assume), but still the move functions are funny.
I had to up the runforce because I upped gravity, however in multiplayer with other people it doesn't seem to be using the new and improved runforce.
Any help would be great. Thanks!
-Snowman
About the author
#2
Plus, I was using a static variable inside the member function. I didn't realize that that variable is the same between instances of the class. Oops =)
Thanks again Tim!
-Snowman
11/06/2001 (6:12 pm)
Ok, thanks Tim. I think I'll just rewrite what I did to the physics anyway, it's quite a hack job.Plus, I was using a static variable inside the member function. I didn't realize that that variable is the same between instances of the class. Oops =)
Thanks again Tim!
-Snowman
Torque Owner Tim Gift
- All constants must be shared using the datablock
- All forces must be generated either directly from an input move (button press etc), or from the player's current pos (+ velocity, etc.) and collision information.
Essentially if you act on any information not in the datablock, the input move, or from the deterministic position of the player, the client and server will get out of sync.