Hacker News new | ask | show | jobs
by techie2022 1409 days ago
Very cool game! I'm into controls and would love to write a PID controller for it to stabilize it and have it auto-follow my mouse, as a controls demo.

I'm not sure how best to capture it's state though (position, xy velocity, angular velocity, etc.), Nor how to integrate mouse into it.

1 comments

Not a bad idea, though you would have to use bang-bang control since the thrusters are either full on or full off. I'm not sure if you can integrate anything as is, but when I release the source code you can try to build up from that.
Tapping the keys at a certain frequency is the same thing as PWM control, which gives you an duty-cycle-based analog-like control input. PWM is just on_time/(on_time + off_time), so there are a number of ways to do this even with the key input as you have it. Again, in summary: you can do PWM duty-cycle control or tap-frequency-control, which is really just the same thing.