[Mod] Sprint w. hudbars, hunger, monoids support [hbsprint]

Re: [Mod] Sprint w. hudbars, hunger, monoids support [hbspri

Postby turducken » Wed Feb 21, 2018 11:55 pm

texmex wrote:Good spotting, turducken. This relates to the the walkable check, correct. It was mainly implemented with water in mind, so that you can't sprint run in or on the water surface which you can do with the other sprint mods available. I suppose I could check for walkable or air nodes instead of just walkables.

decrease the stamina by dtime in global step, but is dtime variable, as that would throw a wrench into reducing hunger in predictable ways

I agree, stamina should be independent of dtime, with its own timer. I'll se if I can get around to it.


That was actually another thought of mine reading the code about swimming. While I don't think it should be a Jesus mod of walking on water, I think some kind of "boost" while in water would be acceptable. For example, in my worlds I'm frequently attacked by sharks. One should be able to go from a leisurely swim to SHTF mode to get to shore.

I'm obviously not sure how that would be checked as I'm new to the minetest mod api. I assume the other mods check the ground you're on, and somehow you "jump" up a node so that you're not "on" water anymore. Perhaps checking two nodes down? Perhaps a "was in water now in air" check?

Another thought I had, somewhat related, is jumping using up stamina and hunger. I know that hbhunger already takes into account placing and removing nodes, but as far as I can tell from the code it doesn't account for walking or other movement (I suppose this is best brought up in that forum.) Perhaps hbsprint should set a "stamina" or "hunger" factor as a multiplier in monoids. Regular walking, jumping uses normal hunger, while hurried running and jumping uses up more. A slow-down effect while eating my also help.

Again, how these interrelate with hbhunger I'm not sure, but they obviously need to interact (possibly though that monoids api.)
turducken
Member
 
Posts: 23
Joined: Fri Feb 02, 2018 1:43 am

Re: [Mod] Sprint w. hudbars, hunger, monoids support [hbspri

Postby texmex » Thu Feb 22, 2018 7:12 pm

turducken wrote:Perhaps checking two nodes down? Perhaps a "was in water now in air" check?

You're right, I should be able to check whether the player is attempting "Jesus walk" or if he's mortal "human being swimming".

turducken wrote:Another thought I had, somewhat related, is jumping using up stamina and hunger. I know that hbhunger already takes into account placing and removing nodes, but as far as I can tell from the code it doesn't account for walking or other movement (I suppose this is best brought up in that forum.) Perhaps hbsprint should set a "stamina" or "hunger" factor as a multiplier in monoids. Regular walking, jumping uses normal hunger, while hurried running and jumping uses up more. A slow-down effect while eating my also help.

Again, how these interrelate with hbhunger I'm not sure, but they obviously need to interact (possibly though that monoids api.)


That's a good idea: a hunger mod using monoids. Eating would immediately (or slowly) increment hunger in absolute numbers while sprinting and other physical activities would increase or decrease the multiplier. I want to write that mod!
texmex
Member
 
Posts: 1291
Joined: Mon Jul 11, 2016 9:08 pm
GitHub: tacotexmex
In-game: texmex

Re: [Mod] Sprint w. hudbars, hunger, monoids support [hbspri

Postby Byakuren » Thu Feb 22, 2018 10:03 pm

I think the values of such a monoid should add together rather than multiply, because different activities should exhaust you independently. It could still be a multiplier, but maybe the values would be the portion above 1. For example, 0.2 would mean 1.2 times hunger rate, and if you had another mod add a 0.4 multiplier, you would get a 1 + 0.2 + 0.4 = 1.6 multiplier.
Byakuren
Member
 
Posts: 816
Joined: Tue Apr 14, 2015 1:59 am
GitHub: raymoo
In-game: Raymoo + Clownpiece

Re: [Mod] Sprint w. hudbars, hunger, monoids support [hbspri

Postby turducken » Fri Feb 23, 2018 2:09 am

Byakuren wrote:I think the values of such a monoid should add together rather than multiply, because different activities should exhaust you independently. It could still be a multiplier, but maybe the values would be the portion above 1. For example, 0.2 would mean 1.2 times hunger rate, and if you had another mod add a 0.4 multiplier, you would get a 1 + 0.2 + 0.4 = 1.6 multiplier.


Perhaps. I was thinking in terms of "this potion makes you 20% faster", eg 1.2. Then you have armor that makes you 2% faster, or 1.02. 1.2*1.02=1.224.

I'm not sure the correct version. I suppose it depends on if you want to change the base rate only (additive) or whatever the current value is (multiplicative.) Perhaps there should be a setting?!
turducken
Member
 
Posts: 23
Joined: Fri Feb 02, 2018 1:43 am

Re: [Mod] Sprint w. hudbars, hunger, monoids support [hbspri

Postby Byakuren » Fri Feb 23, 2018 3:53 am

turducken wrote:
Byakuren wrote:I think the values of such a monoid should add together rather than multiply, because different activities should exhaust you independently. It could still be a multiplier, but maybe the values would be the portion above 1. For example, 0.2 would mean 1.2 times hunger rate, and if you had another mod add a 0.4 multiplier, you would get a 1 + 0.2 + 0.4 = 1.6 multiplier.


Perhaps. I was thinking in terms of "this potion makes you 20% faster", eg 1.2. Then you have armor that makes you 2% faster, or 1.02. 1.2*1.02=1.224.

I'm not sure the correct version. I suppose it depends on if you want to change the base rate only (additive) or whatever the current value is (multiplicative.) Perhaps there should be a setting?!


Sorry, I thought that you meant a monoid for how quickly saturation drains. For speed, I think player_monoids comes with a multiplicative speed monoid. In general though it's possible to combine approaches: instead of having a monoid directly change something, make it add a value to another monoid. For example, an additive speed monoid that uses its total multiplier to apply a value in the multiplicative speed monoid, which in turn actually applies the speed to a player.
Byakuren
Member
 
Posts: 816
Joined: Tue Apr 14, 2015 1:59 am
GitHub: raymoo
In-game: Raymoo + Clownpiece

Re: [Mod] Sprint w. hudbars, hunger, monoids support [hbspri

Postby texmex » Fri Feb 23, 2018 8:13 am

Yes, there's talk of monodial hunger in addition to stamina. But hunger/saturation is another mod completely and
is OT except in the sense that hbSprint could have a soft dependancy on a future monodial hunger mod.
texmex
Member
 
Posts: 1291
Joined: Mon Jul 11, 2016 9:08 pm
GitHub: tacotexmex
In-game: texmex

Re: [Mod] Sprint w. hudbars, hunger, monoids support [hbspri

Postby LMD » Thu Jun 07, 2018 5:25 pm

Created an issue : https://github.com/minetest-mods/hbsprint/issues/12
(more of an PR)
LMD
Member
 
Posts: 708
Joined: Sat Apr 08, 2017 8:16 am
GitHub: appgurueu
In-game: LMD + PRO_LMD + Limo

Re: [Mod] Sprint w. hudbars, hunger, monoids support [hbspri

Postby texmex » Thu Jun 07, 2018 7:47 pm

Though I appreciate the contribution, the solution has already been found. Use player_monoids.
texmex
Member
 
Posts: 1291
Joined: Mon Jul 11, 2016 9:08 pm
GitHub: tacotexmex
In-game: texmex

Re: [Mod] Sprint w. hudbars, hunger, monoids support [hbspri

Postby LMD » Thu Jun 07, 2018 8:20 pm

Yeah, but then you should say so explicitly. Else people wonder why their jump potion stopped working ;D
Plus, thru my solution u are independent of that mod.
LMD
Member
 
Posts: 708
Joined: Sat Apr 08, 2017 8:16 am
GitHub: appgurueu
In-game: LMD + PRO_LMD + Limo

Re: [Mod] Sprint w. hudbars, hunger, monoids support [hbspri

Postby texmex » Thu Jun 07, 2018 11:06 pm

I think I express clear support for monoids, look at the title for instance. I can’t take responsibility for mods that isn’t written with any interoperatibility in mind.

That said, here’s a potions mod that does play nice: https://github.com/tacotexmex/herbs
texmex
Member
 
Posts: 1291
Joined: Mon Jul 11, 2016 9:08 pm
GitHub: tacotexmex
In-game: texmex

Re: [Mod] Sprint w. hudbars, hunger, monoids support [hbspri

Postby LMD » Fri Jun 08, 2018 1:47 pm

Making something pretty similar ATM :)
LMD
Member
 
Posts: 708
Joined: Sat Apr 08, 2017 8:16 am
GitHub: appgurueu
In-game: LMD + PRO_LMD + Limo

Re: [Mod] Sprint w. hudbars, hunger, monoids support [hbspri

Postby texmex » Fri Jun 08, 2018 4:51 pm

LMD wrote:Making something pretty similar ATM :)

For the love of mese, WHY would you want to spend lifetime on that? There’s already two different solutions available.
texmex
Member
 
Posts: 1291
Joined: Mon Jul 11, 2016 9:08 pm
GitHub: tacotexmex
In-game: texmex

Re: [Mod] Sprint w. hudbars, hunger, monoids support [hbspri

Postby LMD » Fri Jun 08, 2018 5:40 pm

Umm, well, mine adds statbars 4 how long the player still posesses it. Also I have my custom API, so I can easily register a - physics effect potion (antigravity, jump etc) - normal potion (effect, delete effect function) using a color. It is for our new magic CTF. Potions have tiers (yellow stripes on image) which show potion strength, and levels (grey stripes) = duration. It will be nice, I hope :)
LMD
Member
 
Posts: 708
Joined: Sat Apr 08, 2017 8:16 am
GitHub: appgurueu
In-game: LMD + PRO_LMD + Limo

Re: [Mod] Sprint w. hudbars, hunger, monoids support [hbspri

Postby texmex » Sat Jun 09, 2018 3:55 am

LMD wrote:Umm, well, mine adds statbars 4 how long the player still posesses it. Also I have my custom API, so I can easily register a - physics effect potion (antigravity, jump etc) - normal potion (effect, delete effect function) using a color. It is for our new magic CTF. Potions have tiers (yellow stripes on image) which show potion strength, and levels (grey stripes) = duration. It will be nice, I hope :)

That sounds nice, though more of an alternative to playereffects, not this.
texmex
Member
 
Posts: 1291
Joined: Mon Jul 11, 2016 9:08 pm
GitHub: tacotexmex
In-game: texmex

Re: [Mod] Sprint w. hudbars, hunger, monoids support [hbspri

Postby Byakuren » Sun Jun 10, 2018 3:39 am

LMD wrote:Umm, well, mine adds statbars 4 how long the player still posesses it. Also I have my custom API, so I can easily register a - physics effect potion (antigravity, jump etc) - normal potion (effect, delete effect function) using a color. It is for our new magic CTF. Potions have tiers (yellow stripes on image) which show potion strength, and levels (grey stripes) = duration. It will be nice, I hope :)

You could keep your custom effect code, but use monoids to actually apply the final physics effects to players. Then you can have your more complex system and still have compatibility with player_monoids-compatible mods.
Byakuren
Member
 
Posts: 816
Joined: Tue Apr 14, 2015 1:59 am
GitHub: raymoo
In-game: Raymoo + Clownpiece

Re: [Mod] Sprint w. hudbars, hunger, monoids support [hbspri

Postby LMD » Sun Jun 10, 2018 10:28 am

player_monoids may be useful, but it REALLY isn't THAT HARD to just modify player physics yourself. I prefer to change 10 lines of code without needing another dependency.
LMD
Member
 
Posts: 708
Joined: Sat Apr 08, 2017 8:16 am
GitHub: appgurueu
In-game: LMD + PRO_LMD + Limo

Re: [Mod] Sprint w. hudbars, hunger, monoids support [hbspri

Postby Byakuren » Tue Jun 12, 2018 4:10 pm

LMD wrote:player_monoids may be useful, but it REALLY isn't THAT HARD to just modify player physics yourself. I prefer to change 10 lines of code without needing another dependency.

First, note that you can just have a soft dependency and fall back to your current way if player_monoids is not installed. It would be easy to swap between the two implementations if you make function definitions for "apply effect" and "cancel effect" that are dependent on whether player_monoids is around.

If you are talking about multiplying by a modifier and then dividing by it, that doesn't work when you want to use a multiplier of 0 to stop player movement / jumping (I responded to this in the github issue that was linked earlier).

It also doesn't work if you want to mix multiplication and addition. For example:
- Player starts at 1 speed
- Mod A applies an effect that adds 0.2 speed. The player now has 1.2 speed.
- Mod B applies an effect that doubles speed. The player now has 2.4 speed.
- Mod A's effect wears off. The player now has 2.2 speed (because mod A "undid" the effect by subtracting 0.2)
- Mod B's effect wears off. The player now has 1.1 speed (because mod B "undid" the effect by dividing by 2)

The player ends up having a non-1 neutral speed.

Lastly, rounding errors in floating point arithmetic will cause the player physics override to drift slowly. This is not likely to be a problem in practice but does feel unclean.

player_monoids handles the first issue by explicitly keeping track of the list of active player physics modifiers, so that information isn't lost when using a multiplier of 0. It also avoids drift from floating point rounding because it does not use the player physics override like an accumulator value.

It handles the second issue by making it possible for mods to combine effects in their own way before applying them through player_monoids. So for example, a mod that wants to subtract / add speed modifiers could set up its own monoid (or some other way of combining effects), and then use that final value as input to the player_monoids-provided speed monoid.

Just doing / undoing with multiplication and division is fine and coherent if you don't want to stop movement, use addition / subtraction, or be compatible with any mods that want to do those two things, but it is not a universal solution.
Byakuren
Member
 
Posts: 816
Joined: Tue Apr 14, 2015 1:59 am
GitHub: raymoo
In-game: Raymoo + Clownpiece

Re: [Mod] Sprint w. hudbars, hunger, monoids support [hbspri

Postby LMD » Sun Jun 17, 2018 12:41 pm

You are right.
However, as I'm doing it for a subgame, it isnt really required to work with other mods.
LMD
Member
 
Posts: 708
Joined: Sat Apr 08, 2017 8:16 am
GitHub: appgurueu
In-game: LMD + PRO_LMD + Limo

Re: [Mod] Sprint w. hudbars, hunger, monoids support [hbspri

Postby Byakuren » Sun Jun 17, 2018 6:05 pm

LMD wrote:You are right.
However, as I'm doing it for a subgame, it isnt really required to work with other mods.

Fair enough.
Byakuren
Member
 
Posts: 816
Joined: Tue Apr 14, 2015 1:59 am
GitHub: raymoo
In-game: Raymoo + Clownpiece

Re: [Mod] Sprint w. hudbars, hunger, monoids support [hbspri

Postby Wuzzy » Thu Apr 04, 2019 10:51 am

FYI:
This mod needs updating for [hudbars] 2.0.0 and Minetest 5.0.0.
Wuzzy
Member
 
Posts: 3428
Joined: Mon Sep 24, 2012 3:01 pm
GitHub: Wuzzy2
In-game: Wuzzy

Re: [Mod] Sprint w. hudbars, hunger, monoids support [hbspri

Postby runs » Thu Apr 04, 2019 11:48 am

Wuzzy wrote:FYI:
This mod needs updating for [hudbars] 2.0.0 and Minetest 5.0.0.

I use it and no problem.
runs
Member
 
Posts: 361
Joined: Sat Oct 27, 2018 8:32 am
GitHub: runsy

Re: [Mod] Sprint w. hudbars, hunger, monoids support [hbspri

Postby texmex » Thu Apr 04, 2019 4:27 pm

I’m going to check on it regardless.
texmex
Member
 
Posts: 1291
Joined: Mon Jul 11, 2016 9:08 pm
GitHub: tacotexmex
In-game: texmex

Re: [Mod] Sprint w. hudbars, hunger, monoids support [hbspri

Postby texmex » Sat Apr 13, 2019 7:13 pm

I didn't have to update the mod regarding hudbars support (screw translations for now!) but I did discover a bug, solved it and pushed it.
texmex
Member
 
Posts: 1291
Joined: Mon Jul 11, 2016 9:08 pm
GitHub: tacotexmex
In-game: texmex



Return to WIP Mods



Who is online

Users browsing this forum: Bing Bot [Bot] and 0 guests