Page 1 of 1

BREAKING NEWS: Knockback added!

PostPosted: Tue Aug 13, 2019 11:13
by Wuzzy
BREAKING NEWS!

Knockback has been added! Yes, yes, yesssss!

https://github.com/minetest/minetest/pull/8685

There will be 2 new functions, player:add_player_velocity and minetest.calculate_knockback.

lua_api.txt additions:
Code: Select all
    * `add_player_velocity(vel)`
    * Adds to player velocity, this happens client-side and only once.
    * Does not apply during free_move.
    * Note that since the player speed is normalized at each move step,
      increasing e.g. Y velocity beyond what would usually be achieved
      (see: physics overrides) will cause existing X/Z velocity to be reduced.
    * Example: `add_player_velocity({x=0, y=6.5, z=0})` is equivalent to
      pressing the jump key (assuming default settings)


Code: Select all
* `minetest.calculate_knockback(player, hitter, time_from_last_punch,
  tool_capabilities, dir, distance, damage)`
    * Returns the amount of knockback applied on the punched player.
    * Arguments are equivalent to `register_on_punchplayer`, except the following:
        * `distance`: distance between puncher and punched player
    * This function can be overriden by mods that wish to modify this behaviour.
    * You may want to cache and call the old function to allow multiple mods to
      change knockback behaviour.


This is huge news! Hopefully we can seriously improve how combat works in our games. I haven't tested this yet, however.

Re: BREAKING NEWS: Knockback added!

PostPosted: Tue Aug 13, 2019 13:12
by texmex
Sweet mese, that's great.

Re: BREAKING NEWS: Knockback added!

PostPosted: Tue Aug 13, 2019 13:31
by jas
I use add_player_velocity to give a boost on a particular jump
https://github.com/jastevenson303/Laval ... it.lua#L64

And get_player_velocity to eliminate fall damage avoidance
https://github.com/jastevenson303/Laval ... it.lua#L85

Thanks for Minetest!

Re: BREAKING NEWS: Knockback added!

PostPosted: Tue Aug 13, 2019 13:44
by texmex
jas wrote:I use add_player_velocity to give a boost on a particular jump


Very nice! Special moves such as dashes should be interesting too.

Re: BREAKING NEWS: Knockback added!

PostPosted: Tue Aug 13, 2019 14:22
by runs
Oh these are the additions that worth.

Re: BREAKING NEWS: Knockback added!

PostPosted: Tue Aug 13, 2019 22:53
by Red_King_Cyclops
The combat system hasn't been Minetest's best feature, so it's good to know that the development team has taken a step to improve it. When can this feature be a part of mobs mods?

Re: BREAKING NEWS: Knockback added!

PostPosted: Wed Aug 14, 2019 02:56
by jas
Add player velocity when punched by a mob, good idea.

Re: BREAKING NEWS: Knockback added!

PostPosted: Wed Aug 14, 2019 06:46
by Hume2
That's so great!

Re: BREAKING NEWS: Knockback added!

PostPosted: Wed Aug 14, 2019 14:10
by CalebJ
Great feature! +10

Re: BREAKING NEWS: Knockback added!

PostPosted: Wed Aug 14, 2019 16:13
by Pyrollo
At last :)

Many possible things: blasts, knocks, force fields, ...

Re: BREAKING NEWS: Knockback added!

PostPosted: Wed Aug 14, 2019 17:05
by Krock
Anticheat was the only (but major) issue for such a feature. Many other PRs to accelerate players on certain node types are still held back to not cause false-positives within the anticheat detection. Note that the server (yet) does not calculate player physics to confirm the data.

Side note: Don't hit other players because the lag makes it way less spectacular.

Re: BREAKING NEWS: Knockback added!

PostPosted: Wed Aug 14, 2019 20:39
by Sokomine
Buuh! I don't want to be pushed around by mobs :-) It's worse enough that some of them attack. When will they finally learn that the players will eventually always win? :) Seriously: Hope the effect isn't too strong.

Re: BREAKING NEWS: Knockback added!

PostPosted: Fri Aug 16, 2019 18:26
by Astrobe
Krock wrote:Anticheat was the only (but major) issue for such a feature. Many other PRs to accelerate players on certain node types are still held back to not cause false-positives within the anticheat detection. Note that the server (yet) does not calculate player physics to confirm the data.


Rather than acceleration, I would like to see slowdown, more specifically let the liquid_viscosity work on non-liquid nodes. I'm thinking about plant-like nodes (and tree leaves that are walkable in MTG; with that feature they could be climbable instead).

Re: BREAKING NEWS: Knockback added!

PostPosted: Fri Aug 16, 2019 22:03
by benrob0329
I feel like you could easily add a negative velocity to get that kind of effect.

Re: BREAKING NEWS: Knockback added!

PostPosted: Tue Aug 20, 2019 01:45
by PolySaken
Astrobe wrote:
Krock wrote:Anticheat was the only (but major) issue for such a feature. Many other PRs to accelerate players on certain node types are still held back to not cause false-positives within the anticheat detection. Note that the server (yet) does not calculate player physics to confirm the data.


Rather than acceleration, I would like to see slowdown, more specifically let the liquid_viscosity work on non-liquid nodes. I'm thinking about plant-like nodes (and tree leaves that are walkable in MTG; with that feature they could be climbable instead).

Why not use the player physics function?
Have an on_step function that iterates through players and sets their speed field depending on the material at their feet.

Re: BREAKING NEWS: Knockback added!

PostPosted: Tue Aug 20, 2019 09:59
by Astrobe
PolySaken wrote:
Astrobe wrote:
Krock wrote:Anticheat was the only (but major) issue for such a feature. Many other PRs to accelerate players on certain node types are still held back to not cause false-positives within the anticheat detection. Note that the server (yet) does not calculate player physics to confirm the data.


Rather than acceleration, I would like to see slowdown, more specifically let the liquid_viscosity work on non-liquid nodes. I'm thinking about plant-like nodes (and tree leaves that are walkable in MTG; with that feature they could be climbable instead).

Why not use the player physics function?
Have an on_step function that iterates through players and sets their speed field depending on the material at their feet.


True, but it is always more efficient if done by the engine. And I was hoping that maybe it was a minor modification for the engine. Additionally, it would only be a matter of overriding nodes to configure it, rather than having to use a specific API to configure the mod that offers that feature (Hmmm... actually said mod could fake it by detecting non-liquid nodes that have the liquid_viscosity property set).

Re: BREAKING NEWS: Knockback added!

PostPosted: Mon Sep 09, 2019 16:45
by FreeGamers
This was a much requested feature on the server I run. Good to see its on its way. Best wishes.

Re: BREAKING NEWS: Knockback added!

PostPosted: Sat Sep 14, 2019 03:24
by Extex
WHAT?!?!?!
When Is the next release?!?!?!
When Is 5.1.0?!?!

Re: BREAKING NEWS: Knockback added!

PostPosted: Sat Sep 14, 2019 17:26
by rubenwardy
Extex wrote:WHAT?!?!?!
When Is the next release?!?!?!
When Is 5.1.0?!?!


Feature freeze is scheduled for the 29th of September, meaning that 5.1.0 is expected for the 6th of October