Hacker News new | past | comments | ask | show | jobs | submit login

It's interesting. The naive way to write this would be not use any special formulas, and just recalculate mass and acceleration each frame (based on the new mass). And to calculate intersection with the ground at each frame boundary.

I guess the idea is that the lower your frame-rate, the less accurate this approach is, or maybe the idea is it's fun to use the actual equations.

I'm curious how perceptible the difference is between the two at the original framerate.




There wasn't any graphical output or any frame rate to speak of in the sense you are thinking. The output would appear printed, like this:

https://www.cs.brandeis.edu/~storer/LunarLander/LunarLander/...

Only updating the mass/acceleration at ten-second intervals would be wildly incorrect!


Just because your displaying results in 10s increments doesn’t mean anything about the simulation frame rate. You could still simulation 10k frames at 1ms granularity between the results printed each ms. The challenge is computational for a 1960s machine and a closed form solution is sensible here for that reason.


Oh, thanks. There was an arcade game called Lunar Lander and I thought that this was the exact same thing, and I guess I didn't pay much attention to the pictures.


OP here (of this blog post, not the original game). The naive way is what I expected too, and described as the Euler method in the post.

In terms of physical accuracy, especially when you get near the surface, the mass does change significantly if you have a high rate of fuel burn. But in terms of how challenging/fun it would be, and what strategies you use as a player, I doubt it would make much difference. In fact, there are other lunar lander simulations in the BASIC computer games book, I think one of them does use the naive approach.

If 10 seconds is too long, you could still leave that as the turn in the UI, but internally break each turn into a bunch of smaller time steps, e.g. 10 time steps of 1 second each. Actually, the existing game does that in certain places, which is why his physics simulation takes in an arbitrary time S rather than always the full 10 seconds.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: