[Mod]Smoke [WIP]

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

Re: [Mod]Smoke [WIP]

by texmex » Tue Sep 17, 2019 18:04

I think there need to be alot of smoke for the node timer approach to start to lose its effeciency.
 

Astrobe
Member
 
Posts: 239
Joined: Sun Apr 01, 2018 10:46

Re: [Mod]Smoke [WIP]

by Astrobe » Tue Sep 17, 2019 18:14

Version 0.2 is out:
  • Merged Texmex' animated smoke texture. This is not related, but I discovered visual glitches when the smoke is next to a liquid which is due to transparency (the docs are very clear about the fact that it may occur), so I disabled transparency by default. At least Texmex' animation compensate for that loss.
  • Added a "smog", a type of smoke that spreads horizontally first. Nothing produces this type of smoke currently. Also, I'm not too interested in it currently, so I've not tested it much.
  • Split the source into a library part that implement the smokes behavior and its application that adds smoke to nodes in the "smokey" group. It also puts a couple of likely smoke sources (furnaces, lava, fire) in this group. I didn't go as far as putting each in a separate file, I didn't see the point of it.

Next, I'm considering turning the mod's parameters into proper settings. I'm not decided yet, cause as a game maker settings have been of very little use to me. I prefer to edit manually the source files because the settings are saved outside of the game source tree (therefore I doubt they are even per-game). There's mod_storage... But then you lose the UI.
 

BuckarooBanzay
Member
 
Posts: 307
Joined: Tue Apr 24, 2018 05:58
Location: Switzerland
GitHub: thomasrudin-mt
In-game: BuckarooBanzai

Re: [Mod]Smoke [WIP]

by BuckarooBanzay » Tue Sep 17, 2019 18:26

I tested that with commit 238a2548a1b834a9db04a5ee8ef4aac51284b246 (https://gitlab.com/Astrobe/minetest-smo ... c51284b246)

The "factory":

Image
Image
Image

The results:
Image
Link: https://monitoring.minetest.land/d/YUpo ... 8744390708

Looks good: with something over 100 furnaces and around 500 smoke nodes only 15 milliseconds are needed for the nodetimers, at most..

Good job :)
 

Astrobe
Member
 
Posts: 239
Joined: Sun Apr 01, 2018 10:46

Re: [Mod]Smoke [WIP]

by Astrobe » Tue Sep 17, 2019 19:32

Thank you! I checked performances only with the task manager, so it's nice to see actual figures.

I didn't mention that we lost with this update the occasional "collisions" that make some nodes deviate from the straight upwards route. One could tweak the parameters to make it happen again but it would only work near the source. I'll try to do something about it. This is tricky to do because you don't want to take smoke in the face near your furnaces too often.
 

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

Re: [Mod]Smoke [WIP]

by texmex » Tue Sep 17, 2019 20:42

That doesn't look healthy at all but sure looks beautiful, BuckarooBanzay. Looks like the node timer approach was good for it still.

I'll be sure to check out the smog smoke type eventually!
 

micheal65536
Member
 
Posts: 139
Joined: Mon May 22, 2017 20:27

Re: [Mod]Smoke [WIP]

by micheal65536 » Wed Sep 18, 2019 20:15

Astrobe wrote:
micheal65536 wrote:
Astrobe wrote:The source ABM is innocent, the CPU activity mainly varies with the number of smoke nodes (timers only).

I haven't done any particular testing on this but this has been my anecdotal experience, anyway. It might be worth trying your mod with ABMs rather than node timers and doing a comparison to see which method is actually faster.


Maybe I'll try this, but one drawback I immediately see is that all smoke nodes will be updated at once (similar to what I had prior the introduction of update jitters), causing "spikes" of activity.

Discussions regarding efficiency aside, you could possibly solve this problem by introducing a random chance in the ABM. That way, only some nodes get updated each time.

So for example if you want each smoke node to move on average once every 20 seconds, you could set the ABM interval to 10 seconds and the chance to 0.5 (2) for some variation/randomisation, or you could set the interval to 5 seconds and the chance to 0.25 (4) for even more variation. Basically, decide how many separate "groups" of updates you want (except that they aren't groups, because each node individually has a chance of updating on any cycle), set this as the "chance" parameter for the ABM, then take your desired average update interval and divide it by this number and set this as the interval.

One drawback is that this could cause smoke to move somewhat erratically, like it'll move quickly for a bit and then sit still for a while rather than moving at a near-constant rate, particularly with higher chance settings. I'm not sure what sort of aesthetic you're aiming for so I'm not sure how much of a problem this would be or if you could work around it (perhaps by defining multiple smoke nodes: a "fast" one, a "medium" one, and a "slow" one that move it different speeds?).

Personally, if you're experiencing performance issues, I'd be inclined to try changing node timers for ABMs and see if the performance improves and if you can still achieve the aesthetic that you want.
 

Astrobe
Member
 
Posts: 239
Joined: Sun Apr 01, 2018 10:46

Re: [Mod]Smoke [WIP]

by Astrobe » Fri Oct 18, 2019 12:30

Version 0.3:

- introduces a WIND parameter that make smoke blocks randomly move laterally on occasions.
This parameter should not be set too high, otherwise it could be a nuisance near furnaces. Contrary to what the parameter name suggests, there's actually no preferred direction.

- The lifespan of the smoke nodes depends on altitude.
This feature was introduced mainly to avoid having "dead" smoke blocks in the sky near the active_block_range boundary (timers and ABMs are frozen outside of this range). These blocks are not actually dead, they'll move again if a player comes close enough from them.

The feature has the pro or cons that it makes the lifespan of smoke underground longer. This could turn deep underground lava lakes into fearsome smoke generators. I did not yet test this in a real scenario. It could make access to lava lakes an interesting "ventilation engineering" challenge, or make lava lakes in narrow caves inaccessible.
 

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

Re: [Mod]Smoke [WIP]

by texmex » Fri Oct 18, 2019 13:46

Nice additions, especially the wind. There’s another mod also dealibg with wind now, Sailing Kit. Ideal would be to have them pull wind data from the same source. =)
 

Termos
Member
 
Posts: 236
Joined: Sun Dec 16, 2018 12:50

Re: [Mod]Smoke [WIP]

by Termos » Fri Oct 18, 2019 14:22

texmex wrote:Nice additions, especially the wind. There’s another mod also dealibg with wind now, Sailing Kit. Ideal would be to have them pull wind data from the same source. =)

Definitely, with that in mind there's a separate entry point for that in sailing_kit, the function get_wind(). It can be overriden to take wind data from any source, as long as it returns a single vector with length scaled to meters per second.
 

Grubler
New member
 
Posts: 4
Joined: Wed Nov 06, 2019 03:01
In-game: Grubler

Re: [Mod]Smoke [WIP]

by Grubler » Wed Nov 06, 2019 03:04

Would it be possible to make it so torches also make smoke?

Also while being held?
 

User avatar
Diamond knight
Member
 
Posts: 460
Joined: Sun Apr 19, 2015 19:50
Location: Chilling in Constantinople
GitHub: Diamondknight
In-game: Ferrumprinceps

Re: [Mod]Smoke [WIP]

by Diamond knight » Sun Nov 10, 2019 05:50

This could possibly work well for the gas attacks in my abandoned WW1 warfare mod.
 

Astrobe
Member
 
Posts: 239
Joined: Sun Apr 01, 2018 10:46

Re: [Mod]Smoke [WIP]

by Astrobe » Wed Nov 13, 2019 18:04

Grubler wrote:Would it be possible to make it so torches also make smoke?

Also while being held?


The second request is difficult to do, because one has to place the smoke node above the torch which is not aligned with a node when held by a character; placement would have to be computed smartly so that the node is not placed "in the face" of the character yet "near enough" the torch.

The first request is much easier to do. I did not include torches as smoke the generators because the smoke node is a bit disproportionate compared to the torch and it is probably too inconvenient.

There's a simple way to do it, add "default:torch" in the list near the bottom of init.lua (e.g. next to "default:lava_source").

However I suspect you will want to adjust the smoke generation rate. So instead, copy this code at the end of init.lua:

Code: Select all
   
minetest.register_abm{
      label="Smoke",
      nodenames= {"default:torch"},
      neighbors={"air"},
      interval=7,
      chance=1,
      action=function(pos)
         local p=minetest.find_node_near(pos, 1, "air")
         if p then smoke.add(p) end
      end
   }


I didn't test it, but it should work as expected (famous last words).

Adjust "interval" to your liking - it tells Minetest to generate a smoke node every N seconds (here: 7). Alternatively you can adjust the "chance" property (e.g. if you change it to 2, there will be 50% chance to generate smoke every 7 seconds).

Also please note that if you are using fancy torch mods, you might have to change the "nodenames" property to fit the internal name of the fancy torch introduced by the mod.
 

Previous

Return to WIP Mods



Who is online

Users browsing this forum: Google [Bot] and 7 guests