Tile Data and Painting
Hey Folks! Hope everyone had a good weekend. We are finally starting to see cooler weather and even some rain here, which is very welcome after a hot and drought-like June!
Today's work almost entirely focused on some new tile data I've been working on. Basically, I want to create some rules for how tiles can be set, so the engine can help users create viable ship hulls more easily. E.g. if the user places a row of walkable floor, the engine will line it with walls, capping corners and adding intersections as needed.
The idea isn't necessarily to make the computer into an architect, but it should at the very least reduce the burden on the user to do the tedious work of adding wall corners, edges, and other features that are byproducts of their layout. Basically, the user paints broad strokes, the computer validates it with finer strokes, and the user can then later fine-tune things to their preference.
To make this work, I've created a new tilemap graphic with walls, corners, and intersection pieces. I've also created an xml file that describes how these tiles should intersect. E.g. walls need to line-up, floors must have walls around them instead of empty space, etc.
Most of the day was spent finishing this xml data, and then writing the code to parse it and apply it during painting. As of the end of the day, it's actually working! Sort of.
I can paint tiles, and the computer is figuring out how to surround it with tiles that have the best "score" for following rules. The trouble is, when one is starting out painting in the void, all surrounding tiles are empty. And the best fit for empty is, you guessed it, empty.
Tomorrow, I'm going to need to look into the auto-tile stuff to see what can be done. I could try applying a higher priority/score to tiles that fit the just-painted tile, or maybe simply prefer non-empty tiles. Only testing will tell us in the end.
I'm looking forward to it, though. I like when small code changes make big differences on-screen, and this definitely qualifies!