Log In  

Cart #44846 | 2017-10-02 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA

I started playing around with the shallow water equations and got to something that's maybe a little bit fun. Arrow keys make waves, Z switches boundaries between (approximately) open and reflecting. My implementation mostly follows https://graphics.ethz.ch/Downloads/Publications/Tutorials/2008/Mue08/coursenotes.pdf .

Current limitations/known bugs:

  • Dissipates energy rapidly, although you'll probably only notice this if the boundaries are reflective.
  • No handling of dry regions. Weird things may happen if depth goes to 0!
  • Weird oscillations around both (nearly-)dry regions and shocks/big elevation changes. Not sure yet how much of this is attributable to bugs vs. limitations of the discretization I'm using.
  • Liquid volume is not conserved. Not really a meaningful concept with open boundaries, but pretty noticeable with reflective boundaries.
  • No wave breaking etc. Shallow water equations are a heightfield model and I don't think I'll get around to full liquids on PICO-8 any time soon. :)

I hope this cart is fun to play with! I'm hoping to fix a few of the items above, clean up the graphics a bit, and maybe find a way to build a little bit of a game around these dynamics.

P#44847 2017-10-02 04:09 ( Edited 2017-10-02 20:21)

Hu... with open edges I was able to empty the ocean ;)
Nice though!

P#44864 2017-10-02 14:46 ( Edited 2017-10-02 18:46)
:: luchak

Hmm.... There's a term in there to slowly bring the edges back up to halfway up the screen if you leave the sim alone. (The open boundary implementation here is kind of a hack in any case -- so what's one more hack to make it work better?) I'm curious though: when you emptied the ocean, did it happen suddenly after depth going to 0 somewhere, suddenly after a large oscillation appeared somewhere, or just kind of gradually?

P#44868 2017-10-02 16:21 ( Edited 2017-10-02 20:21)

[Please log in to post a comment]

Follow Lexaloffle:        
Generated 2021-10-20 22:10:09 | 0.010s | Q:16