This House Be Jumpin’
In my continuing quest to re-work my data structures into Scriptable Objects, I had to create a UI for managing jumpgates.
These buggers are a real PITA to visualize because they exist in a specific sector, but lead to another gate in another sector. That means there has to be linkage between two gate IDs. When I was working this all out in Excel, it was easy to line up one gate with another simply by cross-referencing origins and destinations and making sure that all gates lead somewhere. Once I had a rough UI in Unity set up, however, everything was numbers, numbers, numbers, which didn’t tell me anything at all.
So I spent a while (a long while) trying to get all fancy with the Editor library to create an editor window that masked the IDs behind their textual counterparts. In the screenie above, you see a listing of jumpgates. Each has a name (which I added to support the popup selection), the sector the gate resides in, the sector the gate leads to, the gate the gate leads to (because players will need to pop into a system somewhere, right?), and the toll cost of using that gate. The editor portion sits outside the scrollable area. The Sector and Destination Sector popups source from the current list of sectors. The Destination Gate popup changes based on the Destination Sector selection so the user can only select gates within that sector.
Currently, it’s working about 80% as intended. The Destination Gate in the list doesn’t translate to a name, and I just ran into an issue where changing the Destination Gate doesn’t actually change that value.
Working with the Editor namespace has proven a bit of a challenge. It seems like there’s a lot of times when Unity just starts flipping out and refuses to reflect changes or honor code logic for seemingly arbitrary reasons. I have to shut down Visual Studio and Unity to reset everything, and after that it’s fine.
Now, the ideal editor would take my Sector, Station, and Jumpgate UIs and meld them into a node editor. This would allow me to set each Sector as a node, and connect the Sector nodes to create Jumpgates. Each node could then contain information about the Stations within that Sector. If I could somehow pull that off, I could visualize the entire game map, complete with routes and interconnecting pathways, to make management significantly easier. I do have some parts of code to work with node editors, but considering how long it’s been taking me to work with the Editor namespace, I’m thinking I could spend another year just working on data management tools (again!), which would keep me from making any progress on the game itself. Good enough will have to be good enough for now.