• entries
    436
  • comments
    1179
  • views
    763196

More of the accidental stuff.

Sign in to follow this  
JTippetts

492 views

Been doing some tweaking on the Accidental Engine. Added the ability to load specific tilesets (working on wallsets now), and implemented a layers system similar to that featured in the Golem3D engine, which alpha-blends successive terrain layers on each other to generate terrain transitions on the fly. It's somewhat more bland and boring than transitions created by hand, but it eliminates the exponential explosion of transition tiles needing to be fashioned for a completely general world. For a world with only grass and dirt, for example, on one set of transition blends needs to be structured--blending from grass to dirt, of course. Add water, and you've got 3 sets that need to be constructed. Add another type (mud, or low water, or something to that effect) and you've got 6 to create. And this doesn't even take into account the wierd situations of blending three or more tilesets together on 1 tile. With traditional transition tiles, this task quickly gets out of hand and becomes impossible to solve without imposing some wierd constraints on terrain.

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]

kthxbye
Sign in to follow this  


3 Comments


Recommended Comments

Thanks, Oli.

There's really nothing technically or artistically spectacular about this engine. I'm not breaking any new ground that I've never done before. The fun lies, I think, in the tutorials and articles that go along with it. The engine itself is rather mundane; but it does give me a platform from which I can hold forth at great and excrutiating length. [grin]

Share this comment


Link to comment
Exactly. Once you have the groundwork out of the way you can concentrate on the 'fun'. I'm impressed by the small community that's already started to build around this ;)

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now