Posted April 13, 2020 by Dominas
Hi all!
In this update we took a big step towards stability and validity of what we call Layouts. They are data structures that hold information of what Zooids and where they are grown. You might have seen us call them Blueprints too - coders in our team love playing Factorio and that's where from the term initially came. Once we added Aquarium and Layout sharing we wanted to go towards something a bit less technical and we came up with the term "Layout".
When we first coded layouts we wanted to have an easy way to store Sipho templates which could be later used for defining enemies. We would take a snapshot of current player Sipho Zooid positions and save them to a file. If we did that carefully, no position deformations would be stored. We could also later retouch those layouts by hand if we wanted to have Zooids in unusual positions or fix slight offsets that were captured. This wasn't ideal, but it worked for that time being.
Later on, we had to add saving system and save your being-played Layout to not lose it. This was important because one of the cornerstone aspects of this game is player creativity and our task to foster it. It feels very punishing to spend several minutes in Growth mode and then later find part of your Sipho cut-off and destroyed never to recover. That's why we implemented automatic Zooid regrowing.
Then Aquarium came and we allowed manually saving your Layouts. Even though Layout sharing is possible right now through text strings, we didn't pay much attention to validity of saved Layouts as they would mainly be used "for your own purposes" and if they were clean enough for you, we were happy too. Layouts could still be deformed due to physics and saved Zooid neighbours didn't matter much as we re-collected them when growing back from Layout. We did, however, try to fully undeform Sipho when entering Growth mode to preserve somewhat correct Zooid positions when re-capturing Layout. Potentially we might not even need to undeform in the future if we fully transition to Layout-based Growth.
With introduction of Buffer Zooids like Greaser and others importance of connectivity to neighbours was highly escalated. Wanting to buff certain Zooids with Buffer Zooids and seeing them regrow differently was not what we wanted to have as experience - growth should be deterministic and have the same results every time. That didn't come without fun little exploits where it would be possible to attach up to 6 Buffers to the same Zooid and cause some real ruckus.
This update finally addresses major inconsistencies in Layout creation:
All of your existing Layouts will be upgraded to re-gather neighbours according to saved Zooid position and rotation. Invalid Zooids will remain in Layouts but will be ungrowable - they will appear as Zooid ghosts and will help to fix invalid Layouts.
Now that Layouts are almost independent of your Sipho deformations and can be fully trusted to be valid we will be hosting Layout creation contests to populate upcoming depths.
This huge undertaking was made easier with making use of testing discipline. I have personally noticed that some things require quite a lot of mental power to get started worked on each day - math heavy code, complex code hierarchies, data manipulation. After spending several evenings just to get started on modifying Layout code I decided to write some basic tests to have confidence in different parts of code. With that confidence it was then easier to work on other parts which seemed to be incorrect or harder to test. Now each time I notice that something will require some time to work out how it works or if I catch myself wiring debug messages just to test I consider writing a test instead. That is why you might notice terms "test" in future changelogs. We had tests before, but just now I encountered their real usefulness for existing code. Check'em:
Version 0.6.4