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)?