How should I go about melee charging damage client and server?

I’m gonna try to keep this as short as possible, I’m working on a melee system that would have a charging system, how I want to go with this is have the hitbox on client and the server do range check on server with a little ping compensation range.
But for the damage, since the charging will be on client to reduce delay, this means exploiter can just send maximum charging value to server to do maximum damage even if they didn’t charged, and that’s my problem with it, should I just focus on making the game fun instead of trying to cheat-proof it? or is there any other way I can go about charging on melee?

as for the charge system, what i did for my hockey game which uses a charge system to detect power, is that i make the client send a start function to the server and log the time they held using tick() or time(), on release it just checks time()/tick() - holdTime and i do math to figure out max power. you could just use it on the client if you wish, but this is the method i did, ofc using math.clamp to clamp the power, or make an exploit prevention method by kicking ppl who have an obscene gap between their charge and hit

as for ping compensation, you really can’t do much, do not at all use the client in a pvp game as a detector for that since everyone’ll just cheat it. 2 methods i’ve used (one good, one bad, starting with the bad) is have a set hitbox range and increase it with character velocity to account for the client-server player position replication (the bad method), or have a genuinely large hitbox, not obscene, but a little farther than what your weapon should look like it’d have in order to account for latency (better method) deepwoken does this i believe and the combat for the most part ain’t dog water.

1 Like

Question, how would I go about making calculation on the damage depending on the charge? I’ve got everything else down but now the part I’m stuck on is trying to make a formula for damage range between minimum value and maximum value.

Edit: I think I got it, I can get the difference between maximum value and minimum value then check the difference between the charge and max charge to calculate the damage.

For anyone that might bump into this later, the formula I used is

local DamageRange = (20 - 40) ---Minimum and maximum damage
local ChargeRange = (0.4 * 0.8) ---Player's charge time and maximum charge time aswell
local Damage = (ChargeRange*DamageRange)
print(Damage)
---Should print "30"

could be anything really, for my game i made it so that the max time you could charge is like 3 seconds, so i do (time()-chargTime)/3 and get a number from 0-1, then i multiply that but whatever i want the power to be. you can be fancy with it and raise it to a power if you wish to make it exponential too.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.