Performance, Orbit Labels, and Social Contacts
Hey Folks! More work on performance optimizations today, along with some orbital plotter and social contact work.
Early in the day, work continued on the optimizations. And I was able to find a fairly big one: pathfinding. It turns out that my pathfinding code was using a fairly expensive array IndexOf operation, since the type was an object (Tile) that required boxing/unboxing. (Particularly in large ships with thousands of tiles.) Since I was only doing this to see if the tile had been checked yet or not, I just switched that info into a BitArray and checked that instead. The resulting performance gain was pretty pronounced. A check used to take 300-400ms on a ship with 3000+ tiles, and the optimized code took only 30-50ms.
Not perfect, but a big enough change to move on to other things. And since I couldn't find any other quick/big wins in the performance profiler, I decided this was good enough to resume work on the game itself.
In the process of testing plots, I was finding I lacked certain info to verify they worked. Some of this would be just debug info. But several of these might find their way into the players' hands, since they seem like things players would want to know.
One of the big ones in that latter case is orbital labels. Unless you had the System memorized, it was hard to tell what you were looking at. Especially at high zooms. So I added registration ID labels to each station and ship on the screen, sort of like what a pilot or air traffic controller might see. You can see this in today's screenshot of the Mars system. Hangzhou (MHNG) is out there in a sync orbit with Mars, while Tharsis Landing (MTRS) and The Labyrinth (MLAB) are down on the surface. MVOL, however, seems to be sitting inside Mars. This seems to be a bug, as the station is meant to be on Deimos (the second moon).
Another big help in testing all this would be some way to view social contacts for an AI. Who does it know? What are their relationships to them? And where are those people now? I've started making a crude UI to show this info, and I plan to be able to pop it open on any AI I've selected.
I have a feeling some form of this will make its way into the final build, too. However, current location might not be known. And, of course, it'll need a nicer presentation.
That's all for today. Hopefully, I'll have the social contacts UI running tomorrow well enough to resume work on the plot system!