Is it Practical to fire a Remote event every Frame for every Player?

In my FPS game, the client script fires a remote event every frame to update the head position.

RS.RenderStepped:Connect(function()
local Data = { -- Ignore this Math
		HeadC0 = CFrame.new(0, 0.894, SinAngle) * CFrame.Angles(math.rad(AngleSimpled - 90), 0, math.rad(180));
		Character = Character;
		LShoulderC0 = CFrame.new(-0.894, 0.447, 0) * CFrame.Angles(0, math.rad(-90), 0) * CFrame.Angles(0, 0, math.rad(-AngleSimpled));
		RShoulderC0 = CFrame.new(0.894, 0.447, 0) * CFrame.Angles(0, math.rad(90), 0) * CFrame.Angles(0, 0, math.rad(AngleSimpled));
	} -- Ignore this Math
	Events.Animate:FireServer("HeadAndTorso", Data)
end)

However, Each server usually reaches 30 players. And in play tests, the average ping gets up to 110. When I tested with the script profiler, I found that more than 90% of the server work was from receiving this remote event.
Is there a more Practical, or less laggy alternative to firing a remote event every frame?

Generally you don’t want to send remotes this fast. Remotes are designed to provide reliable and in-order delivery of info, this comes at the cost of bad performance if you try to send things fast. If something is received out of order, the game has to wait for the missing message, or even request it to be resent, this can obviously take several times your ping as delay.
For the moment Roblox doesn’t have an alternative “unreliable remote” that can be used for non-critical but fast running stuff like this. A good workaround for now is to send messages at a slower rate and interpolate their value up to the full client framerate. This also hides any differences in the rates of the client vs the server.

An example of one way to do this: Send head position every 1/4 second, include some timestamp to indicate when that position was valid on the server. Once the client has at least two positions, it can look at the current time, find which two positions that time falls between, and do a simple lerp between the two.

2 Likes