[Mod] Temperature and Humidity HUD [0.2] [tempidity]

Post Reply
User avatar
HeroOfTheWinds
Member
Posts: 470
Joined: Wed Apr 23, 2014 23:16
GitHub: HeroOfTheWinds
IRC: WindHero
Location: Hawaii

[Mod] Temperature and Humidity HUD [0.2] [tempidity]

by HeroOfTheWinds » Post

So, a while back there was a thread by MirceaKitsune asking for mapgenv7's temperature/humidity and weather to be added back into the core game. In that thread, Paramat said he wished that a mod would be made to show the temperature and humidity at any given point in the world... Leading to this: the tempidity mod, which creates a simple HUD display for each individual player to see the temperature and humidity where they are currently standing!

Right now, it still is in development, but it has enough basic functionality to be worth posting, and development is proceeding quickly. There is currently no set up at all on the player's end, you just have to put the mod in and enable it. It has been extensively tested with watershed and skylands, but regular mapgenv7 environments are still experimental, as they use 2D perlin noise parameters instead of the 3D noise used by the aforementioned mods.

Version 0.2 UPDATE:
  • Now compatible with 2D noise-based mgv7 (basically, default mgv7).
  • Formula for determining the display value of temperature and humidity in skylands and watershed has been reworked, temperatures now range from -35 C to +35 C. Humidity is in percentage.
  • Automatic check for installed mods and currently used mapgen.
Screenshots:
Spoiler
Image
Image
Image
License: LGPL v2.1
Download: https://github.com/HeroOfTheWinds/tempi ... master.zip (Unzip, rename to 'tempidity', and place in mods folder)
GitHub: https://github.com/HeroOfTheWinds/tempidity

Planned changes:
  • Allow display to be turned on and off, either via chat-command or by later having a thermometer item that must be in the inventory
  • See if a faster method of determining temp/humidity at a position can be developed
  • Have a more believable range of temperatures than current for 2D noisegen (71.5 degrees Celsius is not habitable!)
  • Make sure there is compatibility across all mgv7-using mods/games
Enjoy!
Last edited by HeroOfTheWinds on Wed Jun 04, 2014 21:19, edited 1 time in total.
Nam ex spatio, omnes res venire possunt.
Why let the ground limit you when you can reach for the sky?
Back to college now, yay for sophomore year schedules. :P

User avatar
paramat
Developer
Posts: 3700
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat
IRC: paramat
Location: UK

Re: [Mod] Temperature and Humidity HUD [0.1] [tempidity]

by paramat » Post

Good to see this mod, i'll try it out in watershed. This will work in watershed and skylands, but mgv7 uses 2D temp and humidity with different parameters ... mgv7 is about to be rewritten by hmmmm soon anyway. Looking at your code ... you're using hmmmm's temp and humidity scalings, which are tuned exclusively for mgv7 noise parameters where temp has 1 octave, humidity has 2 octaves. As this mod has my watershed noise params you need to (and are free too) design new scalings that make sense :)
Range of noise value depends on number of octaves and persistence:
1 octave, any persistence > variation from -1 to 1 mgv7 temp
2 octaves, persist 0.5 > -1.5 to 1.5
2 octaves, persist 0.6 > -1.6 to 1.6 mgv7 humid
3 octaves, persist 0.5 > -1.75 to 1.75 watershed

User avatar
HeroOfTheWinds
Member
Posts: 470
Joined: Wed Apr 23, 2014 23:16
GitHub: HeroOfTheWinds
IRC: WindHero
Location: Hawaii

Re: [Mod] Temperature and Humidity HUD [0.1] [tempidity]

by HeroOfTheWinds » Post

Thanks for the input, paramat. I knew something was missing, and that clears up a lot of it.
When I update it, I'll include the default 2D params that were in one of your other posts relating to mgv7, and have the mod check first for mgv7 in the mapgen parameters, and set it to the 2D noise if so. Then, I'll have it check for watershed and/or skylands, and swap the parameters to 3D if they are found... that will also entail a secondary check with skylands so as to switch between values depending on elevation (if it's at skylands level, switch to the 3D noise)

Also, thank you for the noise value table. That is something that has always been the hardest part for me to grasp when working with perlin. When you have 3 octaves marked as watershed, what aspect of it are you referring to?
Nam ex spatio, omnes res venire possunt.
Why let the ground limit you when you can reach for the sky?
Back to college now, yay for sophomore year schedules. :P

User avatar
paramat
Developer
Posts: 3700
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat
IRC: paramat
Location: UK

Re: [Mod] Temperature and Humidity HUD [0.1] [tempidity]

by paramat » Post

Yeah i should explain this ...
Generated noise value is the addition of several 'octaves'. The first octave has amplitude of 1 (outputs -1 to 1). Each additional octave is noise with a characteristic 'spread' / 'scale' half the size of the previous octave, and an amplitude that is 'persistence' x amplitude of previous octave. Each higher octave generates finer detail with a smaller amplitude, the persistence is the balance of fine detail to coarse detail.

1 octave > -1 to 1
2 octaves, persist 0.6 > output = (-1 to 1) + (-0.6 to 0.6) = -1.6 to 1.6
3 octaves, persist 0.5 > output = (-1 to 1) + (-0.5 to 0.5) + (-0.25 to 0.25) = -1.75 to 1.75

Persist:
0.33 very smooth
0.4 smooth
0.5 industry standard '1/f' noise
0.6 minetest standard
0.67 very rough / science fiction setting. In a 3D mapgen lots of overhangs and floaty stuff (used in fracture, watershed mountains)

User avatar
HeroOfTheWinds
Member
Posts: 470
Joined: Wed Apr 23, 2014 23:16
GitHub: HeroOfTheWinds
IRC: WindHero
Location: Hawaii

Re: [Mod] Temperature and Humidity HUD [0.2] [tempidity]

by HeroOfTheWinds » Post

Thank you again for the help, paramat.

Version 0.2 is now released!
Changes:
  • Now compatible with 2D noise-based mgv7 (basically, default mgv7).
  • Formula for determining the display value of temperature and humidity in skylands and watershed has been reworked, temperatures now range from -35 C to +35 C. Humidity is in percentage.
  • Automatic check for installed mods and currently used mapgen.
I've done a little testing with the default temperature by using Big Freaking Dig, but the results are still inconclusive on whether or not it is accurate. There certainly are some temperatures that are not natural though...
Nam ex spatio, omnes res venire possunt.
Why let the ground limit you when you can reach for the sky?
Back to college now, yay for sophomore year schedules. :P

User avatar
paramat
Developer
Posts: 3700
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat
IRC: paramat
Location: UK

Re: [Mod] Temperature and Humidity HUD [0.2] [tempidity]

by paramat » Post

Here's another suggestion ... the dtime function runs roughly 10 times per second, and each time you cycle through all players and do perlin noise calculations, this is unecessary procesing load to update the readout so often, i would put in a math.random (or some better method) so it updates every few seconds :)

User avatar
HeroOfTheWinds
Member
Posts: 470
Joined: Wed Apr 23, 2014 23:16
GitHub: HeroOfTheWinds
IRC: WindHero
Location: Hawaii

Re: [Mod] Temperature and Humidity HUD [0.2] [tempidity]

by HeroOfTheWinds » Post

Actually, in the first version, I had some commented-out code that would make it update only every 2 seconds. I guess it would be a good idea to add that back in. :P Until I get around to pushing a new commit with that, here's the easy way to do it:
insert "local utime = 1" before the register_globalstep() call in the code
enclose everything within the globalstep in an if block saying "if utime >= 1 then"
just before the 'end' statement of the if block, put "utime = 0"
after the end for the if block, put "utime = utime + dtime"
Nam ex spatio, omnes res venire possunt.
Why let the ground limit you when you can reach for the sky?
Back to college now, yay for sophomore year schedules. :P

User avatar
MirceaKitsune
Member
Posts: 924
Joined: Sat May 21, 2011 22:31
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune
Location: Romania, Bucharest

Re: [Mod] Temperature and Humidity HUD [0.2] [tempidity]

by MirceaKitsune » Post

Ahhh... I have been waiting for this! I was afraid I'll be left without any way to detect temperature and humidity, after the weather system has been carelessly removed (in my opinion at least).

I strongly suggest that this or another method to read temp / humidity is added to builtin! IMO this is a feature that should have its own default function, and which every mod should have easy access to.

User avatar
Krock
Developer
Posts: 4649
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker
Location: Switzerland
Contact:

Re: [Mod] Temperature and Humidity HUD [0.2] [tempidity]

by Krock » Post

Is this efficient and fast?
https://github.com/HeroOfTheWinds/tempi ... it.lua#L82
3D noises, [playercount]-times every globalstep sounds not very fast for me.
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

User avatar
HeroOfTheWinds
Member
Posts: 470
Joined: Wed Apr 23, 2014 23:16
GitHub: HeroOfTheWinds
IRC: WindHero
Location: Hawaii

Re: [Mod] Temperature and Humidity HUD [0.2] [tempidity]

by HeroOfTheWinds » Post

@Krock: Sadly, no, it is not particularly fast. Even when I set it to only update every second or two (which reminds me I still need to push those changes), it causes notable slowdown. I intend to find a more efficient method... Which leads to

@MirceaKitsune: Glad that you like the idea. There was a method built in for reading temp/humidity (mintest.get_humidity(pos)), but the wiki says the functions were removed. Still haven't tested to see if they're still coded in though... If they are, they probably would be quicker than my method.
Nam ex spatio, omnes res venire possunt.
Why let the ground limit you when you can reach for the sky?
Back to college now, yay for sophomore year schedules. :P

basil60
Member
Posts: 54
Joined: Sat Sep 12, 2015 22:07

Re: [Mod] Temperature and Humidity HUD [0.2] [tempidity]

by basil60 » Post

Does this work in Minetest 0.4.14?
It seems to throw an error

2016-07-05 11:28:52: ERROR[Main]: ServerError: Runtime error from mod 'tempidity' in callback environment_Step(): ...r\Desktop\minetest-0.4.14\bin\..\mods\tempidity\init.lua:82: attempt to index a nil value
2016-07-05 11:28:52: ERROR[Main]: stack traceback:
2016-07-05 11:28:52: ERROR[Main]: ...r\Desktop\minetest-0.4.14\bin\..\mods\tempidity\init.lua:82: in function <...r\Desktop\minetest-0.4.14\bin\..\mods\tempidity\init.lua:66>
2016-07-05 11:28:52: ERROR[Main]: ...Desktop\minetest-0.4.14\bin\..\builtin\game\register.lua:369: in function <...Desktop\minetest-0.4.14\bin\..\builtin\game\register.lua:349>

User avatar
paramat
Developer
Posts: 3700
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat
IRC: paramat
Location: UK

Re: [Mod] Temperature and Humidity HUD [0.2] [tempidity]

by paramat » Post

'register on mapgen init' is deprecated:

Code: Select all

minetest.register_on_mapgen_init(function(mgparams)
	if mgparams.mgname == "v7" then
		mg = "v7"
	end
end)
For this to work in mgv7 try:

Code: Select all

local mg_params = minetest.get_mapgen_params()
if mg_params.mgname == "v7" then
	mg = "v7"
end
However also the heat / humidity noise params at lines 93 and 97 need updating to the current defaults:
https://github.com/minetest/minetest/bl ... mple#L1086

User avatar
texmex
Member
Posts: 1753
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

Re: [Mod] Temperature and Humidity HUD [0.2] [tempidity]

by texmex » Post

I don't understand how to update this based on the instructions above. Could someone with the skillset provide a solution so that we may have this mod's functionality back?

ShadMOrdre
Member
Posts: 1118
Joined: Mon Dec 29, 2014 08:07
Location: USA

Re: [Mod] Temperature and Humidity HUD [0.2] [tempidity]

by ShadMOrdre » Post

Ive updated this mod to work with mgv5, mgv7, valleys, and carpathian. I have removed support for watershed and skylands.

DOWNLOAD: https://github.com/ShadMOrdre/lib_tempe ... master.zip
Browse Code: https://github.com/ShadMOrdre/lib_tempedity

User avatar
paramat
Developer
Posts: 3700
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat
IRC: paramat
Location: UK

Re: [Mod] Temperature and Humidity HUD [0.2] [tempidity]

by paramat » Post

I just added these APIs to MT 0.5.0dev:

Code: Select all

* `minetest.get_heat(pos)`
    * Returns the heat at the position, or `nil` on failure.
* `minetest.get_humidity(pos)`
    * Returns the humidity at the position, or `nil` on failure.
* `minetest.get_biome_data(pos)`
    * Returns a table containing:
        * `biome` the biome id of the biome at that position
        * `heat` the heat at the position
        * `humidity` the humidity at the position
    * Or returns `nil` on failure.

User avatar
v-rob
Developer
Posts: 970
Joined: Thu Mar 24, 2016 03:19
GitHub: v-rob
IRC: v-rob
Location: Right behind you.

Re: [Mod] Temperature and Humidity HUD [0.2] [tempidity]

by v-rob » Post

paramat wrote:I just added these APIs to MT 0.5.0dev:

Code: Select all

* `minetest.get_heat(pos)`
    * Returns the heat at the position, or `nil` on failure.
* `minetest.get_humidity(pos)`
    * Returns the humidity at the position, or `nil` on failure.
* `minetest.get_biome_data(pos)`
    * Returns a table containing:
        * `biome` the biome id of the biome at that position
        * `heat` the heat at the position
        * `humidity` the humidity at the position
    * Or returns `nil` on failure.
*Gasp!* Finally! I've been waiting for this for a while. Thanks paramat!
Core Developer | My Best Mods: Bridger - Slats - Stained Glass

ShadMOrdre
Member
Posts: 1118
Joined: Mon Dec 29, 2014 08:07
Location: USA

Re: [Mod] Temperature and Humidity HUD [0.2] [tempidity]

by ShadMOrdre » Post

paramat wrote:I just added these APIs to MT 0.5.0dev:

Code: Select all

* `minetest.get_heat(pos)`
    * Returns the heat at the position, or `nil` on failure.
* `minetest.get_humidity(pos)`
    * Returns the humidity at the position, or `nil` on failure.
* `minetest.get_biome_data(pos)`
    * Returns a table containing:
        * `biome` the biome id of the biome at that position
        * `heat` the heat at the position
        * `humidity` the humidity at the position
    * Or returns `nil` on failure.
Will any of this get backported to 0.4.17dev? If the answer stays no, then this mod can be used for 0.4.16 and earlier to still gain these benefits.

User avatar
paramat
Developer
Posts: 3700
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat
IRC: paramat
Location: UK

Re: [Mod] Temperature and Humidity HUD [0.2] [tempidity]

by paramat » Post

It won't be backported to 0.4.17 as it's not a bugfix.

User avatar
texmex
Member
Posts: 1753
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

Re: [Mod] Temperature and Humidity HUD [0.2] [tempidity]

by texmex » Post

Here's a 0.5 version with the same output.

Code: Select all

local function tempidity ()
  for _,player in ipairs(minetest.get_connected_players()) do
    minetest.chat_send_player(player:get_player_name(), "Heat:" ..minetest.get_heat(player:get_pos()))
    minetest.chat_send_player(player:get_player_name(), "Humidity:" ..minetest.get_humidity(player:get_pos()))
  end
  minetest.after(1, tempidity)
end

minetest.after(1, tempidity)

Skulls
Member
Posts: 108
Joined: Thu Dec 21, 2017 17:41
In-game: Skulls

Re: [Mod] Temperature and Humidity HUD [0.2] [tempidity]

by Skulls » Post

A hacky hack updated this to function with the snazzy new functions:
https://github.com/misterskullz/tempidity

And biome name has been added
Image
Attachments
Added biome name
Added biome name
tempidity_update.jpg (10.8 KiB) Viewed 1526 times

Post Reply

Who is online

Users browsing this forum: No registered users and 12 guests