How to move some stuff on the server?

Hi,

Imagine I have a multiplayer game like Call of Duty. To achieve more security I, naturally, want to do things like collision detection (for killing other players) and item pickup (like new weapon) on server. How can I do it with uNet?

Thanks.

At the top of this forum, there’s a collection of Multiplayer samples. You may want to start there.

Link:

Thanks, I’ve seen them but lack of comment makes it impossible for me to learn anything from them. Also they are somewhat advanced for me.

Also a fan of Futurama here!

The Unity folks, just shipped a complete tutorial walkthrough! That’s good news for you. :slight_smile:

Thanks, read and done it. Unity does a good job of hiding good info like this as well ;).

But my original question still stands. If I want collision checks only get checked on the server (to prevent cheating), what should I do?

My best guess is to either use [ServerCallback] attribute before collision call or checking for “isServer” on top of the collision check method.

You can do that, I suppose, or just let the server handle all movement and collisions together, and just send it inputs from the client, which I think is the typical way of handling things like this. If you’re using physics I think you HAVE to do this since unity physx isn’t deterministic. That’s only true though if you want to make an authoritative server and not trust clients.

Just to be clear about the last post. Unity’s physics aren’t deterministic, so if you are using physics, and the physics is being calculated on the client, you MUST find a solution to sync them in non-deterministic scenarios.

If you are using the server to do physics, and you’re just sending the resulting transforms out to each of the clients, there is only 1 source of physics data, so it does not need to be deterministic, as it’s the only one calculating it.

1 Like

Part 7 of my basic network game tutorial covers server controlled heath pickups, it’s a pretty simple example, but it might be worth taking a look at it.
http://www.doofah.com/tutorials/networking/unity-5-network-tutorial-part-7-improved-respawning-and-health-pickups/