It’s amazing how a simple algorithm performs so well, the autopilot is able to recover from some pretty extreme situations, and does it gracefully. Adding some realism to the engine physics (firing delays, minimum firing time, power ramp up, heat limits etc) would likely make it 10x harder.
Show HN: I built an autopilot for the lunar lander game
31–40 of 73 posts
Re: Show HN: I built an autopilot for the lunar lander game
#32In the real world, you would derive physics equations (acceleration -> velocity -> position), add constraints and then solve everything to obtain an optimal trajectory (mostly in term of fuel, but you can add other constraints too, for ex due to radar-ground or Antenna-Earth visibility). I wrote a blog post about Apollo's algorithm: https://blog.nodraak.fr/2020/12/aerospace-sim-2-guidance-law... (Described in the second section ; the first section is about a naive algorithm similar to yours that in the end did not work as well as I wanted).
Also, thanks for the code, I wanted to do the same, but lost motivation when I could not really expose in a satisfying way the internal state out of these JS modules (it's not complicated in the end, but I'm simply not a frontend dev ; and I wanted to avoid forking and monkey patching everything and simply adding some JS code throught the console or something).
Re: Show HN: I built an autopilot for the lunar lander game
#33Earlier quoted context omitted.
Which points to a lovely idea - the game becomes writing competitive lander algorithms. Just need a bit of JSFiddle adding...
That'd be very fun indeed!
Re: Show HN: I built an autopilot for the lunar lander game
#34Then you have stable baselines which implements popular reinforcement learning algorithms to solve these gym problems: https://stable-baselines3.readthedocs.io/en/master/
Shamless plug: I've built a series of games where you solve puzzles (2048) / toy problems (MDP) like the lunar lander using various AI and ML algorithms.
You can check it out here: https://ai-simulator.com/
Re: Show HN: I built an autopilot for the lunar lander game
#35What about adding a limited fuel supply?
“Unlike other arcade games, Lunar Lander does not feature a time limit; instead, the game starts with a set amount of fuel and inserting additional quarters purchases more fuel, allowing indefinite gameplay.“
https://en.m.wikipedia.org/wiki/Lunar_Lander_(1979_video_gam...
Re: Show HN: I built an autopilot for the lunar lander game
#36It's interesting to think about how the optimal strategy to land the lander would look like. If the distance to the moon was large, I would expect 4 phases: 1: Turn the lander towards the moon 2: Constant thrust towards the moon 3: Turn the lander away from the moon 4: Constant thrust away from the moon But if the initial distance is small enough, turning it around might not be worth it or even possible. So the optim…
when discussing about optimality, it is worth specifying what are you optimising for. time optimal landing lends techniques from bang-bang control (e.g. starting with v=0, max thrust towards the target, before flipping around half way and max thrust away from target) fuel optimal landing (incuding RCS) technique would depend on the available time to turn retrograde (pointy end pointing away from direction of movement…
In doing this, it results in a few hundreds to thousands of solutions to test per timestep, which modern CPUs can shrug off easily. Not nearly as elegant as closed-form control theory systems, but easy to tune and give different goals.
Re: Show HN: I built an autopilot for the lunar lander game
#37Lunar lander is a one of the problems in Open AI Gym, where you test AI against standard set of problems: https://www.gymlibrary.dev/environments/box2d/lunar_lander/ Then you have stable baselines which implements popular reinforcement learning algorithms to solve these gym problems: https://stable-baselines3.readthedocs.io/en/master/ Shamless plug: I've built a series of games where you solve puzzles (2048) / toy pr…
Re: Show HN: I built an autopilot for the lunar lander game
#38Re: Show HN: I built an autopilot for the lunar lander game
#39Lunar lander is a one of the problems in Open AI Gym, where you test AI against standard set of problems: https://www.gymlibrary.dev/environments/box2d/lunar_lander/ Then you have stable baselines which implements popular reinforcement learning algorithms to solve these gym problems: https://stable-baselines3.readthedocs.io/en/master/ Shamless plug: I've built a series of games where you solve puzzles (2048) / toy pr…
Re: Show HN: I built an autopilot for the lunar lander game
#40Lunar lander is a one of the problems in Open AI Gym, where you test AI against standard set of problems: https://www.gymlibrary.dev/environments/box2d/lunar_lander/ Then you have stable baselines which implements popular reinforcement learning algorithms to solve these gym problems: https://stable-baselines3.readthedocs.io/en/master/ Shamless plug: I've built a series of games where you solve puzzles (2048) / toy pr…
Looking at your website I’m curious how exactly you’re building «ChatGPT for mobile games»? Are you using language models to build these AI solvers?
In a way what I am building is a "general AI engine" that is capable of taking in an arbitrary game and play it, which is somewhat conceptually similar to how ChatGPT is a general AI that is able to solve a wide range of text-based tasks.