Do I need to run my projectiles on the client?

In my game there a max of 10 people per server and to fire a projectile you have to type a spell in chat if it’s a spell it sends it to the server which fires all clients to load the projectile, I’m just wondering if I even need to load it to the client or should I just load it on the server because right now loading it on the client is just making it a pain to hit detect it has a lot of delay.

The delay gets worse as I move my graphics down, sorry if it’s hard to see the delay.

I calculate the time it takes for the projectile to reach it’s destination then I round it down to the nearest tenth, then if the number is larger then .25 it divides the number by 2, theirs probably a better way to do it but I haven’t found it yet.

        local ignore = {game.Workspace.FlyingSpells,plr.Character}
		local ray = Ray.new(start,(ending-start)*range)
		local hit,hitpos,normal = game.Workspace:FindPartOnRayWithIgnoreList(ray,ignore)
		local Distance = (start - hitpos).Magnitude
		local TimeCalculation = (Distance/speed)
		
		--time
		local function floor(x)
			return x - x % 1
		end
		local Time = floor(TimeCalculation * (10^2)) / (10^2)
		if Time > 0.25 then 
			Time = Time/2
		end

		--hit
		wait(Time)
		if hit then
        --stuff here
        end

So my question is will it be better to load projectiles on the client or the server and will it make a difference if loaded on the client seen as there won’t be very many projectiles at one time, the most there can be is 10 at a time.

It is much better to run the projectile on the server, It may be trickier to script, but it makes your game a whole lot better as it shows you put more effort in and the logic about them taking damage would make sense. If you were to only play it on the client, they might even think the game is glitched.

False, it’s a lot better to run projectiles on the client. Almost every popular game runs projectiles from the client since it makes it a whole lot smoother and could make it seem like theres almost no input delay. When the player clicks you want to instantly fire the projectile from client and send the information to the server. The server then tells the other clients to create that projectile and fire it with the info provided. For hit detection I would do that from the client and when the projectile hits something you send an event to the server to confirm that the hit is possible.

11 Likes

Not all the time does it run better. I have made guns before that run much better on server than the client.

I tried something like that for the hit detection when the projectile hit something it would check if the player the projectile was loading on was same player that fired the projectile and then it would fire an event to deal damage but it had massive delay issues and im not sure why

This is wrong.

With laggier, jittery projectiles for players with poor connections?

Never, have I ever played a high-quality combat game with a client-server network model that handles projectiles on the server. Imagine how laggy it would be if you have the server processing the appearance, trajectory, and various other things for hundreds if not thousands of clients. This does not make sense at all.

OP explicitly stated that he is going to load the projectile, and not entirely process it.

1 Like

Late to the solution party but here’s a little flowchart for a client-server-client model that I gave someone a while back.

Already done that I’m trying to get rid of the latency with my projectiles, I’ve been experimenting with multiple different hit detection methods that run on the server while having visuals on the client. I have even tried using fast cast, maybe I’m doing something wrong idk.

Are you sending lots of arguments to the server? Is the server sending lots of arguments to the client(s)?

Kind of i send them in a table theirs probably about 10 of them.