From Newsgroup: comp.sys.cbm
On 9 Jul 2003, Chad Alberts wrote:
I am working on a dungeon exploration type game and need some help
with a random level/map generator. Each level will fit in a 40x25
character screen and will consist of various sized square rooms that
are connected by hallways or even other rooms. I would like at least
some long twisting hallways that can also maybe vary in width.
Hopefully the generated level will be something interesting but also
natural looking.
How would a program go about spacing out the rooms on the screen and
making sure there are connections for every door and also creating interesting and elaborate pathways to explore in the dungeon?
Thanks for your time....hope someone can help with some insight on how
to program this.
Chad
You have numerous of ways to accomplish the spacing... You can start
thinking making it a big hall, adding partition walls each direction you
need, with widths between 3 to 20 'meters' for example, then place a door 'hole' to the walls testing that there is no wall or empty space against
the door place. In your game engine, you may want to number your rooms and their doorways to each room you want. The number can be then used for
initial luggage, room colors, ground textures etc. whatever you have in mind...
Also think about constructing the rooms of certain sized 'aircubes' (or
a grid) and connect them like 'Tetris' game blocks. This way all room
has enough space.
Another way you may want to create certain sized rooms (without doors yet)
and try all possibilities out or find a combination they fit both tight
and wide areas (long corridors etc)
You could also try creating a mathematical algorithm to find the
combination for 'different weight' rooms and connecting the doors some
simple way, later you rotate them to fit the screen.
Yet another way is to place the room without caring the place in the
screen, and puzzle the room appearance by overlapping. With just
numbering the rooms behind each door, just replacing the room doors to
fit the screen, highlighting only the most recent visits, the playarea
could look infinite... :)
--
Agemixer/Skalaria - "First run, then load."
email:
agespam@japo.fi pass: "C64 mailinki" to the Subject: line
Spam filter is on
--- Synchronet 3.18b-Win32 NewsLink 1.113