Live data from Hacker News

Show HN: Lunar lander-type game with computational fluid dynamics

github.com

81–90 of 130 posts

Re: Show HN: Lunar lander-type game with computational fluid dynamics

#81

> the result varies depending on the FPS and your actions. you should try to decouple physics simulation from your rendering code. (i.e. pass a constant/fixed dt to your simulation step). simulation should not depend on framerate.

But with a chaotic system like fluid dynamics, you wont get the same behaviour each time even if you do stuff like pass delta-t to the simulation. Sensitive dependence on initial conditions, and all that chaos theory stuff comes in to play.

That is, two run-throughs with very slightly different delta-t's will give different outcomes.

Re: Show HN: Lunar lander-type game with computational fluid dynamics

#82
post #17

Earlier quoted context omitted.

I suspect 3D fluid dynamics gets a lot slower a lot more quickly

You don't need 3D fluid dynamics for 2d sailing game. You would have 3 separate 2d layers for wind, sea currents and then wave layer. The waves don't have to follow the wind, but they they could have specular reflection from the land. It would make sailing in complex archipelago or narrow choke points more realistic.

but how will it know if my sailing by the Lee is faster than the waves?

and I'll lose out of surfing!

Re: Show HN: Lunar lander-type game with computational fluid dynamics

#83

> the result varies depending on the FPS and your actions. you should try to decouple physics simulation from your rendering code. (i.e. pass a constant/fixed dt to your simulation step). simulation should not depend on framerate.

But with a chaotic system like fluid dynamics, you wont get the same behaviour each time even if you do stuff like pass delta-t to the simulation. Sensitive dependence on initial conditions, and all that chaos theory stuff comes in to play. That is, two run-throughs with very slightly different delta-t's will give different outcomes.

There's a difference between "numerical stability issues introduce small chaotic perturbations" and "the game is literally unbeatable if you play on platform X because the physics step doesn't properly scale Y to framerate and a trivial conservation-of-energy analysis yields an impossibility result for level 3".

Re: Show HN: Lunar lander-type game with computational fluid dynamics

#84
post #47
post #42

Earlier quoted context omitted.

Yes, every time I land with the white bar inside the green area, it explodes.

I opened it on Firefox and everything worked out fine. I realized that on Chrome all the graphics were weird. No colors on the home page, I couldn't see the windows at the buildings. Maybe there is something not rendering right in Chrome. I use Chrome Version 60.0.3112.113 (Official Build) (64-bit) on Fedora 25

I also had it work better in Firefox for some reason. I tried it in Vivaldi and it ran at ~6 FPS while in Firefox ~60 FPS.

Re: Show HN: Lunar lander-type game with computational fluid dynamics

#85
post #64
post #33

Does not work in Firefox 60.2.0esr. Worked fine in Chromium (10004 Points, died once).

Works for me (tm) in Firefox 61.0.1 (64 Bit, Linux)

Can confirm, works great (>40fps) on Firefox 61 under the latest Ubuntu on an i7 Dell Latitude.

Re: Show HN: Lunar lander-type game with computational fluid dynamics

#86
post #2

Author here. It started as a technical demonstration for fluid dynamics in the web browser. Then I saw the js13kgames competition and the decision was made to make a game out of it. A game in which the fluid mechanic counts. The decision for the Lunar Lander genre then was quiet easy. Does someone know more games then the two I mentioned in the README (Plasma Pong and Pixeljunk Shooter) with more or less realistic fl…

Vessel (https://store.steampowered.com/app/108500/Vessel/) and more recently Claybook (https://www.claybookgame.com) come to mind. They both use SPH fluids afaik. The upcoming Noita (https://store.steampowered.com/app/881100/Noita/) has some particle based fluids. Tommy Referenes (Super Meatboy programmer) was working on an unreleased game called Goo (https://vimeo.com/1793371). Also Riders on a Storm (http://www.the2bears.com/?page_id=652) a fluid dynamics shmup inspired by Plasma Pong.

Re: Show HN: Lunar lander-type game with computational fluid dynamics

#87

This is great - especially the pixel-perfect collision detection. But honestly, these colonists don't really deserve mail service if they insist on building their cities in such difficult environments.

Don't knock it, that volcano mine pays the bills.

Re: Show HN: Lunar lander-type game with computational fluid dynamics

#88
post #69

After playing for < 10 minutes it started getting noticeably slower and my MBP Retina was spinning up its fans. I am using latest Chrome. Is this a sign that web games are not yet ready - or simply that either the game isn't optimized enough or perhaps even that Chrome is a poor choice for browser games?

Very likely started thermal throttling because apple is notorious for not putting adequate cooling on their mac books.

This game uses fluid dynamics calculated in real time, i don't think its designed to be super optimized but rather super true to physics. Most of the time game optimization involves cheaping some of the complex calculations to be less accurate but still "good enough" see https://en.wikipedia.org/wiki/Fast_inverse_square_root for an example.

In other words you'll run into this issue any time you do anything taxing for more than 10 minutes on a mac book.

Re: Show HN: Lunar lander-type game with computational fluid dynamics

#89
post #26
post #24

Earlier quoted context omitted.

On my computer the game runs at 40 FPS. So there is still room and I can increase the timestep if you want. This game simulates the Navier-Stokes equation on a grid of the size 256x128. Four times the size would already reduce the game to 10FPS or even more. Of course you can try to rewrite it to run on the GPU. An alternative would be to use so called Smoothed Particle Hydrodynamics. This is particle and not grid ba…

I increased the timestep by a factor of two. Have fun https://simulationcorner.net/js13kgame/

I love the faster one. Grabs much more attention. Great game! A satisfying thud on touchdown would be nice. (OT: this was the very first lunar lander I played on my father's ZX81: https://www.youtube.com/watch?v=jlS3fr3t4Fg)

Re: Show HN: Lunar lander-type game with computational fluid dynamics

#90
post #11
post #6

This is great! I made it all the way to 8, but couldn't win :) I like the idea of having to examine wind streams to plot your way through the map. This is an awesome tech demo, would be keen to see something more polished & fleshed-out.

There is a trick in level 7. You have to do something counterintuitive.

Ok, I'll bite, what? I just do the obvious, drop fast from left to right. That way you can cross without being forced off the top of the screen.
Post reply on HN