# How to check collision from server side

**URL:** <https://forum.heroiclabs.com/t/how-to-check-collision-from-server-side/1015>\
**Category:** Game Design\
**Created:** [October 1, 2020, 2:23pm UTC](https://forum.heroiclabs.com/t/how-to-check-collision-from-server-side/1015 "2020-10-01T14:23:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jiechen](https://avatars.discourse-cdn.com/v4/letter/j/ea5d25/32.png) [@jiechen](https://forum.heroiclabs.com/u/jiechen)\
**Post date:** [October 1, 2020, 2:23pm UTC](https://forum.heroiclabs.com/t/how-to-check-collision-from-server-side/1015/1 "2020-10-01T14:23:17Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![zyro](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/zyro/32/14_2.png) [@zyro](https://forum.heroiclabs.com/u/zyro)\
**Post date:** [October 1, 2020, 2:59pm UTC](https://forum.heroiclabs.com/t/how-to-check-collision-from-server-side/1015/2 "2020-10-01T14:59:55Z")

</div>

@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).

---

<div class="post-metadata">

**Author:** ![jiechen](https://avatars.discourse-cdn.com/v4/letter/j/ea5d25/32.png) [@jiechen](https://forum.heroiclabs.com/u/jiechen)\
**Post date:** [October 1, 2020, 3:16pm UTC](https://forum.heroiclabs.com/t/how-to-check-collision-from-server-side/1015/3 "2020-10-01T15:16:56Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![zyro](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/zyro/32/14_2.png) [@zyro](https://forum.heroiclabs.com/u/zyro)\
**Post date:** [October 1, 2020, 3:27pm UTC](https://forum.heroiclabs.com/t/how-to-check-collision-from-server-side/1015/4 "2020-10-01T15:27:36Z")

</div>

No problem, that makes sense. You’ll want to switch to using [authoritative multiplayer](https://heroiclabs.com/docs/gameplay-multiplayer-server-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.

---

<div class="post-metadata">

**Author:** ![jiechen](https://avatars.discourse-cdn.com/v4/letter/j/ea5d25/32.png) [@jiechen](https://forum.heroiclabs.com/u/jiechen)\
**Post date:** [October 1, 2020, 3:57pm UTC](https://forum.heroiclabs.com/t/how-to-check-collision-from-server-side/1015/5 "2020-10-01T15:57:18Z")

</div>

Thanks, it is very helpful.

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