Hello, I recently made a projectile system, if used on the server side, will update a projectiles position 24x every second. this has the consequence of appearing laggy, on the clients screen. so I decided to tween the projectile to the next position. When a large quantity of projectiles are present, The CPU usage spikes, and the game becomes unplayable. I decided to remove the tween, but I once again have the projectiles appearing as laggy.
I wish to achieve a stable level of optimization, While maintaining good visuals on the projectiles.
Are your projectiles relatively fast and not long lasting? You should take a look into caching modules like PartCache because constantly instancing or cloning new projectiles, only to destroy them a second later can be expensive for the CPU when mixed with tweening aswell. You should implement some sort of caching aswell as what the reply above me suggested, as constantly creating new bullets can also be having a large impact on how performant your projectiles are. You should also try to switch everything visual in your game to solely be handled on the client as letting the server handle it might negatively impact your game’s network bandwidth usage.
Everything visual is handled on the client, but projectiles fired from server sided entities are handled on the server, for anti cheat purposes. the actual tracer and part are handled on the client. since using a cframe value saves performance over a part. I have already made a caching module, but this impacted performance more minimally than I expected. I also believe that using remotes every frame to retrieve the projectiles cframe, is very suboptimal, since Roblox sends a single package with all updated data to the client anyways.