grunt-lucas / porytiles

Overworld tileset compiler for Pokémon Generation 3 decompilation projects
MIT License
30 stars 3 forks source link

Almost-identical metatile warning #53

Open purrfectdoodle opened 1 month ago

purrfectdoodle commented 1 month ago

Let's say I make a signpost metatile on my primary set on the middle layer. Its bottom layer is grass or something. Now I have a secondary set that's got some special orange grass, and I put that same signpost in the secondary set on top of that orange grass. Then at some point I edit a pixel or two on the signpost on one of the two sets, but at this point I've forgotten about the identical signpost on the other set. I have no idea how easily doable a warning when two metatiles (16x16) are almost identical but not quite would be. A "hey are you sure this is intentional?" sort of thing.

grunt-lucas commented 1 month ago

It's very doable actually. There's this concept in text processing called Levenshtein distance. If I can come up with a clever way to represent a particular metatile layer as text, then I can probably use something like this to warn the user when it detects two tiles that are within a certain distance threshold, as that probably indicates a user mistake of some sort.