Week 58: Autotiling with corner-type annotations

A diagram showing how the tileset art for a quadrant might change depending on the shape of a neighboring corner within the same subtile.
  • The tileset art for a quadrant might change depending on the shape of a neighboring corner within the same subtile.
  • Depending on how much work the tileset author wants to do, they can omit many possible subtiles, and my corner-type-matching system will construct subtiles using the best-matching quadrants.

A diagram showing how the tileset art for a quadrant might change depending on the shape of an adjacent corner from a neighboring subtile.
The tileset art for a quadrant might change depending on the shape of an adjacent corner from a neighboring subtile.


tl;dr: I'm still working on autotiling; I added support for parsing a separate annotations image in order to configure the corner-types for subtiles from a corresponding tileset image.


What happened last week?

Highlights

  • I continued creating a custom autotiling system.
    • I added image parsing in order to configure subtiles (and their quadrants) according to their corner corner types which are drawn in a separate image file.

Laundry list

  • Continue implementing my new corner-type-annotation-image tileset system:
    • Finish creating a legend for the tileset corner-type annotations.
    • Encode all remaining 90-degree and 45-degree corner-type enums.
    • Update target-corner-type matching logic to support the full set of 90-degree and 45-degree subtiles.
    • Remove obsolete getters from CellProximity.
    • Add some missing corner-types to the legend and to the enum list.
    • Create a corner-type-annotation-key image.
    • Implement corner-type-annotation image parsing.
      • Add support for parsing inbound-neighbor-corner-type annotations.
      • Add support for checking that all non-annotation-corner pixels are empty.
      • Add support for both encoding and decoding corner-types-flags for a given quadrant.
      • Add support for parsing corner-type annotations from subtile corners other than the top-left one.
      • This involved flipping pixels horizontally and vertically.
      • Add support for swapping some corner-types when the quadrant is along the bottom of the subtile.
        • I need this, because I named some corner-types as vertical-reflection-agnostic—such as EXT_90H or EXT_90V—but I named others in such a way that the the corner-type changes when the annotation is reflected vertically—such as EXT_45_FLOOR and EXT_45_CEILING.
      • Add support for parsing inbound corner-type annotations. 
    • Update subtile-configuration to be set-up using the same global manifest pattern I use for the rest of the framework.
    • Add automatic tile-set property initialization for corner-match autotiling.
    • Add automatic quadrant collision and occlusion shape assignment for corner-match autotiling.
    • Decouple initialization and quadrant-shape-calculation logic from the corner-match-autotile tile-set class.
    • Invert the class-extension relationship between my old SurfacesTileSet and my new CornerMatchTileset.
    • Cleanup the naming of my new corner-type-match-autotiling tileset scripts.
    • Fix individual-tile-set configuration to happen via the app-manifest and a tile-set-id on the resource, rather than requiring a tile-set subclass.
    • Add better debug-logging for tileset image parsing.
    • Debug tilset image parsing and the tileset corner-type annotations.
    • Add support for skipping empty subtiles when parsing the corner-type annotations.
    • Debug corner-type quadrant shape calculations.
    • Restructure tile-set directories.
    • Create a CornerDirection enum and replace my old mix of string keys and is_top/is_left flags.
    • Dedup collision-shape and occlusion-shape instances when calculating tileset shapes.
    • Move scripts and assets into a separate surface_tiler directory.
    • Refactor tile-set configurations to use some separate configs for individual tilesets rather than all global.
    • Refactor corner-types-to-quadrant-position mapping to use nested dictionaries instead of a combined corner-types int flag.
    • Create a separate class for holding target-corner state and logic, rather than using Dictionary structures within the tileset class.
    • Move more tileset logic out of the tileset class and into the manifest class.
    • Add logic for calculating the positions of the quadrants that best match the target corner-types, while considering fallback corner-types.
  • Miscellaneous:
    • Update error logging to require an explicit message.
      • I have a custom print and error logging instead of using `print` and `push_error` directly.
      • This lets me view the console output in environments like a mobile device.
      • The error message used to be optional.
      • However, I changed this to require an explicit error message in order to disambiguate where the error actually happened.
      • This is needed because stack traces are not available on non-main threads, which makes debugging very difficult.
    • Fix some tilemap position utility functions.
A legend for all the different corner types and their annotations.
Here's the latest corner-types legend with corner-type annotations included.

What's next?

  • Continue creating my custom autotiling system.
    • I should have the complete system working in the next couple days for 90° and 45° cases.
    • Then I'll add 27° cases.
      • There will be a lot of new cases to add for this, but adding them shouldn't take too much time, relatively, since the rest of the system is implemented now!


🎉 Cheers!


This is a simple icon representing my sabbatical.

Comments