How can i add ping tolerance to server? this is my issue,
Hello, how do u handle ping issues when making a combat system?
Im making a simple punch system with combos, its server sided uses remotes to play animations, handle combos and vfx.
My combos keep resetting or the system feels very slow (time between each hit increases, this includes animations vfx and everything) when ping gets high, the combo system is entirely server sided, it checks the difference between os.clock() and the last hit to reset. Client simply fires remote everything is done on server and server uses remotes to ell the client when to play animation,vfx, and do knockbacks.
Is this your first time making a combat system? if yes, i recommend you watch a video before attempting it. It will give you an insight and some knowledge on how to do it.
This series by sushi master is an excellent tutorial to get you started
this guy is the creator of muchacho hitbox, one of the most widely used overlap params hitboxes for combat.
My overall system still slows down when i face high ping i could use some help. Here is a comparison of normal VS high ping. Example (its a streamable link, so its safe)
when i go above 200 ping my combo system doesnt stack i tried something to fix combo stacking which works, shoud i do something similar for cooldowns?
local plrping = plr:GetNetworkPing() + (20/1000)
if os.clock() - LastM1 > 1 + plrping then
-- code
end
when my ping is more than 200 the whole system slows down like the delay between each hit, i feel like this is because due to delay, i set a cooldown on client and server, when server cooldown resets i fire a remote to tell the client to remove cooldown
Well, the system might be slowing down if you’re using RemoteFunctions, and plr:GetNetworkPing() might also add some delay to the function.
Outside of that, the problem is the time between when the server recieves the input signal vs when the client sends it. In my own game, I use an input queuing system which basically will store an input if the player can’t do it right now. Once the current action ends, the stored input is used immediately, resulting in little difference between a 200ms and 25ms combo.
Im not using remote functions, ive put my cooldown handling at the top of the function on server which has made things better i also used plr ping to reduce cooldowns accordingly with some safety measures. But im interested in qhat you mentioned, how does event queuing work? Does your system run smoothly now even when ping gets high? I would appreciate it if u could help me and teach me the method and how it makes a difference.
Ideally, the server should be recieving input from the client through a single remote event (per player). If no current action is happening, we start a loop that will constantly run actions. Now, if another input is sent while this loop is running, the parameters are stored for once the current action ends. It should look something like this:
RunningLoop = false
StoredAttack = { --//Store the parameters. You could shorten this to just a string if your game is simple enough.
Name = "None"
}
function ClientInput(newAttack)
StoredAttack = newAttack
if RunningLoop == false then --//Start the loop if we aren't running it already.
AttackLoop()
end
end
function AttackLoop()
RunningLoop = true
while StoredAttack.Name ~= "None" do
oldName = StoredAttack.Name
StoredAttack.Name = "None"
Weapon.Attack(oldName) --//Attack function here.
--//If another attack is stored, this loop will run again.
end
RunningLoop = false
end