Skip to main content
gamedev.net
🔒 Locked

Wind

Started by VanKurt 3 replies 1.3k views
Original Post
VanKurt
VanKurt
Yes, I want to do create a little simulation (2D, TopView) and want to add WIND ! It should be like a vector, that gives the wind''s direction and speed. So I created a lil app that draws just an arrow in the middle of the screen. But now I want the wind to change over time (In strength and direction), but I can''t find a good solution for doing this randomly. My first idea was to generate 2 random numbers, and add them to the x and y component of the vector, but the results are less than WORSE. Does anyone have a better idea ?? Thanks!
Michalson
Michalson
Instead of random X,Y changes, use random polar coordinate changes. This also allows you to adjust to variation of direction and strength independently.
Burning_Ice
Burning_Ice
i don''t know if this would produce nice results, just some theory:
according to how fast you want the direction to change you could just randomly generate one random vector-direction/intensity each minute, or 5 minutes, or how you want it, and then, over the course of this time, slowly interpolate between the current wind-vector and the new one, use the interpolated vector for your calculatiions/graphics/etc. , and do this until you have reached the newly generated direction, then start the whole thing over.



Runicsoft -- home of my open source Function Parser and more
Matt Halpin
Matt Halpin
Have a number of different ''octaves'' of wind.

For each octave, store direction vector and velocity vector (change in direction). Apply random numbers to each of the 3 components of the velocity vector, then add the velocity vector to the direction. Clamp the magnitude of the direction vector to a certain value.

Each octave should have a different maximum magnitude and magnitude of random numbers. This is so you get the basic wind direction changing slowly, but you still get faster changing smaller variations.

Then add the octaves up at the end.
siaspete
siaspete
I think what you need is 2 streams of 1D noise. One for the direction, and one for the strength.

Perhaps a relatively smooth noise function like perlin. Something like what would be used to generate randome heightfield terrain.

http://astronomy.swin.edu.au/~pbourke/terrain/freqland/


Helpful links:
How To Ask Questions The Smart Way | Google can help with your question | Search MSDN for help with standard C or Windows functions

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.