Sunday, July 5, 2015

Markeen: Random Keen Level Generator

Today while relaxing after completing a large-ish essay, I started a small project called Markeen. My goal is to be able to randomly generate levels for any Keen Galaxy-ish game. This will be accomplished by profiling an existing set of levels to determine the probabilities of each tile appearing next to every other possible tile, then using those probabilities to build a new level. It's kind of like Markov models for text, hence "Markeen".

I wrote the profiler already. It stores the average level dimensions and the standard deviation for each dimension's length. Most of the profile data is in the tile frequency section, which has a record for each tile, containing the tiles that can appear to each side and their instance counts. The file created by the profiler is surprisingly small, only 128KB for Keen 5.

I started writing the level generator, but I'm still trying to decide on the order in which the level will be filled and how to back up if an already-generated combination of tiles would require an illegal (unseen in the original game) arrangement of new tiles. I think my strategy will be to fill the level in a spiral pattern starting on the outside and going in. Contradictions will be addressed by deleting a swath of tiles around the problem area and regenerating that section.

No comments:

Post a Comment