Is It True That Projectile Stuff Shouldn't Be Done On Server?

I have designed a combat system for my game that has objects spawn and be manipulated on the server. For example, a projectile will spawn as an object and then apply AssemblyLinearVelocity to it, along with any additional settings I’ve coded (aim assist, follow mouse, stuff like that).

However, I had another game dev review my code and he said that I’m going to have replication issues later on doing it this way, stating that the server has to replicate all movement and positions of objects and everything to every client and when I have more than a few dozen objects flying around (I definately would, as this is a PvP heavy game) then that gets really bad.

He suggested I not spawn stuff on the server and instead send remote events to all relevant clients to spawn and control the visuals of the objects themselves.

It seems like solid advice, but I’m coming on here hoping he is wrong. This would require an entire architectural rewrite of my systems, as the server needs to find stuff (like hitboxes) on objects. But if those objects don’t exist, well, I’d have to figure that out. So… Is he wrong?

1 Like

He’s right.

Physics objects take a lot of network data to replicate and with enough, will cause a ton of lag on the server.

Personally I just wrote a custom physics system using raycasting so there’s absolutely no replication lag and so the client gameplay can feel snappy. I have the server doing the absolute minimum of work. The client actually is the one doing most of the work, but of course there still is a ton of verification on the server. As just a small hint to what I personally do, not every bullet will hit something, so there’s no point in simulating every projectile all the time on the server.

Also you just really shouldn’t be using parts for projectiles as they’re really unreliable on top of being horrible for performance. The only times you should be creating hitboxes on the server is when they’re completely static, and even then there’s probably a ton of alternatives which don’t use physical hitboxes.