Page 1 of 1

[Mod] Mana [1.2.0] [mana]

PostPosted: Thu Feb 05, 2015 15:31
by Wuzzy
This mod provides a simple API for mana. And some simple HUD elements. This mod does not provide any actual gameplay on its own.

Mana is intended to be a secondary player attribute. In many RPGs mana is used as a resource for magical items or spells. Each time you use one of those, this reduces your mana reserves until you hit 0 eventually, at which point you cannot use these magical items anymore; you have to recharge your mana level somehow then.
In Minetest, it could be used for all kinds of special items and tools and what else you may think of.
Mana could also be used as a lazy measure to limit the uses of special items without destroying them, so the items do not neccessarily have to be magical.
That's the basic idea behind mana.

By default, all players start with 0/200 mana, and will regenerate 1 mana each fifth of a second. Note that the regeneration rate is the same for all players and can only be changed globally.
The values can be changed on a per-player basis with an API, the mod also recognizes a few server settings.

Here is a screenshot showing a HUD bar for the mana, using the optional dependency on HUD bars mod:
Image

Current API features:
  • Add and subtract mana from a player
  • Set/get the current and maximum mana of a player
  • Set/get the amount of mana regeneration of a player

Also, this mod is configurable with server settings (minetest.conf):
  • mana_default_max: Initial maximum mana for new players (default: 200)
  • mana_default_regen: The initial amount of mana a new player will generate (default: 1)
  • mana_regen_timer: Time in seconds all (!) players will generate mana (default: 0.2)

And that's basically it for now. The functions make sure the mana will never go out of bound, so the current mana is not allowed to be smaller than 0 or larger than the player's maximum.
Also, the maximum must not be smaller than 0 as well.

Version: 1.2.0 (This mod uses semantic versioning, as of 2.0.0 of the standard)
License of mana icon: CC-BY 3.0 by Buch.
License of everything else: WTFPL
Project page (Git): http://repo.or.cz/w/minetest_mana.git

Optional dependencies:

No mandatory dependencies.

Mods using this mod:

Re: [Mod] Mana [0.1.0] [mana]

PostPosted: Thu Feb 05, 2015 16:26
by Minetestforfun
Wow, very good idea and work, i hope it will be used on many mods, thank you ! :)

Re: [Mod] Mana [0.1.0] [mana]

PostPosted: Thu Feb 05, 2015 16:29
by TG-MyinaWD
Sounds cool. I hope I can find a great use for it in my mods. I might can make it need mana to craft something. if can export it from players and use in crafting.

I will look into can do. but looks great so far.

Re: [Mod] Mana [0.1.0] [mana]

PostPosted: Fri Feb 06, 2015 09:56
by Krock
I hope there will be mods using Mana. It has potential for a new type of gameplay!

EDIT: I would like to see your mods on GitHub :)

Release 0.2.0

PostPosted: Sun Feb 08, 2015 03:35
by Wuzzy
I just released version 0.2.0 of this mod!

I have added the API documentation, and it is surprisingly short. It really just boils down to setter and getter functions, and addition and subtraction.
I have tweaked the adder and subtractor functions a bit. Now you can decide whether you allow “excess” amount (over the maximum or below 0) or if you want to abort the whole operation if a limit would be exceeded.

I.e. if player X has 40/50 mana and you want to add 20, you can either call mana.add, in which call the addition will fail and no mana will be added, or you can call mana.add_up_to, in which case 10 mana will be added (capped at 50), plus the function reports how much excess mana you had (in this case 10, obviously).
It is similar for subtraction.
I hope this little tweak makes using the API a bit more flexible to use.

*Probably* there is not much else in the way for a 1.0.0 release already, if you have ideas for new functions, please let me know. I will probably add the one or other convenience function.
But I want to have at least one real world example before I release 1.0.0, to be sure everything works fine.

@Krock:
I will not put this on GitHub, but I will put this on repo.or.cz whenever I feel like it, but certainly at the release of 1.0.0.

In the meanwhile, the Zip archive also contains the .git folder and thus the entire Git repository. ;-)

I now use Git for most of my mods and upload them to repo.or.cz, but I don't use Git at all for very simple mods like Galaxy Skybox.

Re: [Mod] Mana [0.2.0] [mana]

PostPosted: Sun Feb 08, 2015 09:50
by TenPlus1
Great concept... Killing mobs could drop mana items, or even using special weapons or staffs could use mana to operate... so much potantial...

Version 0.3.0 released!

PostPosted: Tue Feb 10, 2015 01:54
by Wuzzy
Version 0.3.0 released!

This version has been made for compability with the HUD bars mod 0.3.0. It is currently only compatible with this version, unless you decide to not install and activate HUD bars.
That's all, bye!

Edit: Version 0.4.0 of the HUD bars mod has been released. Mana 0.3.0 is also compatible with 0.4.0 of the HUD bars mod now.

Edit: Same for 1.0.0.

Version 0.4.0 released!

PostPosted: Sat Feb 14, 2015 06:26
by Wuzzy
Version 0.4.0 is released!
This version works with major version 1 of the HUD bars mod. Versions 0.3.0 and 0.4.0 are probably OK, too, but not supported.

Changelog:
  • Mana now is regenerated by players
  • By default, new players start with 0/200 mana and will regenerate 1 mana each fifth of a second
  • The mod recognizes now three minetest.conf settings / server settings, for configuring regeneration rate, default regeneration amount for new players and max. mana for new players
  • New API functions for regeneration: mana.getregen and mana.setregen

Regeneration can be easily disabled by setting the regeneration amount to 0. I added the support for minetest.conf settings mainly for subgame developers and server operators. This way, you have to change not a single file within the mana mod, only your minetest.conf to configure this mod. :-)

See also the first post, it is a bit more detailed on that. The README.txt file is the most detailed info.

I also uploaded the Git repository here:
http://repo.or.cz/w/minetest_mana.git

I also have decided which direction this mod will go: I will stay with mana only, so the aim is now not a generic mod to add generic attributes, etc.

Edit: I have released the first mod using the Mana mod: Mirror of Returning

Version 1.0.0 released!

PostPosted: Fri Feb 20, 2015 14:56
by Wuzzy
Version 1.0.0 is released today!

I consider the API finished and stable, it should now be safe to use by other mods.

Changelog:
  • All input values will first be rounded before they are used. This ensures the mana mod only stores integer numbers for mana, so you can't have 2.342 mana, etc.
  • Add brief “general recommendations” section into API.md
  • A bit of refactoring

The following mods are currently using this mod and are compatible with major version 1 of this mana mod:

Have fun!

Re: [Mod] Mana [1.0.0] [mana]

PostPosted: Sat Feb 21, 2015 03:26
by philipbenr
Looks good Wuzzy.

Re: [Mod] Mana [1.0.1] [mana]

PostPosted: Sun Feb 22, 2015 17:26
by Wuzzy
Quick bugfix release 1.0.1:

The mana regeneration did not work well on slow servers, it was far slower than it should be. Now the mana regeneration is more stable so that it even works properly on slow servers, but the granularity of mana updates is still increased on slow servers.
If you have a slow server, consider increasing the mana tick (and, if desired, scale the default mana regeneration amount inversely proportional).

1.0.2

PostPosted: Wed Apr 01, 2015 07:40
by Wuzzy
New version 1.0.2 released.

This fixes the following bugs found by Jordach (thanks!):
  • The server crashed when a player left on a multiplayer server and HUD Bars mod was active, too
  • The player's mana values were reset to the default values when a player rejoined on a server

Re: [Mod] Mana [1.0.2] [mana]

PostPosted: Wed Apr 01, 2015 14:35
by Don
Just a thought. What about a mana container or bottle that can store mana. That way people can go collect mana and store it. Then if their mana is low they can refill it similar to eating.

Re: [Mod] Mana [1.0.2] [mana]

PostPosted: Wed Apr 01, 2015 20:45
by Ben
Nice mod! My first thought was "hey, what if mana regeneration only worked in sunlight?" This would add some importance to the time of day, and make spelunking more of a challenge.

Since the regen value is settable by player, one could easily write another mod that takes care of the regeneration rate. In fact, I think I'll try my hand at it myself ;-)

Two questions about some design decisions, though:

First, all values are stored and calculated as integers. What prompted this? I think you lose a lot of tunability and precision that way. You could always round the values just before output (HUD bars / text), if that was the reason.

Second, I see that negative regen values are not allowed. One idea would be to have biomes / blocks / mobs with a "mana sapping" effect, by setting a negative value.

Re: [Mod] Mana [1.0.2] [mana]

PostPosted: Thu Apr 02, 2015 22:45
by Minetestforfun
Hi,

Because of your versionning system based on repo.or.cz, I post this here.

It's a modified and "improved" version of your mod, contains :
- Some crashfixs
- Add hud compatibility / support (with many different textures for potions, you can see alternative textures and xcf with calcs potions in the second folder)
- be carful, in our modified version, every 10 seconds the mana is increased by 10
- be carful, we don't have yet merged your latest improve wich save the mana if deconnection/reconnection
- Add a sound for the returnmirror teleportation (but we need to improve it...)
- One potion = 20 mana, they are 10 potions, so 10*20 = 200, and avery ten second, one half potion is filled

That's all, i think, Great mod Wuzzy, i hope it will help you :)

PS : license WTFPL for all

Re: [Mod] Mana [1.0.2] [mana]

PostPosted: Fri Apr 03, 2015 17:11
by Wuzzy
@Minetestforfun: First of all, my versioning is not based on repo.or.cz. My versioning system is Semantig Versioning 2.0.0, documented at http://www.semver.org.
Also, if you want to fork this mod, remember that the versioning of the new mod is now independent from the other mod. You could continue to use Semantic Versioning in that fork, but you could also choose to abandon Semantic Versioning for another versioning system for whatever reason.

You already changed a lot.

I do not want to apply these changes into this mod all at once. If you want to contribute, fork my repository and use Git and publish the repository somewhere (it does not matter much where). Alternatively, you could send me a patch file (if you know what this is).
I want to have a clean Git history. I don't want to have a super-commit like “Some random changes from Minetestforfun, I don't know exactly what has changes”. ;-)
My rule of thumb is: One change per commit.

Also, I will not add mana potions into this mod because I want to keep this mostly an API mod. However, I think it would be perfectly possible to implement mana potions in a seperate mod. I am to lazy to do it myselves, so you are on your own.

As for the crash fixes: Please tell me of which crashes you are talking about (in other words: report the bug). If you have a fix, that's great, but please post one patch/commit per bugfix.

I don't know what you mean with “sound for returnmirror teleportation”. It already has a sound, so what's the point? This is also off-topic, why don't you post in the returnmirror thread?

Re: [Mod] Mana [1.0.2] [mana]

PostPosted: Sat Apr 04, 2015 20:19
by Ben
Ben wrote:Since the regen value is settable by player, one could easily write another mod that takes care of the regeneration rate. In fact, I think I'll try my hand at it myself ;-)


And I just did: Solar Mana. I wouldn't count it as a mod that "uses the mana mod", though :-P

Re: [Mod] Mana [1.0.2] [mana]

PostPosted: Thu Apr 30, 2015 21:00
by TeTpaAka
I just noticed that your fall back functions don't work properly. Instead of updating the displayed text, you update "number", which is the colour for a text HUD. So, instead of slowly increasing numbers, the colour of the HUD string changes.

Re: [Mod] Mana [1.1.0] [mana]

PostPosted: Mon May 25, 2015 21:08
by Wuzzy
I have released Mana version 1.1.0!

Changelog:
  • Regeneration can be negative now. This means, players lose mana over time.
  • Regeneration can also be a floating-point number. A number between 0 and 1 simply means that it takes longer than 1 mana tick (default: 0.2 s) to regenerate 1 mana. For instance, if mana regeneration is 0.5, it takes 2 mana ticks to regenerate 1 mana. (Note: The player's mana values are still strictly whole numbers, it is only the regeneration which has changed).
  • Update for the new HUD bars version 1.2.0 or later: Statbar background image added. This is only interesting if you use HUD bars with the “modern statbars” style. Otherwise, this has no effect.
  • I finally fixed the fallback text bug reported by TeTpaAka.

Version 1.2.0

PostPosted: Sat Nov 12, 2016 19:40
by Wuzzy
I have release Mana version 1.2.0. This is a rather small update only.

Changelog:
  • Add intllib support
  • Add German translation
  • Update/fix readme file
  • Clean up / refactor code (undeclared globals, etc.)