[Mod]Smoke [WIP]

User avatar
FreeGamers
Member
Posts: 650
Joined: Sat May 25, 2019 00:15
GitHub: is proprietary I use NotABug
Location: United States
Contact:

Re: [Mod]Smoke [WIP]

by FreeGamers » Post

Exactly. I use the nether and magma_conduits mods in my game which tends to spawn more lava than is typical in default minetest_game I would imagine. That is likely a part of this. I would love to add it back in the game once this is worked out. It does indeed add a fun natural hazard to the game.
FreeGamers.org has moved to MeseCraft.net | FreeGamers on this forum is now MeseCraft

FaceDeer
Member
Posts: 506
Joined: Sat Aug 29, 2015 19:01
GitHub: FaceDeer

Re: [Mod]Smoke [WIP]

by FaceDeer » Post

Oh, Astrobe, I don't have a Gitlab account so I figured I'd drop a quick typo correction here and also show something I just tried out locally and think looks nice.

The node definition for smoke:block has the property "amage_per_second = SMOKE_DPS", missing the "d".

And I tried replacing the glasslike drawtype for the smoke block with this:

Code: Select all

	drawtype = "nodebox",
	node_box = {
        type = "fixed",
        fixed = {{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}, {-0.625, -0.25, -0.625, 0.625, 0.25, 0.625}},
    },
And got what I believe the technical term for is "hamburger clouds":
Spoiler
Image
It adds rather a lot of "puffiness" to the smoke, IMO, with very little cost. If you wanted to get fancier you could make the hamburger clouds asymmetrical and then randomize the param2 every time a smoke node moves, that'd make the smoke look even more organic. This might not work with transparent textures but seems okay with the opaque one currently in use.

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

Re: [Mod]Smoke [WIP]

by Astrobe » Post

Thanks FaceDeer for the report (*) and for the great suggestion.

I went further and implemented the rotation and asymmetrical idea (by "lifting" up the center ring of your model), but it seems less good to me. Applying a random rotation on your model works great already.

I am play-testing it a bit more, it should be pushed on the repo this weekend.

(*) Sorry if you wasted time figuring it out.

FaceDeer
Member
Posts: 506
Joined: Sat Aug 29, 2015 19:01
GitHub: FaceDeer

Re: [Mod]Smoke [WIP]

by FaceDeer » Post

I actually just noticed the missing "d" in passing while I was putting that nodebox in there, I was playing around with this on a local server without damage enabled. :)

What I was thinking with the asymmetrical nodebox was to have the center ring bulge out a bit farther on the +X and +Z axis (but not -X and -Z) and then rotate it randomly around the Y axis each time. That way a column of smoke would look less like a big ladder, it'd be sort of "wiggly".

I've done a similar rotate-randomly-around-the-Y-axis trick to make the stalactites and stalagmites in DFCaverns appear less regular, the nodebox is a bit displaced away from the center point so rotating it makes it look a little bit displaced from center in a random direction.

Edit: Oh! Another idea for an enhancement just came to mind. The ABM currently doesn't care what the value of the "smokey" group is on a node, it's just a binary has-it/doesn't-have-it indicator. How about making the ABM check the value of the smokey group and then randomize the odds of generating smoke each time as a 1/groupvalue chance? That way a thing that's supposed to smoke a lot would be "smokey = 1", but a thing that's supposed to only emit a puff every once in a while could be "smokey = 4" or something. That way maybe smokey can be added back to nodes that are very common, such as lava in some mapgens, without flooding the place with smoke and lagging the server.

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

Re: [Mod]Smoke [WIP]

by Astrobe » Post

Yet another excellent suggestion!

New version 0.5 has landed in the repo (cf. first post):
  • new smoke node model, based on FaceDeer's, with both parts assymetric
  • the model randomly rotates when it moves
  • on the application part, the new function smoke.add_source let the user set the smoke regeneration rate by node type
  • moved the update jitters from creation time to move time. It seems to me that nodes tend to "sync" when leaving/coming back to the area. This makes sure they are "desync'ed"
As those changes are a bit experimental, they only apply to smoke, not fog, for now.

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

Re: [Mod]Smoke [WIP]

by Astrobe » Post


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

Re: [Mod]Smoke [WIP]

by Astrobe » Post

Following the discussion here and on Reddit, I have removed the altitude effect on smoke persistence. This means that smoke will not persist longer in caves, mainly. Version 0.6 is available in the repo.

I figured out that this feature was not entirely solving the problem it was intended to solve and created problems elsewhere. Rather than going for more complicated calculations, I chose to remove the effect entirely, also making the process a tiny little bit faster.

I also decreased one notch the default Persist value to help with the original issue, which is that smoke nodes could appear "dead" if they live the "player activation bubble" (the space around each player where ABMs and timers are active). They are not actually dead, they'll start to move again when a player gets close enough.

In my game this is more of a problem because players are very mobile, including vertically (one can "jump" on the top of a tree quite easily). It is probably less of an issue in games with normal mobility.

Decreasing the Persist parameter to a value so that the average height of a smoke column (see my earlier post about probabilities) is around half the value of the active block range (a game setting) should make the issue less likely to happen. The new model helps a bit too, because distant smoke looks a bit less like stone now.

FaceDeer
Member
Posts: 506
Joined: Sat Aug 29, 2015 19:01
GitHub: FaceDeer

Re: [Mod]Smoke [WIP]

by FaceDeer » Post

Nice. Lava caverns are still very smokey, but they don't just instantly fill with smoke in a solid block any more - you can still see through them, to some extent.

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

Re: [Mod]Smoke [WIP]

by Astrobe » Post

I came up with a new shape for the smoke nodes. I think I 've been using it for months, I am finally pushing it today. The original shape has been commented out, test and switch back easily if you don't like it.

There are also to minor changes:
- the "persist" value has been slightly decreased,
- lava sources generate smoke instead of flowing lava.

Grubler
Member
Posts: 98
Joined: Wed Nov 06, 2019 03:01
In-game: Grubler

Re: [Mod]Smoke [WIP]

by Grubler » Post

This mod is sick, yo. Why isn't it on the DB thing so it can be downloaded straight from the game? I would love if I could make a torch make smoke too, you know? I saw it was already considered. I try to use the "realistic torches" thing so mine can burn out. If I could have other light sources that wouldn't make smoke or just have to deal with it, like making a chimney so my house wouldn't fill up with smoke, then that would be sick... One of the dreams I had for when I was first trying out Minecraft and stuff. Torches that burned out and made smoke.. Just wanted to .. show my appreciation, I guess..

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

Re: [Mod]Smoke [WIP]

by Astrobe » Post

Hi, thanks for your kind words.

The truth is, I am too lazy to make the extra step to ContentDB and to do long-term maintenance.

I also think it is less a mod than a library - it has to be tweaked and adapted to the game it is inserted into.

If anyone wants to do it, the license should allow it and I would have no objection.

Grubler
Member
Posts: 98
Joined: Wed Nov 06, 2019 03:01
In-game: Grubler

Re: [Mod]Smoke [WIP]

by Grubler » Post

It seems pretty easy to tweak. Especially since you sort of provided some stuff in the script that people could use, maybe, and pointed it out.
Since I know a little about how scripts work, I figured out how to add it to torches as well.
Still trying to learn how to do more with scripts, but.. The only time I ever had a problem with this mod was when I went deep into a cave and there were a few lava areas and the cave became quite filled with smoke to a point I think the game was lagging a bit, but it wasn't too bad even then, really. And it just made me think maybe I could adjust how much smoke lava made somehow, according to what I may prefer. I dunno.
I don't know how to put things on that DB thing, but some mods could be pretty fun for other people and stuff. I dunno.


Image

I was messing with the textures a bit and would maybe want to try to mess with them a bit more, but here is something that might kind of be some sort of option? Just thought I might share.

...

This is what my smoke looks like now.
Image

...

Is it possible to make smoke come off of your character like when you are holding a torch?

Grubler
Member
Posts: 98
Joined: Wed Nov 06, 2019 03:01
In-game: Grubler

Re: [Mod]Smoke [WIP]

by Grubler » Post

Astrobe wrote:
Sat Jun 19, 2021 08:21
Hi, thanks for your kind words.

The truth is, I am too lazy to make the extra step to ContentDB and to do long-term maintenance.

I also think it is less a mod than a library - it has to be tweaked and adapted to the game it is inserted into.

If anyone wants to do it, the license should allow it and I would have no objection.
Did you care to see these texture experiments I did? Does mentioning you help at all or. If not, then that is fine. I am pretty new to all this.

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

Re: [Mod]Smoke [WIP]

by Astrobe » Post

Grubler wrote:
Tue Jun 29, 2021 06:00
Did you care to see these texture experiments I did? Does mentioning you help at all or. If not, then that is fine. I am pretty new to all this.
Sorry, I missed your posts.

Your textures look interesting, I'd like to see how they look in a live game. It also gave me the idea of playing with the "firelike" drawtype. I'm using it already in my game for leaves and cobwebs. It has pros and cons though: sometimes it works well, sometimes it looks weird.

Regarding the performance issues you mentioned, I think part of it is due to the process of moving the blocks, and part of it is due to the graphic load - I think. I noticed that FPS go up when I look away from the smoke. The textures are animated so it could be that. Transparent textures are another special beast, I am not sure if they are better or worse.

It is probably doable to have smoke coming out from a torch in hand, perhaps using a similar technique as the mods that add actual light to a torch in hand. With extra effort the two could even be combined (in order to use less resources).

I did not try to do anything like that, though, because I think the result would have been weird with the current big grey smoke block - lighter textures might make it look ok. But to be frank, I am not really interested in making it happen.

Grubler
Member
Posts: 98
Joined: Wed Nov 06, 2019 03:01
In-game: Grubler

Re: [Mod]Smoke [WIP]

by Grubler » Post

When the smoke gets a certain distance away, the functions stop working on it and it just sits there. I am wondering if there may be a way to tell it to remove the smoke if it gets to the level of the clouds.

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

Re: [Mod]Smoke [WIP]

by Astrobe » Post

Grubler wrote:
Wed Sep 15, 2021 19:27
When the smoke gets a certain distance away, the functions stop working on it and it just sits there. I am wondering if there may be a way to tell it to remove the smoke if it gets to the level of the clouds.
Yes, I think I mentioned this glitch before. The problem is that each player generates an "activation bubble" around them, where the ABMs and the timers can run. What happens is that sometimes a smoke block gets close to the edge of the bubble, and then the player quickly moves - for instance falls down. The smoke block is then not in the bubble anymore. Because the view distance is usually far greater than the radius of the activation bubble, you see stuck smoke blocks.

I actually see the problem "every day" in my game. I have a mob that throws smog bombs at players (smog is a kind of smoke that moves horizontally rather than going up). When they ignore the mob or when they live the area after the fight, the remaining smog/smoke blocks get deactivated, and when they come back they will find them at the same place.

The issue is, because one cannot do anything timer-based, ABM- or LBM-based operations to things outside of the activation bubble (unless you force things, which is not without consequences), I cannot automatically remove them - not without telling users to move "close enough" first. Which usually already solves the problem as the smoke blocks can sense when they are on the edge of the bubble.

There's probably a way to detect that a timer tick was overdue, which is a sign that the block was "stuck". It would allow to remove the block faster (someone has still to move close enough) and more reliably. However I expect it to have undesirable consequences. Like when a player returns to a lava lake or a forest fire, they will see all smoke vanish and then slowly be generated again.

Post Reply

Who is online

Users browsing this forum: No registered users and 8 guests