Ceres Station: Permission to Launch
Hey Folks! Another big step towards completing interplanetary travel today: starting the game docked at Ceres Station!
As most of you know, the last several weeks of work are aimed at getting some sort of core game loop up and running. And a bare-bones summary of that loop looks like:
- plot course
- engage course
- watch & manage the crew and ship for hours
- enter station
Ignoring possible alternate origin stories for now, it makes sense to setup the game to start us docked at some station. And until the System has more population defined, Ceres is pretty centrally located between inner and outer planets. So we'll go with that.
When switching from ship editing mode to crew sim mode, the game will now spawn your ship in the system, spawn Ceres station, then dock your ship to the station. And until I add the UI to undock, there you remain, tracking Ceres around the System in real time.
There was a surprising (okay, unsurprising for gamedev) amount of work involved in making that happen. The ship's update loop needed adjusting to have more info it needed to track positions of a celestial body. And it needed to know whether to consider itself as locked to the body or free-flying.
I also needed to change some code in the orbital plotter to correctly handle cases where the ship is docked to a celestial object. Again, since it's not free-flying, all of the course-plotting code was wonky. Part of this was making sure the ship was docked at a reasonable position (i.e. not at the center of a planet). Another part of this was to remember to undock projections of the ship when plotting future positions (since the course plotter only makes sense when you're not attached to a celestial body).
Once those tweaks were made, I fired up the game, and the above split image is the situation. A tiny space station docked to the ship's layout, and ship position correctly tracking Ceres in the plotter, with the ability to see a course to other places in the System.
There were also several other minor bugs to fix while at it today. For one thing, my code to stop fusion from yesterday forgot to affect the ship's thrust and acceleration, so I had to handle that. And that required a bit more plumbing to accommodate, such as way for objects and AIs to change the ship's thrust/acceleration.
Finally, since I was getting tired of waiting for my AI to finish pooping/exercising/daydreaming when testing the plotter, I changed the way mouse clicks work to completely interrupt their current task, instead of queuing the mouse-clicked task. Now, I can say "jump" and they do instantly.
So, what next? Like I mention above. Still no way to undock via the game's UI, so that might be a good next step. And the other end of the trip is completely unhandled. I'll need code to recognize when the ship is making a rendezvous so it can dock. And probably some corresponding UI to initiate a docking maneuver. (Even if it's just a placeholder that instantly attaches the ship to the station.)
Once both of those are added, I think the above loop will technically be complete. Probably also really boring, but complete. I have a feeling I'll need to revisit AI needs and tasks to make the trip more interesting, as well as flesh-out the ship systems a bit more so they can do their thing. Still no atmo processing, for example. No plumbing. No temperature control, etc.
That's all for this week. Have a good weekend, all!