RandomMcSomethin / fallingleaves

MIT License
43 stars 20 forks source link

Feature request: Wind affects other particles #20

Open EcoBuilder13 opened 3 years ago

EcoBuilder13 commented 3 years ago

Since wind was just added in 20ce0594f48cca33c5a231c00f7962a3a184597c it is now kind of weird that the leaves blow in the wind but not other particles like campfire smoke, torch smoke, etc. I think it would be a nice visual improvement if this was added as well as being more consistent. It might also be cool if the wind had an affect on fireworks. Like influencing their flight path or adding a residual smoke particle that blows away in the wind like real fireworks.

Fourmisain commented 3 years ago

Hm... I see some issues with that, campfire smoke for example is often used indoors or in closed off quarters for hot tubs/springs and since wind is global, it would look even more odd inside. This would need a (high performant) way to differentiate "inside" from "outside".

Then there's the issue that smoke is not a continuous stream but just a row of particles moving up - if those move horizontally as well, especially with different speeds, they will be spread out more and the illusion might be destroyed.

It might also be cool if the wind had an affect on fireworks

Maybe, but it might also destroy the firework patterns.

adding a residual smoke particle that blows away in the wind like real fireworks

That's definitely outside the scope of this mod and could be one of its own, I imagine it's hard to make it look convincing in pixel style.

All in all, some interesting ideas, I might have a look at them sometime, but currently I'm pretty burnt out on it, wind took ages to get right and there's still some things I wanted to 'fix'.

When I was building wind, I tought about other mods potentially making use of it, so if you or some developer that's listening wants to, you can do so by using this mod's Wind.windX and Wind.windZ, e.g. moving a particle like this: https://github.com/RandomMcSomethin/fallingleaves/blob/0ffba7eac079e16d13d03492fb9b2165bdaa44ab/src/main/java/randommcsomethin/fallingleaves/particle/FallingLeafParticle.java#L99-L108

edit: Note: this is completely client side

EcoBuilder13 commented 3 years ago

Hm... I see some issues with that, campfire smoke for example is often used indoors or in closed off quarters for hot tubs/springs and since wind is global, it would look even more odd inside.

It might be possible to only do wind if the block is exposed to a certain level of skylight or higher. The only problems with that is that it won't work in other dimensions that don't use the same skylight values and it would not account for being in a surrounded box or under a big platform. For campfires I think it could be done using the particles "age". Where it would only be affected by winds at certain y values above the campfire and by different speeds at different levels. The age value would be calculated by the particles y position using the distance from the initial y value and the destination y value. So based on how far the particle is from the campfire towards its destination it would be accelerated by the wind at a different speed. That should allow light winds to only cause a slight bend in the column and high winds to blow it straight sideways from the campfire if desired.

Maybe, but it might also destroy the firework patterns.

I had in mind keeping the explosion static but the wind influencing the direction the firework files in when launched, but not by too much as not to make it too hard to have fireworks shows without them going off target.

That's definitely outside the scope of this mod and could be one of its own, I imagine it's hard to make it look convincing in pixel style.

Yeah it would be difficult in especially since it is in 3d space. I might mess around with the idea once I figure out particles.

When I was building wind, I tought about other mods potentially making use of it, so if you or some developer that's listening wants to, you can do so by using this mod's Wind.windX and Wind.windZ

I will tell other developers and mess around with it my self when I get the chance. I was really excited to see that wind was added when the new version was published. I have been waiting to see a well done wind implementation for Fabric.

Fourmisain commented 3 years ago

I had in mind keeping the explosion static but the wind influencing the direction the firework files in when launched, but not by too much as not to make it too hard to have fireworks shows without them going off target.

Oh, so you meant the rockets afterall. That's a pretty important thing I forgot to mention: wind is completely client side and I'm 99% sure fireworks are server side, so that won't work with the current implementation.

I'm also not sure about the idea, e.g. it'll affect fireworks fired from crossbows as well so that could affect gameplay. Rockets also have a natural spread, so it's probably hard to notice any wind in the first place (if it's weak enough to not interfere with firework shows).

It might be possible to only do wind if the block is exposed to a certain level of skylight or higher.

Yeah, skylight was my first tought as well, but that's definitely not pefect for the reasons you mentioned.

For campfires I think it could be done using the particles "age". Where it would only be affected by winds at certain y values above the campfire and by different speeds at different levels. The age value would be calculated by the particles y position using the distance from the initial y value and the destination y value.

Every particle has an age (and a maxAge), so there's no need to calculate it. It might be enough to just choose a small windCoefficient, so it gets accelerated slowly.

I will tell other developers and mess around with it my self when I get the chance. I was really excited to see that wind was added when the new version was published. I have been waiting to see a well done wind implementation for Fabric.

Did it have such a high demand? 😄 Well, I guess weather mods have always been popular, Falling Leaves isn't really trying to be one, but who knows, maybe I'll split off the wind part into a library down the line.

vico93 commented 3 months ago

Don't want to sound self-promoting my other suggestion issue, but this could relate with #65 if the player also have WilderWild installed. It have a wind property that is used to propel wind particle effects, tumbleweeds and also accordingly to WW authors, even vanilla stuff like campfire's smokers.

AViewFromTheTop commented 3 months ago

Fireworks are also subtly impacted by wind as well in Wilder Wild! Very subtly.