Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Wind affects other particles #20

Open
EcoBuilder13 opened this issue Apr 26, 2021 · 5 comments
Open

Feature request: Wind affects other particles #20

EcoBuilder13 opened this issue Apr 26, 2021 · 5 comments

Comments

@EcoBuilder13
Copy link

Since wind was just added in 20ce059 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
Copy link
Collaborator

Fourmisain commented Apr 26, 2021

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:

// approach the target wind velocity over time via vel += (target - vel) * f, where f is in (0, 1)
// after n ticks, the distance closes to a factor of 1 - (1 - f)^n.
// for f = 1 / 2, it would only take 4 ticks to close the distance by 90%
// for f = 1 / 60, it takes ~2 seconds to halve the distance, ~5 seconds to reach 80%
//
// the wind coefficient is just another factor in (0, 1) to add some variance between leaves.
// this implementation lags behind the actual wind speed and will never reach it fully,
// so wind speeds needs to be adjusted accordingly
velocityX += (Wind.windX - velocityX) * windCoefficient / 60.0f;
velocityZ += (Wind.windZ - velocityZ) * windCoefficient / 60.0f;

edit: Note: this is completely client side

@EcoBuilder13
Copy link
Author

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
Copy link
Collaborator

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
Copy link

vico93 commented May 26, 2024

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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants