minetest
minetest copied to clipboard
Prevent damage avoidance in damage_per_second nodes
Problem
Often, you can manage to avoid damage from nodes with damage_per_second
even if you are inside. You just have to be inside those blocks at the right moment and for less for a second.
That way, you could pass a couple of such nodes with 0 damage.
This is bad if you want to create a barrier that guarantees damage when passing it. It screws up game design if players can just luck out and walk through without any damage.
Analysis
It seems that damage is dealt on fixed time points that are the same for all players. So the nodes only hurt when the player is inside a specific time. Any other times are completely safe. So you can easily luck out.
Solutions
I propose a solution that guarantees damage when entering a node:
- Create internal “damage timers” for every player, initialize them with 0
- When a player is touching any
damage_per_second
node anywhere, immediately apply the node damage - Start the player's damage timer
- Every time the timer has advanced by 1 second and the player is still touching any
damage_per_second
node(s), deal node damage again - When the player is “safe” (outside of all
damage_per_second
nodes, stop the timer and reset it to 0
Alternatives
In case the current damage method is still desired for some reason:
Add a new field to the node definition. If set to true
, apply the new method of instant damage. If set to false
(=default), use the current damage method.
This won't allow hacked clients to completely bypass damage?
Hacked clients are a separate problem. This issue does not care about hacked clients. It is concerned about basic gameplay functionionality of damage_per_second
. You do not need a hacked client to exploit the current behavior of damage_per_second
, you just need to be lucky.
Hacked clients are a separate problem. This issue does not care about hacked clients. It is concerned about basic gameplay functionality of
damage_per_second
. You do not need a hacked client to exploit the current behaviour ofdamage_per_second
, you just need to be lucky.
But you can't get around the current behaviour of damage_per_second with a hacked client.
Maybe do this by having the player send a 'entered DPS node' packet that resets the server's check-&-damage-if-in-dps-node timer (for them only, other players might enter at a different time). It should have about the same result, and that way if the player's client doesn't send the packet the server will still deal damage as usual. This will also preserve backwards-compatibility too AFAIK
I cannot see how the suggested solution allows hacked clients to avoid damage, presumably the suggested solution is also serverside?
I think the solution needs to be fairly simple, as this is a minor issue. For many damaging nodes, running quickly through without being damaged makes sense, for example fire.
I cannot see how the suggested solution allows hacked clients to avoid damage, presumably the suggested solution is also serverside?
Heh, might be. I was assuming Create internal “damage timers” for every player
meant a timer for each client
I think the solution needs to be fairly simple, as this is a minor issue. For many damaging nodes, running quickly through without being damaged makes sense, for example fire.
I'd lower the DPS on my fire node, not force all DPS nodes to have behaviour like that. I don't think you can not burn when running through a fire half your size anyway
Realistically it is possible to run through a 1m fire without harm.
Just realized the MTG player can't run :thinking:
I guess instead of immediately triggering damage support could be added for delaying how soon after entry you will take damage
Realistically it is possible to run through a 1m fire without harm.
True, but it's not realistic to be able to run through 1m of lava without harm. Yet I can do that very easily in Minetest :)
Good point, there may be nodes that cause extreme damage where running through should never avoid damage.
This should be optional to not break current expected behavior of no damage if the player is in the node for less than a second.
Has this been fixed?
Has this been fixed?
No, otherwise there would be a linked PR or commit and this issue would have been closed.