Docking, Plots, Bugs, and Performance

Hey Folks! A pretty wide range of coding work today, as I tackled a series of smaller tasks that should hopefully add-up to more stability, speed, and easier game testing.

Earlier in the day, work mostly involved fixing bugs. I set the docking range to 4000km so I could dock more easily to test plots, started a new game, and immediately hit a few bugs. First, I had to add code to prevent new social contacts from spawning in-station with me while I did character creation. Since, basically, they'd be destroyed as soon as I finished :)

There were also a few null pointer bugs involving social contacts without careers, destroyed door references when they change state, and missing homeworld info when a new social contact is created. Easy fixes, but each interrupted testing and required me to restart after fixing.

I then hard-limited the plotter zoom to a max amount that lets you see docking range, but not much closer, as that tends to get jittery. Plus, I fixed the new ship spawner to choose random places in-System, instead of the center of the Sun.

Once those were done, I was actually in my ship and flying around! I plotted a course to MTRS, where my friend, Natalia, was a bartender. I wanted to see if that plot worked. Flying there worked pretty well despite it being over a month since I last flew. However, my new labels on ships needed code to destroy them when the UI closed, as I was getting copies piling-up each time I opened the UI. Also, I still had a problem with AIs abandoning the nav console before I was done flying.

Back in the code, I added the label clean-up, and increased the nav console interaction to last 100 hours. That should exceed any amount of time an AI can survive sitting at the console :)

Starting a new game after all of these tweaks, I set off for a bartender on SVIR. He was my enemy this time, but I wanted to see if it would work. It didn't, as the game chose him as the target, so another bartender must have the plot. (On Venus or a deep-space vessel, in this game.) Still, while I was there, I noticed a huge performance drop in the plotter, so I dove into that to see what was up.

It turns out I had a lot of empty Update() calls in my tile, item, and spritemesh classes. Like thousands of calls per-frame, chewing through a combined 5ms of wasted time. I yanked those out for a few fps, then found a another bottleneck in my plotter draw code. Lots of instantiating new matrices, quaternions, and vectors for each draw call on each body/ship, for each projection step. The rest of the code looked pretty clean, but making those calls reuse as much as possible shaved another couple of ms.

And that's where I am now. I still need to verify this bartender plot, and that might mean debug spawning some things instead of waiting for the game to organically spawn them. I always seem to end up with too many bartender contacts upon game start, and choose wrong when visiting one.

Despite that, it was cool to be able to fly around again, and dock successfully a few times! I even noticed my AI getting sleepy at the console during one trip, and was tempted to force him to sleep. He was due to arrive in a couple hours, though, so I didn't bother :)

Comments

Malacodor's picture
Malacodor

Working on the console 100 hours straight? Totally doesn't sound like crew exploitation. ;-)

Ran around with a clown mask before it was cool

dcfedor's picture
dcfedor

I think that after 72 hours of no sleep people start hallucinating, so anything past that probably doesn't matter :)

Dan Fedor - Founder, Blue Bottle Games