How to Handle Real-Time Player Collisions in a 2D Game?

Hi, I’m making a 2D Roblox game and trying to handle real-time collisions between players. Currently, there’s noticeable delay during collisions. Here’s how my system works:

  1. Each player sends their character’s position to the server, which relays it to other clients for replication.
  2. When the server detects a collision between Player 1 and Player 2 based on their last known positions, it notifies both clients, and each client applies forces locally.

This causes a delay of course because of ping difference, making the client that collided first have to wait for the other client to react and send updates.

I haven’t implemented any fixes yet and would appreciate advice on improving synchronization and making collisions feel more immediate.
Here’s a video demonstrating the current issue (I’m controlling Player 2 on the right):

1 Like

Just checking, but are you absolutely sure it’s a ping issue and not one of your scripts causing the delay?

also the player turning red isn’t rly a good visual rn. to clarify it’s from the server detecting a collision and telling the client’s that collided there’s a collision with them, then each client applies forces on their own character and turns it red, then that color change made on the client is sent to the server which tells the other client’s about it

1 Like

yes I edited the network settings in studio to test ping difference, i set it to 0.2. when its on 0 theres no issues

2 Likes

this is how it looks on 0 ping, which is the real time collision i want so you can push and dribble players around instead of getting blocked:

1 Like