Sunday, July 12, 2015

Markeen - Eager Generation

Today I implemented eager generation of rare structures for Markeen. I consider "rare structures" to be arrangements of tiles such that starting from any tile in the structure, there should be a 100% chance that the full structure be formed. For example, multi-tile decorations such as the exit sign must always appear whole; it doesn't make sense to have one corner of the exit sign floating somewhere. The fuse structures in Keen 5 are similar examples. On the other hand, platform structures of a certain length are not "rare structures" because those tiles can be arranged in multiple valid structures.

Eager generation of valid structures is important because fill orders lacking it tend to cut off such structures (other tiles have encroached upon the already generated part of the structure and made it impossible to continue generating). My current implementation checks to see if the newly placed tile is compatible with exactly one tile on each side and, if so, places the only possible companion and repeats the process for that new tile.

Results so far are encouraging, but there are some problems. It's possible for the eager generator to be "too late" if tiles have already been placed that block the outgrowth of particularly large structures. Also, this algorithm generates rare structures far too frequently - the fuse box from the Regulation Control Center appears at least once in literally every Keen 5 level I've generated.

Except this one. (But I had to go through dozens to find it.)

No comments:

Post a Comment