I’m actually writing this at the start of Week 3, which is kind of messed up.
I’ve been thinking and writing a lot about spaceship physics lately. In particular, the way things should move, and feel, and what makes sense as a way to control a ship.
There’s one thing I think a lot of space games do wrong, and that’s momentum. Things in space have it, and they keep having it, and that matters. When you’re playing a game and you stop pushing the forward button for your character, or a car, they should probably stop. If you stop pushing forward on a plane, maybe you should slowly fall out of the sky, even. But when you’re in space? You keep going.
So, Starwing. The movement system i’ve been working on is basically pretty simple. You have a handful of thrusters on a ship, and you use them to move. A thruster has a position, a direction it pushes in, and a cardinal “control” direction. Then the ship as a whole gets a direction that it’s going in, either from its movement AI or from the player input, and passes that to each thruster, which replies with the thrust vector it is outputting to contribute to that. Say you’re holding your movement joystick hard left–any thrusters with a control direction of “left” will output at full force, and any that are “right” won’t do anything, and you spin to the left. If you’re pushing full forward, your forward thrusters will be going but your turning ones won’t. Pretty simple.
“But Emma,” I hear you cry, “that means you’re moving around every object by summing four or more force vectors for every game tick! What about the performance?” To which I would say first of all, go away, that’s my problem, and if Unity can’t handle (at a high estimate) a hundred or so vector additions in one physics tick that’s their problem. Secondly; not every object, anything unpowered doesn’t have to worry about this, and anything really simple like if I decide to implement guided missiles or something will just use a simpler approach. But for spaceships, the in-depth system exists purely so that it can be fucked with in interesting ways.
What happens if you get shot in the wrong place and your left turning thruster gets blown up? Or what if the cooling system gets damaged, so you can only use it for short bursts? That changes how your ship flies, so it changes how you play the game. And I like the idea of that going the other way as well; if you come up against a really big enemy, and your solution to it is to focus target all of the thrusters on one side so it can’t turn to face or avoid you any more, I think you should be able to do that, and a simpler conversion of input direction to movement doesn’t let you.
Having thought about this a little more while writing, I think there might be a simpler approach. Maybe you just have forwards and backwards thrusters adding their thrust up, and then left and right turning thrusters apply a net torque around your centre of mass. This might end up being how it works, but I want to try the current version first, and see how it holds up at scale.
Next week I should write about what I figured out about the kind of game I want to make, and how that relates to higher level game structure.