Okay, 256x256 256 Dungeon test Works..
By mixing the worldx, worldy and dungeonlvl variables through bit shifting passes and addition passes it seems to work well enough.
I now have proven to myself that 256 level 256x256 screen dungeons can happen. With the bit shifting and addition passes screen to screen variation is enough. I'm starting to add in room objects such as stairs going up or down. The only glitch so far is some levels will have a stairway up which leads to a stairway down on the next level. You can get stuck in a loop that way.
The nice thing is, now that I know such large levels can be generated, I can use the same code for any game including RPGs, platformers, etc..
Here be the amateur code for determining what type of room is at a particular worldx and worldy for a given dungeon level:
calc_roomtype
temp1{0} = worldx{7}
temp1{1} = worldy{6}
temp1{2} = worldx{5}
temp1{3} = worldy{4}
temp1{4} = worldx{3}
temp1{5} = worldy{2}
temp1{6} = worldx{1}
temp1{7} = worldy{0}
temp1 = temp1 + dungeonlvl
temp2{0} = worldy{7}
temp2{1} = worldx{6}
temp2{2} = worldy{5}
temp2{3} = worldx{4}
temp2{4} = worldy{3}
temp2{5} = worldx{2}
temp2{6} = worldy{1}
temp2{7} = worldx{0}
temp2 = temp2 + worldy
temp3{0} = dungeonlvl{1}
temp3{1} = worldy{4}
temp3{2} = temp1{6}
temp3{3} = dungeonlvl{5}
temp3{4} = worldx{1}
temp3{5} = temp1{3}
temp3{6} = temp2{2}
temp3{7} = worldy{0}
temp3 = temp3 + worldx
temp1 = temp1 + temp2 + temp3 + dungeonlvl
if temp1 = 0 then temp1 = 255
rand = temp1
room_type = rand
return

0 Comments
Recommended Comments
There are no comments to display.