By layering using alpha blending, however, a certain tile transition doesn't 'care' what adjacent terrain it is transitioning into; the blending takes care of that, gradually fading out from one and into the other. The general case of transitions is solved this way, as each tileset above the base (lowest level) layer needs only provide it's own basic set of blended transitions, which are then calculated and stacked as needed. I've hard-coded a limit of 8 terrain types into the engine, and this is a number I am very comfortable with. If a level is complex enough to require more than 8 types of terrain, perhaps a different engine altogether would be more appropriate.
With skillful artistry, even these rather bland alpha-blended transitions can be made to look very nice; I still lack the skill (or, at least, the patience) to do so for every tileset or demo I make, so I constructed a default, generic greyscale mask which can be superimposed as an alpha channel onto a set of tiles, to generate a set of transition blends. It has all of the necessary permutations required by the Accidental Engine's translator, and while the transitions it creates are rather uninspiring, for the purposes of this engine (which, after all, is meant merely to be educational) it will do. A 'standard' tileset, then, might look something like this:
The 'checkerboard' is Gimp's way of showing transparency. In a full set, there are 46 different blend configurations to take into account any possible pattern of neighbors for a tile. The in-game results are, of course, fairly non-spectacular--but more flexible:
I'm doing a little tweaking on some of the internals as well. Until now, the engine has made use of a set of standard flags per tile, such as BLOCK_WALK, OFFLIMITS, etc... I'm making the flags a little more generic; BLOCKWALK and friends are still there, but I'm expanding out OFFLIMITS into a class of flags that can be utilized in any way the builder script sees fit. OFFLIMITS formerly had special significance, in that the engine itself would aggressively protect any tile so flagged, so that any subsequent attempts to set wall or floor on that tile would fail. That aggressive protection has been removed; scripts can now arbitrarily assign a bank of generic flags, but it is up to the script itself to protect tiles that need protecting. Certain parts of the script can flag certain tiles using a particular flag, and it is up to the script to interpret what other parts of the script can or can not touch those marked tiles.
I've also been tinkering with the documentation to reflect the changes to the interface. As well, I've got a stack of miscellaneous images I'm planning on 'propifying'--barrels, crates, rocks, torches, etc... mostly old stuff from the original Golem which is just taking up harddrive space, so I might as well put it to work. I'm getting close to the cut-off point as far as engine features for this thing; the point where I'm not going to try to implement more features. While I might fork off the engine and construct an actual game from it; this main branch of the code, at least, will remain relatively stable. Once I have all the bugs and issues ironed out, and whatnot.
I've been playing with ideas for the next article. It'll to some extent build on Squirm's tutorial, utilizing some of his fractal methods, but I'll also delve into some of my methods for generating various types of cave and cavern environments. I've been digging out all my old code, and playing with some new code as well; hopefully in a week or two I'll have something presentable and sensible. The new code has to do with accretion fractals, which can be very cool.
Fruny and I briefly discussed an idea for conceptualizing a map or level as a connected graph, working out the node or room connections before attempting to 'project' the level onto the 2D plane of the map. I've been playing with some things on paper to see how that works, haven't coded anything yet. The idea has merit; but the actual translation from an abstract connected graph to a physical layout of rooms poses some unique challenges.
I've had people ask me why I picked the name "Accidental Intricacy" for the name of the website; the answer is: I didn't, not really. I fed a bunch of synonyms for "random" and "labyrinth" into a random generator, and used the first result that didn't sound too stupid. I figured it was only fitting to use a pseudo-random algorithm to choose the name. [grin]