More Bug Fixes While Testing Plots
Hey Folks! Still discovering a fair number of bugs as I test this plot functionality.
One of the first bugs found was when I returned to the test mode without any planets loaded. Since that only has one chargen station loaded, and social contacts was explicitly trying to avoid that station when spawning new people, I ran into a null pointer bug.
I also noticed a few save/load bugs while testing. For one, my AIs had duplicate priorities assigned after being loaded. It was a pretty simple fix, and a nice side effect was being able to remove the redundant data from save files, since it is derived from their current conditions.
Containers were also losing their contents when saved/loaded more than once. And this turned out to be a bug in the way the game loads save files. It was forgetting to log the sub items with the ship when they were added to containers, so the ship neglected saving them later. (The save file is a flat list instead of a hierarchy, and uses IDs to re-attach items to containers after loading. Hence the ship needing to know about sub items.)
Phantom rooms were appearing in the root of the scene graph after loading, and this turned out to be an inefficient bit of code that instantiated unnecessary rooms when loading a ship's save file.
I also noticed my AI would continue to act after dying, and I think this was a regression resulting from my performance optimization. An easy fix, thankfully.
My fridge was erroneously trying to pathfind to its own food before giving it to AI, which was a bug introduced when I added the ability for AI to grab a tool before acting. Not too hard to fix.
And finally, the code that tries to find a new social contact was able to return the same person who was looking in the first place, resulting in becoming one's own worst enemy. Oops.
I also sprinkled a few graphical fixes in while doing the above. Beds now sit on the floor instead of floating. Lights are now spotlights instead of point lights, and have hard shadows instead of soft. (Gained a few fps back from that.) And I changed the dialog UI to just list conditions by name for now, since the descriptions were really wordy and hard to read. Ultimately, this should be a more formatted list, but it works for debugging.
Phew! Not a lot of macro progress on plots, but again, more stability and performance gains. I still have a raft of bugs to be fixed that I just noticed while trying to rendez-vous with my enemy, Handsome Boyd, on his ship SA-X33U. I successfully docked with his ship! But also they drifted apart while docked, so I was unable to undock again due to being out of range?
The fun continues!