Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Fun with dungeon generation in qbasic

16 views
Skip to first unread message

R. Alan Monroe

unread,
Feb 16, 2002, 6:00:31 PM2/16/02
to
I wondered what it would be like to do a random dungeon by repeatedly
placing random sized "L" shaped hallways, each with a random 90 degree
orientation, all over the map. Here's the results.

This method doesn't guarantee that all areas are reachable. You get a
lot of cul-de-sacs, which could be good or bad depending on your
game...

[fixed width font]

#####################################################################
#####################################################################
################### ####### ######### ####### ########## # ##########
################### ### ### ######## ####### ### ###### # ##########
######## ######### ### ## ### ### ##### ### ###### # ### ######
######## ## ## # ## ## # # ######
######## ## # ### # ## ## ### ## # #
##### ## # # # # #####
#### #### # # # # ### ## ## # # #####
###### # # # ## # # ## # # #####
#### ## # ## # # # # #### # # # #####
##### # ### # # ### ## # ## ##### #######
##### ###### # # # # ## # ## ### ######
##### ## #### # ##### ###### # #####
##### # ############ ##### # ## # # ########### ########### #####
##### ############## ########### # ########################## ######
###### ########################## ############################ ######
#####################################################################
#####################################################################

#####################################################################
####### #################### ################################ #######
####### ################ ### ### ############### ########### #######
####### ############# ## ### ### ## #### # ##### #### ###### #######
####### ######## ### ## ### ### ## ### ### # #### ## ### #######
### ####### # # ###
##### # ### # ## ## # # # ## #####
### # # ## # # ## ####
## # #### # # ## # # ## ## # # ####
## # #### # ## # ## ## # # # # ########
###### # # ## # ### # # # ########
####### #### ## # ## #####
########### #### # ##### ### ###
##### ## ##### ### ## #### # #####
######## ## ## ###### # ### ## ####### # ### #### # # #####
######## ##### # ###### # #### ## ####### # ###### ##### #########
######## ####### ################## ####### # ############ #########
########################################### #########################
#####################################################################

#####################################################################
#####################################################################
######################### ##### ####################################
######################## ##### ############# #####################
####### ############### ##### ######### ### # ###################
##### ### ###### ## # # # ## ## ### # ### ###############
##### # # # ### # # ## ## ######
##### # # ## ## ### # ####### ######
##### # ### ## ### # ###### ####
##### ### ## #### # # ## ## ### #####
####### # # ## # ## ## ## # # ## # #####
#### ## ## # # ##
###### # ### ### ## ## ####
###### # ##### ### #### # ###
###### ##### ##### #### ### ### # ### ###### ### ###### # ######
###### ##### ##### #### ### ### ## #### ###### ########## # ######
###### ########### ############ ############## ########### ## #######
################## ############ ############## ########### ## #######
#####################################################################


RANDOMIZE TIMER

DIM a(70, 20)


begin:

CLEAR
CLS

FOR l = 1 TO 150
x = INT(RND * 59) + 6
y = INT(RND * 9) + 6
d = INT(RND * 4)
a(x, y) = 1
SELECT CASE d
CASE 0
FOR i = 1 TO INT(RND * 5)
a(x + i, y) = 1
a(x, y - i) = 1
NEXT i
CASE 1
FOR i = 1 TO INT(RND * 5)
a(x + i, y) = 1
a(x, y + i) = 1
NEXT i
CASE 2
FOR i = 1 TO INT(RND * 5)
a(x - i, y) = 1
a(x, y - i) = 1
NEXT i
CASE 3
FOR i = 1 TO INT(RND * 5)
a(x - i, y) = 1
a(x, y + i) = 1
NEXT i
END SELECT

NEXT l

FOR row = 1 TO 19
FOR col = 1 TO 69
IF a(col, row) = 0 THEN
PRINT "#";
ELSE
PRINT " ";
END IF
NEXT col
PRINT
NEXT row

WHILE INKEY$ = ""
WEND

GOTO begin


Björn Bergström

unread,
Feb 17, 2002, 10:48:08 AM2/17/02
to
"R. Alan Monroe" <with...@withheld.withheld> skrev i meddelandet
news:u6tou68...@corp.supernews.com...

> I wondered what it would be like to do a random dungeon by repeatedly
> placing random sized "L" shaped hallways, each with a random 90 degree
> orientation, all over the map. Here's the results.
>
> This method doesn't guarantee that all areas are reachable. You get a
> lot of cul-de-sacs, which could be good or bad depending on your
> game...
>
> [fixed width font]
>
[snip examples and code]

Would you mind if I included this post at my development section?

With best regards,
Björn Bergström - dungeon...@swipnet.se
Dungeondweller RLG and Roguelike Development Articles at
http://home.swipnet.se/dungeondweller/index.htm

R. Alan Monroe

unread,
Feb 17, 2002, 12:40:04 PM2/17/02
to
In article <f0Rb8.440$m4.1...@news010.worldonline.se>, "Björn Bergström" <dungeon...@swipnet.se> wrote:
>"R. Alan Monroe" <with...@withheld.withheld> skrev i meddelandet
>news:u6tou68...@corp.supernews.com...
>> I wondered what it would be like to do a random dungeon by repeatedly
>> placing random sized "L" shaped hallways, each with a random 90 degree
>> orientation, all over the map. Here's the results.
>>
>> This method doesn't guarantee that all areas are reachable. You get a
>> lot of cul-de-sacs, which could be good or bad depending on your
>> game...

>Would you mind if I included this post at my development section?

Please do... by itself, it's a throwaway program, but if it generates
other good research, it will do some good.

Have fun
Alan

0 new messages