Network Transform Help

Hi,

Basically I’m creating a multiplayer space shooter but in multiplayer the players can’t push other player ships which isn’t a big deal, except the host can add AI and they can push them around but the clients can’t. I’ve spent a long time on this and I’m very stuck. I either want the transform to be editable by all clients so everyone can push everyone around, or I want to make the host no be able to push the AI around but I’ve spent a long time trying to come up with a solution to prevent rigid bodies pushing each other but still colliding and stopping each other. And I definitely want the ships to collide in some way and not just go over each other. Any help is very much appreciated, thanks!

Read up on physics collision in the manual. It’s a matter of setting up who can collide with whom first.

When you make players collidable with AI but the client players still don’t collide with AI, it depends on how you implemented the physics behaviour for networking. We’d need to see some code or inspector setup for this.

You would normally use NetworkRigidbody to synchronize physics bodies. This sets the client’s rigidbodies to kinematic, which means they don’t collide locally with anything. But their state is synched with the server/host who runs the physics simulation and then returns the updated state (transform) back to the client. So if clients don’t collide on the host side with AI I guess either their rigidbodies are not synchronized with the host or their collision mask is set to not collide with AI, or they don’t have a rigidbody to begin with, or … something else.

Note that server-authoritative physics with interaction between clients or clients with dynamic physics objects is rugged at best. It is ripe with issues and will never feel right for client players due to the latency involved. This always needs some local prediction component to feel right, eg preventing clients from stepping into a collision and then rubberbanding back out of it.

Thanks for the help except I am not sure if you are understanding my problem correctly, sorry if I worded it poorly. The AI, Host, and Clients, all collide with each other but the problem is the host can push around the AI, but when the clients collide with the AI they just hit it and stop completely, which I understand why that happens. So maybe this is less of a networking problem and more of a physics problem because I want the host to stop when they hit another AI ship just like the clients so they aren’t able to push them around, that way the host and clients all behave in the same way. I’ve tried setting the AI rigid bodies to kinematic but that won’t work because the AIs can’t collide with each other then, and the AIs can push the host player around. I need the physics behavior for the AIs as if they were each their own player on their own machine.

Does anyone else have any ideas? Let me know if my question isn’t clear and I’ll try to explain it the best I can. :smile: