Re: [CODE]Random 'maze'?

From: Daniel Koepke (
Date: 01/04/97

On Sat, 4 Jan 1997, doppsoft wrote:

> I am curious.....after seeing the question on random placement of 
> objects, I was thinking of some other random code, but I'm not sure how 
> to implement this...Random exits within a zone.  I know that there is 
> such a thing as a maze making algorithm to make sure that there are no 
> 'stranded' room (no exits) and to make sure that you can get from one 
> place to another.  It would be the same algorithm used to generate the 
> 'universe' on the old BBS game Trade Wars 2002.  If someone could get 
> this algorithm, it could proably be modified to make a random zone.  The 
> idea is, have the zone reset only be when empty, then have built into the 
> zone reset it being a 'random' zone.  THis could make things fun.....sort 
> of a labyrinth that keeps players on their toes....or to make it even 
> harder....make it so that the zone doesn't wait to be empty to reset and 
> change >:)
> Excuse my ramblings, I'm mostly just looking for the code for the 
> algorithm....I know that it took about 5 minutes on a fairly slow 
> computer to do 1000 rooms, so 100 rooms would probably take about 10 
> seconds....if that.

Taking all of the above into account, you could mimic that by having
a zone full of rooms.  Each room would be flagged as ROOM_MAZE or
something to that cause.  Afterwhich, when these rooms were loaded,
their exits would be randomized [even though in the .wld file they'd
have no set exits], by simply picking another unused room and setting
an exit to that direction.

Thinking about it, you'd probably want to first go through each of
the 100 rooms and free their exit structure.  Then go through them
again, creating the exit structure if neccessary and adding unique
exits.  This would be done so that you don't retain the old exits
from the previous incarnation of the labrynth, but you do keep the
new exits made to that room [and, thus, you don't make one-way
links anywhere].

If we only randomly add exits and in random directions, we should
implement dead ends, too [eg., rooms with only one exit]...

Heh, that'll make it a maze, alright, and maybe keep some logic to
the zone (maybe even make it mappable).  Now, if you want to be
really wicked, through in a chance to make some dead ends literally
DEAD ends by setting ROOM_DEATH on them... :)  Maybe set a collectio
of connected rooms as ROOM_TUNNEL to make it difficult for groups
to stick together...  Throw in some random wandering mobiles that
are aggro, maybe random events that act like "random encounters" so
that they encounter spirits, or rock creatures, or anything else
of your wicked design.  If you've ever bothered to implement traps,
or just want to, this would be one good reason to.  That way, you
have an ever-changing maze of death and mayhem, where no-one has
an advantage for long.

To give the labrynth a really ominous feeling, every room should
be dark and you should position rotted corpses, body limbs, etc. all
over the place... :)

Am I getting carried away, here?  I realize not many people take
features to these extents, but if you were to, that'd be one helluv'
a zone for high level players (to keep the boredom down, you know).
I'm probably one of the few people that would ever bother to overhaul
the 'armor' spell... :P

Daniel Koepke
Forgive me father, for I am sin.

| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   |

This archive was generated by hypermail 2b30 : 12/18/00 PST