The Depths Procedural Dungeon Generation Code

DSPK V04.00 Furcadia
(0:0) When everything is starting up,
    (5:300) set variable %step to the value 0.
   
   



(0:9) When a furre arrives in the dream,
            (5:15) move the triggering furre to (66,58), or to someplace nearby if it's occupied.

    (5:200) emit message {This is the very early test of a procederal generation engine for a dungeon diving game I am working on.  Say "reload" to create a new dungeon layout} to the triggering furre.




(5:50) set countdown timer 1 to go off in 1 seconds.
(5:50) set countdown timer 2 to go off in 1 seconds.
(5:50) set countdown timer 3 to go off in 1 seconds.
(5:50) set countdown timer 4 to go off in 1 seconds.
(5:50) set countdown timer 5 to go off in 1 seconds.
(5:50) set countdown timer 6 to go off in 1 seconds.
(5:50) set countdown timer 7 to go off in 1 seconds.
(5:50) set countdown timer 8 to go off in 1 seconds.
(5:50) set countdown timer 9 to go off in 1 seconds.
(5:50) set countdown timer 10 to go off in 1 seconds.

(0:38) When someone says or emotes something with {step} in it,

    (5:200) emit message {%step} to the triggering furre.
    (5:200) emit message {%checkR} to the triggering furre.
    (5:200) emit message {%direction} to the triggering furre.
    (5:200) emit message {%hallCount,%halls} to the triggering furre.




(0:49) When any countdown timer goes off,
   (4:30) only in region 1,
    (5:1) set the floor to 161.


**SECTION**  Build Halls

*spoken Reload

(0:31) When someone says {reload},
   (4:1) only where the floor is 8,
    (5:120) make this/these location(s) part of region 5.
    (5:1) set the floor to 161.
    (5:300) set variable %step to the value 0.
  (5:300) set variable %hallCount to the value 0.
    (5:300) set variable %roomCount to the value 0.
   
(0:1) Whenever someone moves,
 (1:117) and the triggering furre (didn't move from/isn't standing at) floor 8,
   (4:2) only where the floor is not 8,
(5:15) move the triggering furre to (%start), or to someplace nearby if it's occupied.
 







*set up the parameters for current dungeon.  Number of hallways and number of rooms. Fetch start position.

(0:49) When any countdown timer goes off,
 (1:200) and variable %step is equal to 0,
    (5:312) set variable %halls to the total of rolling 1 dice with 1 sides plus 14.
    (5:312) set variable %rooms to the total of rolling 1 dice with 2 sides plus 1.
    (5:532) set variable %start to the X,Y position of a random spot where the item is 40 somewhere in the Dream.
 

    (5:300) set variable %step to the value 1.

*if to many attempts made move place item to a hall and try again.

(0:49) When any countdown timer goes off,
 (1:200) and variable %step is equal to 1,
 (1:200) and variable %attempt is equal to 2,
    (5:5) change item 40 to item 0.
    (5:300) set variable %attempt to the value 0.
   (4:1) only where the floor is 8,
    (5:512) set variable %newPath to the X,Y position of a random spot where the floor is 8 somewhere in the Dream.
    (5:41) place item 40 at (%newPath).
    (5:300) set variable %step to the value 0.


*if all halls are laid start building rooms

(0:49) When any countdown timer goes off,
 (1:200) and variable %step is equal to 1,
 (1:203) and variable %hallCount is equal to variable %halls,
    (5:300) set variable %step to the value 6.


*choose direction and distance for hallway.

(0:49) When any countdown timer goes off,
 (1:200) and variable %step is equal to 1,
 (1:202) and variable %attempt is less than 2,

 (1:205) and variable %hallCount is less than variable %halls,
    (5:312) set variable %length to the total of rolling 1 dice with 1 sides plus 8.
    (5:312) set variable %direction to the total of rolling 1 dice with 4 sides plus 0.



    (5:301) copy the value of variable %start into variable %check.
    (5:301) copy the value of variable %start into variable %rightLane.
    (5:301) copy the value of variable %start into variable %leftLane.

    (5:300) set variable %checkR to the value 1.
    (5:300) set variable %checkF to the value 1.

    (5:300) set variable %step to the value 2.

*preload parameters for checks and adjacent lanes depending on direction roll.

(0:49) When any countdown timer goes off,
 (1:200) and variable %step is equal to 2,
 (1:200) and variable %direction is equal to 1,
    (5:352) move the position in variable %check northeast (up and right) %length step(s).
    (5:355) move the position in variable %leftLane northwest (up and left) 1 step(s).
    (5:353) move the position in variable %rightLane southeast (down and right) 1 step(s).

    (5:320) set variable %checkR to the region number (%check) is part of.
    (5:380) set variable %checkF to the floor type at (%check).
    (5:300) set variable %step to the value 3.



(0:49) When any countdown timer goes off,
 (1:200) and variable %step is equal to 2,
 (1:200) and variable %direction is equal to 2,
(5:353) move the position in variable %check southeast (down and right) %length step(s).
    (5:352) move the position in variable %leftLane northeast (up and right) 1 step(s).
    (5:354) move the position in variable %rightLane southwest (down and left) 1 step(s).

    (5:320) set variable %checkR to the region number (%check) is part of.
    (5:380) set variable %checkF to the floor type at (%check).

  (5:300) set variable %step to the value 3.


(0:49) When any countdown timer goes off,
 (1:200) and variable %step is equal to 2,
 (1:200) and variable %direction is equal to 3,
    (5:354) move the position in variable %check southwest (down and left) %length step(s).
    (5:353) move the position in variable %leftLane southeast (down and right) 1 step(s).
    (5:355) move the position in variable %rightLane northwest (up and left) 1 step(s).

    (5:320) set variable %checkR to the region number (%check) is part of.
    (5:380) set variable %checkF to the floor type at (%check).

  (5:300) set variable %step to the value 3.


(0:49) When any countdown timer goes off,
 (1:200) and variable %step is equal to 2,
 (1:200) and variable %direction is equal to 4,
    (5:355) move the position in variable %check northwest (up and left) %length step(s).
    (5:354) move the position in variable %leftLane southwest (down and left) 1 step(s).
    (5:352) move the position in variable %rightLane northeast (up and right) 1 step(s).

    (5:320) set variable %checkR to the region number (%check) is part of.
    (5:380) set variable %checkF to the floor type at (%check).

  (5:300) set variable %step to the value 3.


*check to make sure that the path will be made in an acceptable area.

(0:49) When any countdown timer goes off,
 (1:200) and variable %step is equal to 3,
 (1:200) and variable %checkR is equal to 1,
    (5:302) take variable %attempt and add 1 to it.

    (5:300) set variable %step to the value 1.

(0:49) When any countdown timer goes off,
 (1:200) and variable %step is equal to 3,
 (1:200) and variable %checkF is equal to 8,
    (5:302) take variable %attempt and add 1 to it.

    (5:300) set variable %step to the value 1.

(0:49) When any countdown timer goes off,
 (1:200) and variable %step is equal to 3,
 (1:200) and variable %checkR is equal to 5,
 (1:200) and variable %checkF is equal to 161,
    (5:300) set variable %step to the value 4.


*place markers at start and finish of each hallway for possible room placement

(0:49) When any countdown timer goes off,
 (1:200) and variable %step is equal to 4,
    (5:121) make location (%check) part of region 2.
    (5:121) make location (%start) part of region 2.
    (5:300) set variable %step to the value 5.




*place floors in the length and direction of the hallway one iteration for each lane ending with the the middle lane increasing the count and step.

*going northeast

(0:49) When any countdown timer goes off,
 (1:200) and variable %step is equal to 5,
 (1:200) and variable %direction is equal to 1,
  (3:16) in a line starting at (%leftLane) and going 1 more spaces southwest.
    (5:1) set the floor to 8.

(0:49) When any countdown timer goes off,
 (1:200) and variable %step is equal to 5,
 (1:200) and variable %direction is equal to 1,
  (3:14) in a line starting at (%leftLane) and going %length more spaces northeast.
    (5:1) set the floor to 8.

(0:49) When any countdown timer goes off,
 (1:200) and variable %step is equal to 5,
 (1:200) and variable %direction is equal to 1,
  (3:16) in a line starting at (%start) and going 1 more spaces southwest.
    (5:1) set the floor to 8.


(0:49) When any countdown timer goes off,
 (1:200) and variable %step is equal to 5,
 (1:200) and variable %direction is equal to 1,
  (3:16) in a line starting at (%rightLane) and going 1 more spaces southwest.
    (5:1) set the floor to 8.

(0:49) When any countdown timer goes off,
 (1:200) and variable %step is equal to 5,
 (1:200) and variable %direction is equal to 1,
  (3:14) in a line starting at (%rightLane) and going %length more spaces northeast.
    (5:1) set the floor to 8.

(0:49) When any countdown timer goes off,
 (1:200) and variable %step is equal to 5,
 (1:200) and variable %direction is equal to 1,
  (3:14) in a line starting at (%start) and going %length more spaces northeast.
    (5:1) set the floor to 8.
    (5:352) move the position in variable %start northeast (up and right) %length step(s).
    (5:302) take variable %hallCount and add 1 to it.
    (5:300) set variable %step to the value 1.




*going southeast

(0:49) When any countdown timer goes off,
 (1:200) and variable %step is equal to 5,
 (1:200) and variable %direction is equal to 2,
  (3:17) in a line starting at (%leftLane) and going 1 more spaces northwest.
    (5:1) set the floor to 8.

(0:49) When any countdown timer goes off,
 (1:200) and variable %step is equal to 5,
 (1:200) and variable %direction is equal to 2,
  (3:15) in a line starting at (%leftLane) and going %length more spaces southeast.
    (5:1) set the floor to 8.

(0:49) When any countdown timer goes off,
 (1:200) and variable %step is equal to 5,
 (1:200) and variable %direction is equal to 2,
  (3:17) in a line starting at (%start) and going 1 more spaces northwest.
    (5:1) set the floor to 8.

(0:49) When any countdown timer goes off,
 (1:200) and variable %step is equal to 5,
 (1:200) and variable %direction is equal to 2,
  (3:17) in a line starting at (%rightLane) and going 1 more spaces northwest.
    (5:1) set the floor to 8.

(0:49) When any countdown timer goes off,
 (1:200) and variable %step is equal to 5,
 (1:200) and variable %direction is equal to 2,
  (3:15) in a line starting at (%rightLane) and going %length more spaces southeast.
    (5:1) set the floor to 8.

(0:49) When any countdown timer goes off,
 (1:200) and variable %step is equal to 5,
 (1:200) and variable %direction is equal to 2,
  (3:15) in a line starting at (%start) and going %length more spaces southeast.
    (5:1) set the floor to 8.
    (5:353) move the position in variable %start southeast (down and right) %length step(s).
    (5:302) take variable %hallCount and add 1 to it.
    (5:300) set variable %step to the value 1.



*going southwest


(0:49) When any countdown timer goes off,
 (1:200) and variable %step is equal to 5,
 (1:200) and variable %direction is equal to 3,
  (3:14) in a line starting at (%leftLane) and going 1 more spaces northeast.
    (5:1) set the floor to 8.

(0:49) When any countdown timer goes off,
 (1:200) and variable %step is equal to 5,
 (1:200) and variable %direction is equal to 3,
  (3:16) in a line starting at (%leftLane) and going %length more spaces southwest.
    (5:1) set the floor to 8.

(0:49) When any countdown timer goes off,
 (1:200) and variable %step is equal to 5,
 (1:200) and variable %direction is equal to 3,
  (3:14) in a line starting at (%start) and going 1 more spaces northeast.
    (5:1) set the floor to 8.

(0:49) When any countdown timer goes off,
 (1:200) and variable %step is equal to 5,
 (1:200) and variable %direction is equal to 3,
  (3:14) in a line starting at (%rightLane) and going 1 more spaces northeast.
    (5:1) set the floor to 8.


(0:49) When any countdown timer goes off,
 (1:200) and variable %step is equal to 5,
 (1:200) and variable %direction is equal to 3,
  (3:16) in a line starting at (%rightLane) and going %length more spaces southwest.
    (5:1) set the floor to 8.


(0:49) When any countdown timer goes off,
 (1:200) and variable %step is equal to 5,
 (1:200) and variable %direction is equal to 3,
  (3:16) in a line starting at (%start) and going %length more spaces southwest.
    (5:1) set the floor to 8.
    (5:354) move the position in variable %start southwest (down and left) %length step(s).
    (5:302) take variable %hallCount and add 1 to it.
    (5:300) set variable %step to the value 1.



*going northwest

(0:49) When any countdown timer goes off,
 (1:200) and variable %step is equal to 5,
 (1:200) and variable %direction is equal to 4,
  (3:15) in a line starting at (%leftLane) and going 1 more spaces southeast.
    (5:1) set the floor to 8.


(0:49) When any countdown timer goes off,
 (1:200) and variable %step is equal to 5,
 (1:200) and variable %direction is equal to 4,
  (3:17) in a line starting at (%leftLane) and going %length more spaces northwest.
    (5:1) set the floor to 8.


(0:49) When any countdown timer goes off,
 (1:200) and variable %step is equal to 5,
 (1:200) and variable %direction is equal to 4,
  (3:15) in a line starting at (%start) and going 1 more spaces southeast.
    (5:1) set the floor to 8.

(0:49) When any countdown timer goes off,
 (1:200) and variable %step is equal to 5,
 (1:200) and variable %direction is equal to 4,
  (3:15) in a line starting at (%rightLane) and going 1 more spaces southeast.
    (5:1) set the floor to 8.


(0:49) When any countdown timer goes off,
 (1:200) and variable %step is equal to 5,
 (1:200) and variable %direction is equal to 4,
  (3:17) in a line starting at (%rightLane) and going %length more spaces northwest.
    (5:1) set the floor to 8.


(0:49) When any countdown timer goes off,
 (1:200) and variable %step is equal to 5,
 (1:200) and variable %direction is equal to 4,
  (3:17) in a line starting at (%start) and going %length more spaces northwest.
    (5:1) set the floor to 8.
    (5:355) move the position in variable %start northwest (up and left) %length step(s).
    (5:302) take variable %hallCount and add 1 to it.
    (5:300) set variable %step to the value 1.


**SECTION**  Build Rooms

*preload room parameters

(0:49) When any countdown timer goes off,
 (1:200) and variable %step is equal to 6,
 (1:205) and variable %roomCount is less than variable %rooms,
  (3:30) in region 2,
   (4:1) only where the floor is 8,
    (5:512) set variable %roomCenter to the X,Y position of a random spot where the floor is 8 somewhere in the Dream.
    (5:312) set variable %radius to the total of rolling  2 dice with 2 sides plus 1.
    (5:306) multiply variable %radius by 2.

    (5:121) make location (%roomCenter) part of region 5.

    (5:301) copy the value of variable %roomCenter into variable %roomTop.
    (5:301) copy the value of variable %roomCenter into variable %roomBottom.


    (5:305) take variable %roomTop.y and subtract variable %radius from it.
    (5:303) take variable %roomBottom.y and add variable %radius to it.
 
    (5:300) set variable %step to the value 7.


*In the Diamond that is the room lay the floor

(0:49) When any countdown timer goes off,
 (1:200) and variable %step is equal to 7,
  (3:3) within the diamond (%roomTop) - (%roomBottom),
    (5:1) set the floor to 8.
    (5:302) take variable %roomCount and add 1 to it.
    (5:300) set variable %step to the value 6.











**SECTION**  New Clock

(0:49) When any countdown timer goes off

(5:50) set countdown timer 1 to go off in 1 seconds.
(5:50) set countdown timer 2 to go off in 1 seconds.
(5:50) set countdown timer 3 to go off in 1 seconds.
(5:50) set countdown timer 4 to go off in 1 seconds.
(5:50) set countdown timer 5 to go off in 1 seconds.
(5:50) set countdown timer 6 to go off in 1 seconds.
(5:50) set countdown timer 7 to go off in 1 seconds.
(5:50) set countdown timer 8 to go off in 1 seconds.
s(5:50) set countdown timer 9 to go off in 1 seconds.
(5:50) set countdown timer 10 to go off in 1 seconds.





*Endtriggers* 8888 *Endtriggers*

Comments