this post was submitted on 25 Sep 2023
11 points (100.0% liked)

Game Development

3430 readers
7 users here now

Welcome to the game development community! This is a place to talk about and post anything related to the field of game development.

Community Wiki

founded 1 year ago
MODERATORS
 

I'm working on a simulation toy, and I want to model wind on my world/levels.

I'm currently using playrho (a box2d fork) with gravity set to 0 to model a top down view.

I assume the wind will be represented as a vector field. But I'm unsure what method to use to get this field.

Could someone point me in the right direction? Should I be looking at the navier-stokes equation? Does anybody know of any relevant tutorials?

Thanks in advance!

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 5 points 1 year ago

Well, firstly you need to decide how accurate you want your wind modeling to be, but generally, the less complicated an equation you can use for your desired level of accuracy, the better. It'll end up being a vector field, but I would probably make simple rules for how the wind interacts with objects in a given tile and the tiles around it, rather than trying to model fluid dynamics precisely.

Another approach might be a ray-tracing style approach, where the rays can bounce off object geometry and lose some momentum, objects can respond to ray impacts and gain momentum, and you do some vector math to figure out what happens when rays and moving objects intersect.

The exact approach depends on the specifics of your game, and the "right" answer might be neither of these.