How would I go out of my way in reducing RemoteEvent request delays?

I am basically implementing an input system for my game that is planned to be fast-paced. I have implemented such input systems before, but they seem to aggravate large amounts of delay when ping is around more than 200 ms. Some games from ROBLOX has little input delay even with this ping, so how would I go by reducing the delay? Well, it is virtually impossible to eliminate delay itself overall, but reducing it is possible, right?

Traditionally, I send a string value in the RemoteEvent, which is the string value of something from a StringValue object (since it supports keybind changing) yet it may seem to still have input delays.

My traditional method in parsing this input into an action in the game was like this:

-- Scrapped Code!
Event.OnServerEvent:Connect(function(Player, Type, Skill, Key) 
	local Character = Player.Character
	--
	local Data = Player["Data"]
	local Stats = Data["Stats"]
	--
	local Conditions = Character["Conditions"]
	if not CLYDE.CheckConditions(Conditions) then return end
	--
	if Type == "Block" then
		local Stats = Character["Stats"]
		--
		if Conditions["Blocking"].Value == true then Conditions["Blocking"].Value = false return end
		if not CLYDE.CheckConditions(Conditions) then return end
		if Stats["Endurance"].Value == 0 then return end
		
		Conditions["Blocking"].Value = Skill
		Conditions["LastMoveDone"].Value = "Block"
		return
	elseif Type == "Combo" then
		local Counter = Conditions["Combo"].Value
		--
		local Index = Arsenal[Stats["Weapon"].Value]
		local Resources = Framework.GetResources("Combo", Index["Type"])
		--
		if Index then
			CHandler(Player, Framework, Index, Counter, Resources)
			Conditions["LastMoveDone"].Value = Index["Type"] .. "Combo"
		end
		
		return
	end
	
	local FindType = Actions:FindFirstChild(Type)
	
	if FindType then
		if FindType.Name == "Equip" then
			local Index = Arsenal[Stats["Weapon"].Value]
			
			if Index then
				require(FindType[Index["Type"]])(Player, Framework, Index)
				Conditions["LastMoveDone"].Value = Index["Type"] .. "Equip"
			end
		
			return
		end
		--
		local Action = FindType:FindFirstChild(Skill.Value)
		local Resources = Framework.GetResources(Type, Skill.Value)
		
		if Action then
			require(Action)(Player, Framework, Skill, Resources, Key)
			--
			Conditions["LastMoveDone"].Value = Skill.Value
		end		
	end
end)

Since all my games are modularized, it requires and calls an Action module when found at the end. I figured that if I instead not use strings to pass onto events, but rather much less extensive parameter type (like instead of the name of the key is passed and type, rather just a string of numbers)

What do you think? How’d you go by your way of removing input delay (if you have)?

In general, you can’t reduce the delay, only hide it.

  1. Player presses ‘punch’ button
  2. Client immediately plays punch animation and updates damages on its side
  3. Client sends ‘punch’ command to server
  4. Server checks if the player really can punch, and what kind of damage it could do
  5. Server updates anyone’s damage and sends that update to all clients
  6. Client gets confirmation that its punch:
    • worked as expected, in which case nothing happens, or
    • failed for some reason (their target was somewhere else really, etc.), in which case the client just takes the updated data from the server (this is what “rubberbanding” is in online games)

It’s a pretty tricky problem to solve, usually.

2 Likes

Yeah what @nicemike40 said is what most of the games you’ve seen do to hide the input lag. It looks like you’re attacking but you actually aren’t, but at least they player cannot really see their lag.

You can’t reduce the delay that it would be significant. It mostly relies on the player’s network, and the optimization of the game. But you can make certain things first on the client and after that replicate them.