I’m currently making a game where the clients input creates projectiles that appear to all other clients via the server, not :FireAllClients(). My issue is that I’m getting super high receive rates in my network stats from just 1 player.
At first I had the client sending a ton of information over to the server, such as the actual projectile to put on the server, and all the properties afterwards. I’ve since changed it to where all the client sends is the name of the move being used, and the mouse’s position, but little has changed.
Code beforehand:
My code now:
This one line does the same thing from before, just with less data being sent across the server-client boundary, yet I’m still getting poor receive rates.
You can spawn the projectile on the server, set the Network Ownership of the projectile to the player, then control it on the client. An easy way to implement this is to have a folder in workspace specifically for projectiles, create a StringValue called “Owner” inside the projectile and set its value to the player’s username. Have a LocalScript inside StarterPlayerScripts that loops through the projectiles folder, check which projectile is the player’s, and fire it.
looks like you’re sending multiple remotes to the server with little interval in-between, this is generally very bad practice, I’d recommend you to compact the functionalities of the multiple remote events into 1 remote, although having the remote server receiver handle more stuff can decrease performance, it’s nowhere near the impact of firing a bunch of remotes each to handle smaller functionalities
I have a folder in workspace already for projectiles, and I tried doing:
projectileClone:SetNetworkOwner(nil) -- server
But what do you mean by “then control it on the client.” Loop through the projectiles folder and fire it? Like fire the remote event from a loop on the client?
That was my old approach, yes, but I’ve since changed it to where I can fire any number of projectiles with just 1 :FireServer() using a module (which the server checks to see how many projectiles to fire)
I see, is the amount of projectiles fired handled through a for i = 1, FiringAmount loop? in which case it’s functionally very similar to firing multiple remotes for each projectile that needs to be fired, you can try to resolve this by rendering the projectiles and their particle effects on the client as the projectiles seem very resource intensive effect-wise from what I can tell
Yes, based on the info from the module script properties are applied straight from the server rather than the old method of sending them across the server-client boundary:
And with your suggestion to render the effects/projectiles on the client, how would I go about checking for a hit or dealing damage reliably? Create an invisible part on the server to follow the same path and use a region3?
a method you can use is to make the projectiles invisible on the server and have the clients make them visible and enable their assosiated effects. though it probably won’t entirely shave off the network impacts as you’re still creating hundreds of invisible hitboxes all simulating their own functionalities, I’d advise you to look into other sources of optimizing the server-side projectiles