Help with network efficiency?

I have a fireball projectile system, which works fine but im worried it may be harming my game in a way. The way i do is with a remote event and a remote function. I can change the remote function due to security but that doesnt matter for now.

Layout:

Client → Server
Server → All Clients
Server → Client
Client → Server

When the client fires the server the server does a sanity check to see if all is well like cooldowns. Then if it passes the server checlk, the server fires all clients while also passing a origin and direction. All clients replicate the projectile on their own screen and it doesnt matter for the server to see. Then the server invokes the client who sent the move request in the first place with the origin and direction arguments. The client returns the hit characters on their screen using raycasts or spatial queries. The returned characters do a sanity check, then if passed the check, damage is dealt on the server. The reason its on the client is because in the future if i have npcs only seen on the client the client has access too.

Also i reduce the data sent by alot. I only send a max of 2 or 1 arguments which are vector3s and Cframes.

Any methods on how to improve or any examples? Or is this the best way for now?

image

This is pretty much as good as it gets. You could try having the client start the projectile before the server confirms that it can be done, and in the case it shouldn’t have been fired, the server can refuse to replicate the projectile.

1 Like