It appears that the physics engine only runs on every frame? Even if I turn off fixed update in the settings, I’m having trouble getting collisions to register between frames.
The Problem: Client sends batched input to the server. The server immediately processes steps through on_message, one after the other. Collisions do not get calculated at all and/or incorrectly.
Things I’ve tried:
-
Handle all batched movement in one go. This seems to not work, because the engine never even gets collision messages, because the final position isn’t colliding.
-
Handle each movement one at a time, and then see if there is a collision on_message. This would get collision messages, but the positions still seemed to ignore collisions/not handle collisions appropriately.
-
Tried dynamic bodies instead of kinematic bodies. Same issue as number one, it seems to never get collision data because the movement happens too fast for the engine to process collisions.
Question: Would there be any way to batch player movement where collisions are still handled on the server? The only thing I can think of at this point would be the player needs to send movement each game tick, and the server would handle each input in sequence (which wouldn’t be ideal for performance or network traffic).
Github repo: GitHub - alteredorange/war-battles-multiplayer: War Battles Multipalyer
Currently set up for solution #2. To see it in action, bundle a headless build, start the headless build, then build regulary (ctrl + B), and click “level 1”.
The player should load, and you can run around and see your position is synced with the server position (from the server print statements). But if you run into a tank or a wall, you’ll see the positions drift. All server movement handling is in player_client.script
.