Monday, July 6, 2015

Markeen - Some Progress

Today I continued tinkering with Markeen, and got a prototype working to some degree. The first thing to do was get a fill pattern going, specifically the inward spiral. The first test didn't do any random generation; it just used tile ID x * y so I could make sure the spiral hit every spot.

The pink section to the right consists of tiles past the end of the tileset, which Abiathar displays as their hex value.
I then wrote the actual random generation code, selecting each tile based on the existing ones next to it (the level edges count as special tiles). If a combination of surrounding tiles was found that didn't allow any tile to be placed at the current position, the spot was marked as bad and a 3x3 centered on it was erased. I had code to do extra passes if such problems were encountered, but that didn't work at first.

The pink splotches are the errored regions, consisting of tile $FA17
Parts of coherent level could be seen at this point! I knew not all of those error tiles could be contradictions, so I bypassed the part of the code that erases surrounding tiles so I could see what was actually generated:


Lots of correctly-formed platform structures were placed, but they didn't form a coherent whole; it was trying to generate several different blobs all on top of each other. Keen 5 was making this difficult by having three types of platforms that don't fit together, so I tried it on Keen Dreams, which has fewer tile types:


Every Dreams level I generated looked more or less like that, just a bunch of platforms floating over a void, plus world map borders sprinkled in the blank areas. I suspected that the problem might have to do with the fill order, so I tried swapping the spiral out for an expansion from the lower-left corner up to the upper-right. That produced more or less the same problems as those seen in the spiral. While I was at it, I also wrote a fill order selector that fills the points on the level in a random order, one that fills from the bottom up one row at a time, and one that can switch from a starter fill order to a primary one after a certain number of spots. Tinkering with those led to some actually interesting maps, such as this one made by starting with random generation for 30 spots and then using corner-to-corner:


It then occurred to me that one very rarely wants a level to have multiple styles of platforms. So I created a profile from only one level at a time. (That had the good side effect of not including world map tiles.) I also tried introducing an "originality" constant that can increase or decrease the chances of less common tiles being used. Using a profile from the Security Center in Keen 5 and setting the originality constant to crush the minorities, I got this level:

It could actually be made usable after a bit of cleaning up and decorating.
From the Regulation Control Center's profile.
From Defense Tunnel Vlook's profile. A bit too much solid metal, I think.
I think I need to explore higher-order chains or more intelligent erasure routines before I can make anything more interesting. However, it has been able to successfully repair existing levels after I scribbled over them with $FA17 (the unfilled/"come back and fix this" tile). Progress has been made!

No comments:

Post a Comment