...first an explanation of how the current version works:
currently I work with some sort of bytewise (or more accurately 4-tit-tytewise) method while calculating the dungeon. Im using the cardinal points (N/E/W/S) for entrances on a 6x6 tile. these points can have 3 values x,0 and 1. So every tile can be indicated with a 4-tit (ternary digit) tyte. Where 0==no exit, 1==exit and x==undecided
And because e.g. 0001 is automatically turned into the number 1 by MT a leader string is required to prevent that: 'f'. Also because facing '0' in MT == facing EAST AND facing works counterclockwise, makes EAST the first tit, North the second, west the third and south the final. THUS a tile with a single exit facing east is denoted as follows:
f1000 : 'f' being the 'do not turn into number trick', followed by exits ENWS where E == 1 and NWS are all 0.
f0101: a north - south hallway
f1111: a crossing
f1110: a t-junction
f0000: no entries
etc.
The 'x' comes in when you want to make a *random* dungeon. First you define a space, e.g. a 'dungeon' of 3x3 tiles, this you fill entirely with 'x' except the borders, which should all be 0 (so the dungeon as a whole has no exits). This results in a 'Template Dungeon':
Code: Select all
f0000 f00x0 f0000
f0x00 fxxxx f00x0
f0000 f0x00 f0000
for reference, let number the tiles
#1 #2 #3
#4 #5 #6
#7 #8 #9
First tile with an 'x' encountered is tile #2: f00x0. Here (S)outh is undecided, so check the tile south of #2 (== #5 == fxxxx) and check if it has an exit facing north, if it does then set the the south exit of tile #2 to '1' (== exit). In this case #5 tile has an 'undecided' exit facing north and thus it has to be decided, in other words roll a 1d2-1. Or in the case of the dungeon builder roll a 1d100 vs a preset number e.g. 60. this means that there is a 60% chance that there will be an exit. Lets assume the result is true==1==exit. And for tile #4 the result is false. Then at that point the dungeon looks like:
Code: Select all
f0000 f0010 f0000
f0000 fx10x f00x0
f0000 f0x00 f0000
Code: Select all
f0000 f0010 f0000
f0000 f1100 f0010
f0000 f0000 f0000
This is how the dungeon builder works.
Now the next step.
the above requires two things:
- ALL tiles to be limited to 4 exits (N/E/S/W), while this concerns 6x6 tiles, so corners could play a roll as well. One important thing to note: IF a corner is open, then with the current tileset its ALL open so e.g. the upper left corner or the N-W corner will always open up to both North AND West. So its not *necessary* to make the distinction an exit facing N and an exit facing W for a N-W facing exit. On the other hand, for future compatibility it *might* be prudent to do so...
- Every 'exit' can only have 3 states (true/false/undecided), while there are also tiles with e.g. 'stairs', 'rails' or other specific functions.
The question now is: HOW can this be best implemented ?
Here you can stop reading and start thinking! I'll add my suggestions in the next post, but I'm very curious to other methods