11

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
[-] NoisyOwl@hexbear.net 3 points 1 year ago* (last edited 1 year ago)

Air is a compressible fluid, so ultimately you'll need Navier-Stokes, but actually figuring out how to translate those equations into code is infamously annoying, so definitely check out an existing solution instead of trying to implement from the equations. Foster & Metaxas is an old a grid-based solution. Theirs is designed for incompressible fluids (water), but I think it should be fine if you raise β₀.

There's a lot of math in the paper, but it's easier to implement than it looks (each step, run [2] on every cell once, then run [6] [7] [8] on every cell ~6 times), and it's mostly just transcribing equations. It's super fiddly though, just incredibly fiddly, expect to have to spend a lot of time debugging.

There are probably suitable simpler solutions too though, so definitely spend some time searching for them (or just copyable implementations of Foster & Metaxas) before diving into that.

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

Game Development

2817 readers
6 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