The failure of Newton

Space mess

Space mess

So far, I implemented the usual Newtonian physics, that is, the ship has a thurster control, which makes it accelerate in the current direction, and speed and position are integrated from it.

To control by hand, it’s a bit unusual, but we get used pretty fast. Especially since I coded a control that turns you automatically to the direction opposite to your speed, so you can “slow down”.

However, I’m stuggling to build an AI for something as simple as “go there and stop”. The easy way seems to be to first slow down to a stop, then turn to the point, accelerate half the way, deccelerate half the way. But that, of course, fails if the target is moving.

More naive solutions can work too, but they all seem to “diverge” in that if you aim at a fixed point, the ship will oscilate around it, on an increasing orbit.

Anyway, despite allowing for pretty nifty curvy trajectories, I’m affraid Newtonian physics are actually not fun. You almost never point at where you want to go, and you spend your time doing “straight” accel/deccel trajectories, because they are easier to visualize.

The solution I see is to go back to a more “arcade” system, where the player controls directly speed, instead of acceleration. Pressing the thruster button makes you go forward, period. Of course, in space it’s very impossible, but that’s the kind of behavior we are use to on Earth. Thanks to friction on the floor, cars, bikes and stuff are controled by direction.

On the other hand, I like the idea that you can aim at somewhere you don’t go, especially if weapons are aligned with the ship. That way you can do fly-by shootings, and looking around without actually moving erraticly.

Maybe I can try a hybrid system, where ships have proper Newtonian inertia, but as soon as the thrusters are on, the speed is fixed to the forward direction. Maybe also some sort of damping to avoid brutal speed jumps then.

Dunno. I’m getting tired and I haven’t done much yet. Also I’m far from any game at all.

Tags: screenshot

Comments

21. Aug 2010 · 20:43 UTC
You can cheat on the AI, using feedback loops… I’ve done so in the past with lots of success on that same context…

Feedback loops use the following piece of code: