Collision Handling In-between Game Ticks?

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:

  1. 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.

  2. 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.

  3. 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.

I’m probably not skilled enough to help, but still I tried to run your game and server. Sadly there seems to be a problem with the server:

I followed your steps, so I built headles, started it, builded regular, joined. Server prints errors and client excactly the same no matter if server is still running or closed (however is needed to place player).

I did something wrong, or thats just normal behaviour?

That’s odd! On the client, does the player load and you can run around? The server is trying to pass the movement to the server movement script through a msg.pst in this script ( line 35. It seems like either the player isn’t being created, or named something different in your instance. Not sure why it would be named different though.

If I started the client when the server was up, the player have spawned in the corner and I was able to move. After connection I could walk around no matter if server is still on or shut down.

When client was started without server, there was no player, just static camera near center of the map.

Just pushed a new update, you can try again if you want. Got sever collisions to work. Rewrote everything to use fixed_update and rendy camera. Single player movement works great, and basic multiplayer state sharing is sort of working but needs some tweaks :rofl:

Just downloaded it from Github and opened as a new project, then bundled a headless Windows build and a regular windows build. Open the headless server once, and the regular build twice, then you should be able to load into level one and run around.