How to check collision from server side

Hi there,

I am a little confused how to check the collision staff from server side?
Like every time send a movement request, the server will approve it and move my character accordingly. How does the server know if I collide with others?

@jiechen It would help to know what exactly you’re doing, are you using relayed or authoritative multiplayer?

Out of the box the server has no concept of “movement”, “collision”, or “approving” client messages - it treats all messages as opaque data to be broadcast to other clients (if you’re using relayed multiplayer) or as data passed to your match loop for your own logic to process as needed (if you’re using authoritative multiplayer).

Thanks for your replay, like, I want the server have awareness of where all the character are. Like, if two characters collide on client side, I want the server know if they should be collided or not.
I think I am using relayed multiplayer for now.

No problem, that makes sense. You’ll want to switch to using authoritative multiplayer then.

At a high level your pattern should be something like this:

  1. Client sends movement info to match.
  2. In your match loop check incoming messages, validate and update player positions, check for collisions etc.
  3. At the end of your match loop send any updated data to clients: new positions, collisions etc.

All of this would be in your match handler’s Lua or Go code, it’s up to you which you’d prefer to use as the functionality is the same - both can do the job you need.

Thanks, it is very helpful.

Can I do something like running the game on server? all players control the characters from the server.