Ship Editing Fixes, and OKLG
Hey Folks! I decided to start working on a more representative station layout today. Mainly, this is to get ready to test the bartering and NPC spawning stuff, but it also gives me a chance to find and fix any remaining issues resulting from the migration of the ship editor into the simulation mode. And boy were there some of those.
One minor issue I encountered was just in the data. Air pumps had an inaccessible use point, so NPCs got stuck trying to reach them. That was an easy fix, and allowed me to verify that edits to the machine's settings in ship edit mode persist into gameplay mode. Also as part of this, I finally switched food packets to be 1x1 grid squares again, instead of the giant 2x2 mostly-empty-space ones I had for some reason.
I wanted a new micro reactor for use on stations. Basically, so I don't have a ton of space and processing wasted on something that the player doesn't need to see. So I set about making the item for it, and ran into an annoyance I keep having to deal with: each new item assumes a normal map based on the diffuse map image, and I'd like to be able to specify this manually in cases where I can just use an existing one.
So I changed items to support explicit normal maps. I also cleaned up the data a bit by giving the data class a constructor with default values, so I could omit null and empty array data from the file. (Something like 200 fewer lines of data in the file now.)
I fixed a divide-by-zero bug in the reactor code when the exhaust velocity is 0. This was mainly due to the station reactor having no thruster, but I think I've run into this a few times in flight, too.
There was a selection order bug, which deleted floors out from under items when I tried to delete an item over the floor. This was an edge case I forgot in the selection code, and is fixed now.
There was also an endless loop similar to the one I found a few days ago: endlessly spinning items around trying to get an exact rotation. It turns out the same code was used in a few places, so I finally plugged all those holes.
And there was a bug in the airpump that prevented it from switching on when powered. Was just a typo in the mode switch loot.
In the end, I got as far as the image above. A large atrium space with a bank of gas vessels and pumps, and the new micro reactor. Plus a handful of shops, each with back rooms, and a trio of docking gangways, each with a docking services kiosk.
I also added lighting to it, and ran into the old performance issues I've struggled with in the past. Each of those lights costs a bit to run, and having the entire station on-screen when zoomed-out tanks the framerate. I may have to accelerate plans to revamp the rendering to use something cheaper than Unity's real-time, shadow-casting spotlights. (I could maybe just switch off shadows for now, which might be the fastest way until I get a better solution.)
And that is where we stand now. It's far from the final station layout I'd like to have. But the old station needed a little more room. And this gave me a chance to stress test both the editing and rendering a bit to expose problems I've overlooked in the last few major overhauls.
Monday, I should hopefully have a chance to tackle the NPC spawn rules, barter zones, and try docking with some goods to sell. Then...profit?
Have a good weekend, all!