Live data from Hacker News

Simulating water over terrain

lisyarus.github.io

21–30 of 60 posts

Re: Simulating water over terrain

#21
Neat dive on this topic, and I appreciate calling out Timberborn! I'm obsessed with that game currently, big big big recommendation if you haven't checked it out yet. The water physics are like another character in the game and figuring out how to dam up a bunch of water to use in your engines and to water your fields is an essential part of the gameplay loop.

Re: Simulating water over terrain

#22

The waves when the water is first entering the area is called numeric dispersion, it's a consequence of discretizing. It can be mitigated somewhat by smoothing the entering wall of water so that there's not a sharp discontinuity.

I don't think so, the waves are actual shock waves which are a solution to the Riemann problem for the shallow water equations because they are nonlinear hyperbolic equations. You can find them even before you start introducing any numerical grid or discretization. See e.g. the classic exposition by Leveque: https://www.clawpack.org/riemann_book/html/Shallow_water.htm...

Very interesting, my mistake! I'm more familiar with acoustics and assumed it was the same phenomenon, but it looks like I jumped to a mistaken conclusion.

Re: Simulating water over terrain

#23
post #6
post #3

Another take on fluid simulation (Coding Adventure): Rendering Fluids: https://www.youtube.com/watch?v=kOkfC5fLfgE I Tried Putting my Fluid Simulation on a Planet: https://www.youtube.com/watch?v=8nIB7e_eds4&t=817s GitHub: https://github.com/SebLague/Fluid-Sim?tab=readme-ov-file

That second one was a joy to watch. I thoroughly enjoy that kind of high level tour/discovery video.

Each of his videos is a joy to watch. He has a very relaxing voice

Re: Simulating water over terrain

#24

The waves when the water is first entering the area is called numeric dispersion, it's a consequence of discretizing. It can be mitigated somewhat by smoothing the entering wall of water so that there's not a sharp discontinuity.

Interesting, thanks! Is it kinda like the Gibbs phenomenon?

Take a look at the other reply, which says it's actually not dispersion. My mistake!

Re: Simulating water over terrain

#25
Nice explanation. I like the viscosity part, I implemented something similar a couple of years ago in an open source RTS game engine (test video at: https://www.youtube.com/watch?v=cQW8WXNpYXk), and without viscosity water was spreading thin and due to floating point, at some point it was spreading on flat surfaces and "evaporating".

Also, the grid resolution required to obtain nice waves was a bit too much for the effort I put 5 years ago (probably needed another thread, etc.)

Re: Simulating water over terrain

#26
post #25

Nice explanation. I like the viscosity part, I implemented something similar a couple of years ago in an open source RTS game engine (test video at: https://www.youtube.com/watch?v=cQW8WXNpYXk ), and without viscosity water was spreading thin and due to floating point, at some point it was spreading on flat surfaces and "evaporating". Also, the grid resolution required to obtain nice waves was a bit too much for the…

Very cool! Based on the video you're also doing some hierarchical subdivisions?

Re: Simulating water over terrain

#27
post #13

Off topic, but the post mentions needing terrain manipulation for resource gathering. I always thought animal crossing had a clever and efficient approach to this without any terrain manipulation. You can chop a tree, and it'll dispense logs, but only so many before it essentially has a cooldown. You get the feedback and the finite resources, without expensive terrain manipulation. Of course that doesn't work for eve…

The blog mentioned that strategy, in the form of gold ore in a gold ore boulder found lying around It a standard strategy for resource dispensation (though cooldown doesn’t alleviate the infinite resource problem; it just slows it down), it’s just… boring and unimpactful

[deleted]

Re: Simulating water over terrain

#30
post #3

Another take on fluid simulation (Coding Adventure): Rendering Fluids: https://www.youtube.com/watch?v=kOkfC5fLfgE I Tried Putting my Fluid Simulation on a Planet: https://www.youtube.com/watch?v=8nIB7e_eds4&t=817s GitHub: https://github.com/SebLague/Fluid-Sim?tab=readme-ov-file

I really enjoy Coding Adventure. He has a small game 'Geographical Adventures' which has lovely music and is really relaxing [0] [1]

[0] https://www.youtube.com/playlist?list=PLFt_AvWsXl0dT82XMtKAT...

[1] https://github.com/SebLague/Geographical-Adventures

Post reply on HN