Maiden Voyage, Fixing Saves and Pathfinding
Hey Folks! Managed to fix several save game and pathfinding issues, launch my crew on their maiden voyage today, but not without issues.
The first order of business was to finish fixing the save game bug that over- or underpopulated ships loaded from a save file. The issue turned out to be in the Star System's "spawn ship" code. It needed to decide whether to load a ship based on a template or a save file, and was always assuming template. Checking if the ship had any objects loaded into it yet was sufficient for solving this, since if we have none, we want some, and if we have some, we don't :)
I solved a few minor bugs after that, to regain momentum. The career screen had incorrect dates on past jobs, and crew could show up as items in the barter screen. So those were fixed fairly easily.
Once those were done, I retried hiring my crew from OKLG and setting-off. However, I ran into issues after getting them aboard. My ship was now considered a station, due to sloppy code during docking. Oops!
On my second attempt, after hiring my crew, they refused to board my ship due to pathfinding issues. It turns out the pathfinding code was using a bitarray to keep track of already-checked tiles (a performance optimization), but this got confused in cases where ships docked, and the bitarray indices didn't match ship tile indices.
The fix turned out to be in the code already, and I had stopped using it for some dumb reason. Basically, each tile has a boolean "are we checked yet?" flag I setup exactly for this, but only used in other processes. Switching this back solved the cross-ship issues with pathfinding. (And for those wondering, this didn't undo the performance optimization. It turns out the pre-optimization code was doing expensive array.indexOf calls every step in nested loops, and the "checked?" flag avoids this, too.)
Okay, third time's a charm, right? Right!
I shepherded my crew to my ship, closed the airlock, requested pushback/take-off clearance, and I was away! Set in the course for the nearest derelict. A mere 2.97 days travel at 2gs constant burn...
And here we are. Sitting in a tin can. For 3 days. Craig, Lindsay, and Brooklyn, wandering around chatting, avoiding eye-contact, attempting to sleep, pooping. So far, the trip is maybe 0.5% done, as we're mostly in real time, or 2x real time.
I've found a few bugs so far. Two different rebuff interactions had bad pathfinding info setup, so AI could get stuck wandering around the ship until manually "jogged" back to reality. I fixed those. Also, there seems to be a bug in my room atmosphere code, which I'm still tracking down. Possibly another save/load bug. Though, save/load seems to be behaving for the most part now, so I can save progress during the trip and resume later.
More importantly, though, I think we've identified a major weakness in the game design. I hoped to make these trips a realistic length ("days" is expected), and have the entertainment come from watching and making the AI do stuff. Kind of like the Sims, only better. Ideally, like watching Firefly until arriving at the destination.
Alas, procedural, needs-driven AI probably won't cut it as it sits now. There's only so much chit-chat worth watching before I want something to do. I didn't actually try anything, though. Which I could have. Force certain interactions. Try to minimize low points in their moods. Hm, forgot about that.
But yeah, this warrants some thought. I can insta-teleport to the destination and deal with this later, as we still have some salvage/sell-off/salvage loops to toy with. And there is also the "plot" system mostly lying unused. But those things are activities at the ends of long trips, so the stuff in-between either needs to be more fun, or less long...