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

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

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

by HeroOfTheWinds » Wed Jun 04, 2014 00:44

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


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: 3254
Joined: Sun Oct 28, 2012 00:05
Location: UK
GitHub: paramat
IRC: paramat

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

by paramat » Wed Jun 04, 2014 01:54

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
Location: Hawaii
GitHub: HeroOfTheWinds
IRC: WindHero

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

by HeroOfTheWinds » Wed Jun 04, 2014 02:23

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: 3254
Joined: Sun Oct 28, 2012 00:05
Location: UK
GitHub: paramat
IRC: paramat

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

by paramat » Wed Jun 04, 2014 02:37

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
Location: Hawaii
GitHub: HeroOfTheWinds
IRC: WindHero

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

by HeroOfTheWinds » Wed Jun 04, 2014 21:22

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: 3254
Joined: Sun Oct 28, 2012 00:05
Location: UK
GitHub: paramat
IRC: paramat

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

by paramat » Thu Jun 05, 2014 05:11

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
Location: Hawaii
GitHub: HeroOfTheWinds
IRC: WindHero

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

by HeroOfTheWinds » Thu Jun 05, 2014 19:33

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: 837
Joined: Sat May 21, 2011 22:31
Location: Romania, Bucharest
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune

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

by MirceaKitsune » Sun Jun 15, 2014 10:41

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: 4151
Joined: Thu Oct 03, 2013 07:48
Location: Switzerland
GitHub: SmallJoker

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

by Krock » Sun Jun 15, 2014 12:52

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.
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
Location: Hawaii
GitHub: HeroOfTheWinds
IRC: WindHero

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

by HeroOfTheWinds » Thu Jun 19, 2014 18:39

@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 » Tue Jul 05, 2016 01:33

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: 3254
Joined: Sun Oct 28, 2012 00:05
Location: UK
GitHub: paramat
IRC: paramat

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

by paramat » Tue Jul 05, 2016 14:26

'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/blob/master/minetest.conf.example#L1086
 

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

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

by texmex » Sun Jun 04, 2017 18:03

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: 135
Joined: Mon Dec 29, 2014 08:07
Location: USA
In-game: shadmordre

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

by ShadMOrdre » Sat Jan 20, 2018 00:13

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_tempedity/archive/master.zip
Browse Code: https://github.com/ShadMOrdre/lib_tempedity
My other virtual world is an Opensimulator.
 

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

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

by paramat » Sat Jan 20, 2018 12:27

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
Member
 
Posts: 561
Joined: Thu Mar 24, 2016 03:19
Location: Right behind you.
GitHub: v-rob

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

by v-rob » Sat Jan 20, 2018 18:23

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!
 

ShadMOrdre
Member
 
Posts: 135
Joined: Mon Dec 29, 2014 08:07
Location: USA
In-game: shadmordre

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

by ShadMOrdre » Tue Jan 23, 2018 04:14

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.
My other virtual world is an Opensimulator.
 

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

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

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

by texmex » Tue Jan 23, 2018 18:08

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)
 


Return to WIP Mods



Who is online

Users browsing this forum: texmex and 1 guest