It’s been a while since I posted a true development news–more than two months in fact–and it’s time to rectify that!
Internal System Map
One of the most important changes in the new update is also one of the most boring to explain. In the current version, a ship’s systems are stored in a one-dimensional list. If the game needs to find the system at a particular tile (in two dimensions), it needs to go one-by-one down the list and check each system to see if the tile is within its boundaries. This worked fine when systems were large and few, but now that there are potentially hundreds of tiny free-form systems, there is a much longer list to go through. I found that this caused the game to lag, especially when painting a large area.
The system map fixes this problem. What is the system map? I’m glad you asked! The system map is a two-dimensional grid corresponding to the tiles in your ship, with each tile containing the ID number of the system which occupies it (or -1 if it is empty). When you place a system, the map is automatically updated with its ID number in every tile that it covers. This way, the game only needs to check the map to find the ID number of the correct system, and can then jump directly to its position in the list. This cuts out a lot of unnecessary operations, and thus significantly reduces lag.
New Ship Editor
Part of the reason I mentioned the system map is that it enables an important feature of the new ship editor: continuous painting. In the current version, placing multiple systems requires repeatedly clicking. Again, this wasn’t a major problem with large, fixed-size systems but it quickly becomes infuriating with free-form ones. The new ship editor allows you to paint continuously by holding down the mouse button. “But that’s so obvious!” you say. “Why didn’t you do that already?” The main reason was to do with the system-list lag mentioned above. Because each system needs to check that every tile within its boundaries is empty before being placed, it used to require that laggy one-by-one list checking. As I discovered when I first implemented it, this made the paint function painfully clunky. Now, thanks to the system map, the check can be done fast enough to make painting as convenient as it was intended to be.
Oh, right, I haven’t actually posted a screenshot yet. Let me fix that:
You’ll note a few things about the new editor:
- The construction area takes up the entire screen, with the tools being small objects on top of it. No more tiny viewport limiting your view to a ninth the size of the construction area.
- Hotbar to quickly switch between tools as well as interior/exterior views.
- Systems list is large enough to show the full name of the systems, and has them organized alphabetically.
That’s all for now! I’ll keep working though so I have more to show before another two months has passed.