Posted November 23, 2024 by DSri
While I didn’t actually complete a game experience, I’m pretty pleased to have made progress on the engine itself!
Stuff I reviewed or learned how to do:
grid
and box-sizing: border-box
to make this a lot easier! Also the dimensional css stuff has been standardized quite a bit.I had to make up a bunch of stuff. As time dribbled away, I had to make a call on not writing the last missing systems. Off the top of my head this would have been:
I’m not that concerned about this; it will just take time to port that stuff over and possibly re-architect it on-the-fly.
On Wednesday I decided my achievable goal was to make the “minimum demo” of a ship moving around. There’s no interactivity, between the ship and any element of the world, but it does show some promising things:
I didn’t fix the starfield sprite class which is supposed to seamlessly scroll forever as a parallax under layer, but adding the cheesy sparkle effect by randomly not drawing a star layer made them twinkle, which added needed life to the demo. It’s the little things, right?
I hacked together a simple keyboard input controller that maintained a keyboard input state that I read directly into the INPUT part of the game loop. Ideally this would be in a Player class (a “human” player) that supports multi-input with unique ids, but who had time for that?
The ship controller code actually came out fairly nice in its feel! The keyboard inputs feed a “rotation impulse accumulator” that is added to the “current heading”, and this impulse accumulator degrades from an “rotational friction” property and is limited by “max rotation rate”. This gives the turning some weight. The thrust system is implemented in the same way, with the exception that reverse thrust is about a third the magnitude of forward thrust which helps give the ship a feeling of weight as well. This type of truck-style steering isn’t normally used in a space game like this, but it feels good and it would be interesting to make it work with a physics engine (the math is different than my fakey version). I’m excited about working out this controller logic.
I did not have time to add physics into the game, as that would have required me to do more reading to select a physics engine and create its geometry structures. I supposed I could have hacked it in as it’s not that hard, but I didn’t think it would actually have added much without more work than time allowed!
Good experience! Will be continuing to develop the process so I can share stuff with SNHGD! Hooray!