ldtk icon indicating copy to clipboard operation
ldtk copied to clipboard

Unordered level identifier patterns

Open Trouv opened this issue 3 years ago • 0 comments

Problem

All of the "modules" available to add to the "default level identifier" pattern are very sensitive to certain level changes. In particular, they are sensitive to level insertion, and level rearrangement. These options are good, but having no "unordered" options that aren't sensitive to these "level order" changes makes it so more levels are affected than necessary. This can be annoying when it comes to version control of external levels.

For example, say I'm working with a horizontal world layout, and I'm using external levels, and I have LDtk set to automatically generate all the level identifiers via the default level identifier pattern. I want to insert a level halfway through the game. No matter what default level identifier pattern I'm using, I will find via git diff that a new level file was added as expected, but also that all of the level files that come after it changed too, thanks to their level identifiers changing. This makes the diff dirtier than it needs to be, and makes conflicts likely when level designers are working on different branches. Rearranging levels will cause similar headaches.

Proposed solution

I think the simplest solution would be to make "level iid" a module that you can add to the default level identifier pattern. Since iids aren't affected by level order, it allow users to design level identifier patterns that aren't sensitive to level order changes, making version control and collaboration nicer. It's not ideal since using uuids to identify levels isn't very human-readable.

I think the ideal solution, in addition to making iids available for level identifier patterns, would be to make custom level fields (string-only) available to level identifier patterns. In my case, I would have the level identifier just be the identifier-formatted version of my level's "Title", which I store as a custom level field. It seems LDtk already has some logic to auto-format identifiers, so it could just apply these rules to the custom level field's value before saving it as the level's identifier (while still allowing the field value itself to be free from these rules).

Trouv avatar Sep 03 '22 19:09 Trouv