DeathTestvDungeon
#1
DeathTeatDungeon is a simple rogue-like example.  It's based off the code I used in Wandering in the Cave but makes use of a graphic tileset.   
It's currently set-up to play a simple escape scenario. Eventually monsters and treasures will be added to the game, the graphics are there currently just not all the rest of the code.

This is in two codeblocks, the main program you can name however you like the tileset and tileloading function should be saved in a file called "DTDtiles.bi" if you want to use the code as is.

thanks again to DAV for his BASIMAGE program whichmade this program possible as is.

DeathTestDungeon Main Program
Code: (Select All)
'DeathTestDungeon    v0.3b
'By James D. Jarvis
' a simple rogue-like example
' in progress
' has simple exit challenge built in for now , no guarantee the starting positon will be safe or the game will be playable just yet
'
'curenntly this is all rough and in-development you'll see the dungeon get drawn as you start and it will stay on screen
'as long as you wish, press the spacebar to start playing
' use the numberpad or WASD to navigate   <esc> to quit
'$dynamic
Screen _NewImage(800, 500, 32)
_Title "DeathTestDungeon v0.3"
_Define K As _UNSIGNED LONG
Dim Shared dmap As _Unsigned Long
Dim Shared ms As _Unsigned Long
Dim Shared Kblack, Kwhite, Kdgrey, Klgrey, kredm, kwater, kslime, klava, krubble, kcrystal, kexit, kfungus
Dim Shared kfloor2, kfloor3, kfloor4, cornerrubblechance
Dim Shared tiles&
Dim Shared rect_count As Integer
Type rect_type
    xx As Integer
    yy As Integer
    ww As Integer
    hh As Integer
    lk As _Unsigned Long
    fk As _Unsigned Long
    notes As String
End Type
Dim Shared tilespot(0 To 528, 2) As Integer
Dim Shared rect(0) As rect_type
Dim Shared min_rectd
Dim Shared fillcell, openwallchance, pillarchance, puddleno, slimechance, lavachance
Dim Shared phealth, pstamina, pwounds, ptemp, ppx, ppy, lastx, lasty
Randomize Timer
Kblack = _RGB32(0, 0, 0) 'this is visible black as 0,0,0 will be "nothing is here" eventually
Kwhite = _RGB32(250, 250, 250) 'this is cooled paper white
Kdgrey = _RGB32(40, 40, 40)
Klgrey = _RGB32(150, 150, 150)
kfloor2 = _RGB32(151, 151, 151): kfloor3 = _RGB32(152, 152, 152): kfloor4 = _RGB32(153, 153, 153)
kred = _RGB32(250, 0, 0)
kwater = _RGB32(10, 30, 240): kslime = _RGB32(20, 240, 100): klava = _RGB32(200, 5, 5)
krubble = _RGB32(80, 80, 80): kcrystal = _RGB32(250, 250, 0): kexit = _RGB32(255, 0, 255)
kfungus = _RGB32(200, 50, 150)
dmap = _NewImage(800, 500, 32)
ms = _NewImage(800, 500, 32)
tiles& = Loadtileset1& 'loads the tileset in the file DTDtiles.bi
Const tilemaxx = 48
Const tilemaxy = 11
t = 0
For y = 0 To tilemaxy - 1
    For x = 0 To tilemaxx - 1
        tilespot(t, 1) = x * 16
        tilespot(t, 2) = y * 16
        t = t + 1
    Next x
Next y
maxtiles = t - 1
fh = _FontHeight
fw = _FontWidth





restartdungeon:
walltile = getwalltile

Screen dmap
_Dest dmap
_Source dmap
_PrintMode _KeepBackground
Color Kdgrey, Kdgrey
Do
    fillcell = Int(Rnd * 40)
    openwallchance = Int(Rnd * 20)
    pillarchance = Int(Rnd * 20)
    puddleno = Int(Rnd * 30)
    slimechance = Int(Rnd * 24)
    lavachance = Int(Rnd * 10)
    funguschance = Int(Rnd * 30)
    cornerrubblechance = Int(1 + Rnd * 30)
    ReDim rect(0) As rect_type
    rect_count = 0
    Cls
    rwid = 780
    rht = 480
    newrect 10, 10, rwid, rht, Kdgrey, Klgrey
    min_rectd = 40
    'If min_rectd < 4 Then min_rectd = 4
    drawrect 1
    bisectrect 1
    n = 0
    min_rectd = Int(1 + Rnd * 30)
    If min_rectd < 10 Then min_rectd = 10

    Do
        'Cls
        For r = 1 To rect_count
            bisectrect r
        Next r
        For r = 1 To rect_count
            drawrect r
        Next r


        _Limit 5
        kk$ = InKey$
        n = n + Int(1 + Rnd * 8)
    Loop Until kk$ <> "" Or n > 40
    kk$ = Chr$(27)
Loop Until kk$ = Chr$(27)
For r = 1 To rect_count
    If Int(1 + Rnd * 100) < fillcell Then rect(r).fk = Kdgrey
    drawrect r
Next r
For r = 1 To rect_count 'if there's an open space across a wall open a space in the wall
    If rect(r).fk <> Kdgrey Then
        mx = rect(r).xx + Int(rect(r).ww / 2)
        my = rect(r).yy + Int(rect(r).hh / 2)
        If Point(mx, my + Int(rect(r).hh / 2) + 2) = Klgrey Then
            Line (mx, my)-(mx, my + Int(rect(r).hh / 2) + 2), Klgrey
        End If

        If Point(mx, my - Int(rect(r).hh / 2) - 2) = Klgrey Then
            Line (mx, my)-(mx, my - Int(rect(r).hh / 2) - 2), Klgrey
        End If

        If Point(mx - Int(rect(r).ww / 2) - 2, my) = Klgrey Then
            Line (mx - Int(rect(r).ww / 2) - 2, my)-(mx, my), Klgrey
        End If

        If Point(mx + Int(rect(r).ww / 2) + 2, my) = Klgrey Then
            Line (mx + Int(rect(r).ww / 2) + 2, my)-(mx, my), Klgrey
        End If
    End If
Next r
For y = 11 To rht - 1
    For x = 11 To rwid - 2
        If Point(x, y) = Klgrey And Point(x + 1, y) = Kdgrey And Point(x + 2, y) = Klgrey Then
            PSet (x + 1, y), kred
        End If
        If Point(x, y) = Klgrey And Point(x + 1, y) = kred And Point(x + 2, y) = Kdgrey And Point(x + 3, y) = Klgrey Then
            PSet (x + 2, y), kred
        End If
        If Point(x, y) = kdrgey And Point(x + 1, y) = Klgrey And Point(x + 2, y) = Kdgrey And Point(x + 3, y) = Kdgrey And Point(x + 4, y) = Klgrey And Point(x + 5, y) = Kdgrey Then
            PSet (x + 2, y), Klgrey
            PSet (x + 3, y), Klgrey
        End If
    Next x
Next y

For x = 11 To rwid - 2
    For y = 11 To rht - 2
        If Point(x, y) = Klgrey And Point(x, y + 1) = Kdgrey And Point(x, y + 2) = Klgrey Then
            PSet (x, y + 1), kred
        End If
        If Point(x, y) = Klgrey And Point(x, y + 1) = kred And Point(x, y + 2) = Kdgrey And Point(x, y + 3) = Klgrey Then
            PSet (x, y + 2), kred
        End If
        If Point(x, y) = kdrgey And Point(x, y + 1) = Klgrey And Point(x, y + 2) = Kdgrey And Point(x, y + 3) = Kdgrey And Point(x, y + 4) = Klgrey And Point(x, y + 5) = Kdgrey Then
            PSet (x, y + 2), Klgrey
            PSet (x, y + 3), Klgrey
        End If
    Next
Next
aa$ = Input$(1)
For y = 10 To rht
    For x = 10 To rwid
        If Point(x, y) = kred Then PSet (x, y), Klgrey
    Next
Next
Color Kblack, Kwhite
'check to open walls
For r = 1 To rect_count
    If rect(r).fk <> Kdgrey And Int(1 + Rnd * 100) <= openwallchance Then
        Select Case Int(1 + Rnd * 4)
            Case 1
                rect(r).xx = rect(r).xx - 2
                rect(r).ww = rect(r).ww + 2
            Case 2
                rect(r).xx = rect(r).xx + 2
                rect(r).ww = rect(r).ww + 2

            Case 3
                rect(r).yy = rect(r).yy - 2
                rect(r).hh = rect(r).hh + 2
            Case 4
                rect(r).yy = rect(r).yy + 2
                rect(r).hh = rect(r).hh + 2
        End Select
        Line (rect(r).xx, rect(r).yy)-(rect(r).xx + rect(r).ww, rect(r).yy + rect(r).hh), Klgrey, BF
    End If
Next r

'straysspaces
sp = Int(Rnd * 12)
For ss = 1 To sp
    sx = Int(10 + Rnd * rwid - 30)
    sy = Int(10 + Rnd * rht - 30)
    sw = 10 + Int(Rnd * 20)
    sh = 10 + Int(Rnd * 20)
    Line (sx, sy)-(sx + sw, sy + sh), Klgrey, BF
Next
'add wormtunnels
nwt = Int(Rnd * (12 + fillcell))
For ww = 1 To nwt
    wsx = Int(20 + Rnd * rwid - 50)
    wsy = Int(20 + Rnd * rht - 50)
    wtx = Int(20 + Rnd * rwid - 50)
    wty = Int(20 + Rnd * rht - 50)
    If wsx < wtx Then xtrend = 1
    If wsx > wtx Then xtrend = -1
    If wsy < wty Then ytrend = 1
    If wsy > wty Then ytrend = -1
    sx = wsx
    sy = wsy
    rl = 0
    Do
        nx = sx + Int(xtrend + Rnd * 2 - Rnd * 2)
        ny = sy + Int(ytrend + Rnd * 2 - Rnd * 2)
        If nx < 11 Then
            nx = 11
            xtrend = xtrend * -1
        End If
        If ny < 11 Then
            ny = 11
            ytrend = ytrend * -1
        End If
        If nx > rwid Then
            nx = rwid
            xtrend = xtrend * -1
        End If
        If ny > rht Then
            ny = rht
            ytrend = ytrend * -1
        End If
        dx = Abs(nx - wtx)
        dy = Abs(ny - wty)
        Line (sx, sy)-(nx, ny), Klgrey
        sx = nx
        sy = ny
        rl = rl + 1
    Loop Until dx < 5 And dy < 5 Or rl > rwid + 40
    Line (sx, sy)-(wtx, wty), Klgrey
Next ww

For r = 1 To rect_count 'add pillars
    pillarspread = 2 + Int(Rnd * 7)
    If rect(r).fk <> Kdgrey And Int(1 + Rnd * 100) <= pillarchance Then
        For y = rect(r).yy + pillarspread To rect(r).yy + rect(r).hh - pillarspread Step pillarspread
            For x = rect(r).xx + pillarspread To rect(r).xx + rect(r).ww - pillarspread Step pillarspread
                PSet (x, y), Kdgrey
            Next
        Next
    End If
Next

For pr = 1 To rect_count
    If rect(pr).fk <> Kdgrey And Int(1 + Rnd * 100) <= cornerrubblechance Then
        addcornerrubble pr
    End If
    If rect(pr).fk <> Kdgrey And Int(1 + Rnd * 100) <= puddleno Then
        addwater pr, Int(rect(pr).xx + 1 + Rnd * (rect(pr).ww - 2)), Int(rect(pr).yy + 1 + Rnd * (rect(pr).hh - 2)), Int(1 + Rnd * 3)
    End If
    If rect(pr).fk <> Kdgrey And Int(1 + Rnd * 100) <= slimechance Then
        addslime pr, Int(rect(pr).xx + 1 + Rnd * (rect(pr).ww - 2)), Int(rect(pr).yy + 1 + Rnd * (rect(pr).hh - 2)), Int(1 + Rnd * 3)
    End If
    If rect(pr).fk <> Kdgrey And Int(1 + Rnd * 100) <= lavachance Then
        addlava pr, Int(rect(pr).xx + 1 + Rnd * (rect(pr).ww - 2)), Int(rect(pr).yy + 1 + Rnd * (rect(pr).hh - 2)), Int(1 + Rnd * 3)
    End If
    If rect(pr).fk <> Kdgrey And Int(1 + Rnd * 100) <= funguschance Then
        addfungus pr, Int(rect(pr).xx + 1 + Rnd * (rect(pr).ww - 2)), Int(rect(pr).yy + 1 + Rnd * (rect(pr).hh - 2)), Int(1 + Rnd * 3)
    End If
Next pr
'dress floor to make it more interesting
For y = 1 To rht
    For x = 1 To rwid
        If Point(x, y) = Klgrey Then
            Select Case Int(1 + Rnd * 100)
                Case 1, 2
                    PSet (x, y), kfloor2
                Case 3
                    PSet (x, y), kfloor3
                Case 4
                    PSet (x, y), kfloor4
            End Select
            If Point(x, y) = Kdgrey Then 'convert some wall near lava inot rubble
                If Point(x - 1, y) = klava And Int(1 + Rnd * 100) < 30 Then PSet (x, y), krubble
                If Point(x + 1, y) = klava And Int(1 + Rnd * 100) < 30 Then PSet (x, y), krubble
                If Point(x, y + 1) = klava And Int(1 + Rnd * 100) < 30 Then PSet (x, y), krubble
                If Point(x, y - 1) = klava And Int(1 + Rnd * 100) < 30 Then PSet (x, y), krubble
                If Point(x - 2, y) = klava And Int(1 + Rnd * 100) < 10 Then PSet (x, y), krubble
                If Point(x + 2, y) = klava And Int(1 + Rnd * 100) < 10 Then PSet (x, y), krubble
                If Point(x, y + 2) = klava And Int(1 + Rnd * 100) < 10 Then PSet (x, y), krubble
                If Point(x, y - 2) = klava And Int(1 + Rnd * 100) < 10 Then PSet (x, y), krubble
            End If
        End If
    Next
Next

For e = 0 To 9 'clean edge
    Line (e, e)-(_Width - e, e), Kdgrey: Line (e, e)-(e, _Height - e), Kdgrey: Line (_Width - e, e)-(_Width - e, _Height - e), Kdgrey
Next e
Screen ms
_Source dmap
pick = 0
Do
    pick = pick + 1
    ppx = rect(pick).xx + Int(rect(pick).ww / 2): ppy = rect(pick).yy + Int(rect(pick).hh / 2)
    kk = Point(ppx, ppy)
Loop Until kk <> Kdgrey

lightradius = 9: pstamina = 100: phealth = 100: pwounds = 0: ptemp = 98
turn = 0

Do
    If rec_count > 12 Then
        exitspot = Int(6 + Rnd * (rect_count - 7))
    Else
        exitspot = Int(1 + Rnd * rect_count)
    End If
    exitX = rect(exitspot).xx + Int(rect(exitspot).ww / 2)
    exitY = rect(exitspot).yy + Int(rect(exitspot).hh / 2)
    startX = Abs(exitX - ppx)
    startY = Abs(exitY - ppy)
    start_dx = Sqr(startX * startX + startY * startY)
Loop Until Point(exitX, exitY) <> Kdgrey And exitspot <> pick
_Dest dmap
PSet (exitX, exitY), kexit
_Dest ms
_PrintMode _KeepBackground
View Print 25 To 30
Cls
Do
    'draw location
    rsqrd = lightradius * lightradius
    y = -lightradius
    While y <= lightradius
        x = Int(Sqr(rsqrd - y * y))
        For x2 = ppx - x To ppx + x
            vx = x2 - ppx + 12
            kk = Point(x2, ppy + y)
            Line (vx * 16, (y + 12) * 16)-(vx * 16 + 15, (y + 12) * 16 + 15), kk, BF
            If kk = Kdgrey Then
                coltileat walltile, _RGB32(100, 100, 100), vx * 16, (y + 12) * 16
            End If
            If kk = kfloor2 Then
                coltileat 2, _RGB32(160, 160, 160), vx * 16, (y + 12) * 16
            End If
            If kk = kfloor3 Then
                coltileat 3, _RGB32(165, 165, 170), vx * 16, (y + 12) * 16
            End If
            If kk = kfloor4 Then
                coltileat 4, _RGB32(175, 165, 165), vx * 16, (y + 12) * 16
            End If

            If kk = kexit Then
                coltileat 24, _RGB32(250, 40, 255), vx * 16, (y + 12) * 16
            End If

            If kk = kfungus Then
                Color _RGB32(250, 100, 200)
                ' _PrintString (vx * 16, (y + 12) * 16), Chr$(234)
                coltileat 57, _RGB32(250, 100, 200), vx * 16, (y + 12) * 16
                Color _RGB32(255, 255, 255)
            End If
            If kk = kcrystal Then
                '_PrintString (vx * 16, (y + 12) * 16), Chr$(127)
                coltileat 433, _RGB32(10, 0, 10), vx * 16, (y + 12) * 16
            End If
            If kk = krubble Then
                Color _RGB32(150, 150, 150)
                '_PrintString (vx * 16, (y + 12) * 16), Chr$(177)
                coltileat 61, _RGB32(220, 200, 180), vx * 16, (y + 12) * 16
                Color _RGB32(255, 255, 255)
            End If
            If kk = kslime Then
                Color _RGB32(250, 250, 150)
                sb = Int(Rnd * 4)
                'If sb = 1 Then _PrintString (vx * 16, (y + 12) * 16), Chr$(247)
                If sb = 1 Then coltileat 61, _RGB32(250, 250, 150), vx * 16, (y + 12) * 16
                ' If sb = 2 Then _PrintString (vx * 16, (y + 12) * 16), Chr$(126)
                If sb = 2 Then coltileat 61, _RGB32(150, 250, 150), vx * 16, (y + 12) * 16
                Color _RGB32(255, 255, 255)
            End If
            If kk = klava Then
                Color _RGB32(250, 250, 150)
                lb = Int(Rnd * 7)
                'If lb = 1 Then _PrintString (vx * 16, (y + 12) * 16), Chr$(249)
                If lb = 1 Then coltileat 61, _RGB32(250, 250, 150), vx * 16, (y + 12) * 16
                'If lb = 2 Then _PrintString (vx * 16, (y + 12) * 16), Chr$(9)
                If lb = 2 Then coltileat 468, _RGB32(250, 250, 150), vx * 16, (y + 12) * 16
                'If lb = 3 Then _PrintString (vx * 16, (y + 12) * 16), Chr$(176)
                If lb = 3 Then coltileat 461, _RGB32(250, 250, 150), vx * 16, (y + 12) * 16
                'If lb = 4 Then _PrintString (vx * 16, (y + 12) * 16), Chr$(248)
                If lb = 4 Then coltileat 61, _RGB32(250, 0, 0), vx * 16, (y + 12) * 16

                'If lb = 5 Then _PrintString (vx * 16, (y + 12) * 16), Chr$(46)
                If lb = 5 Then coltileat 468, _RGB32(250, 100, 0), vx * 16, (y + 12) * 16
                Color _RGB32(255, 255, 255)
            End If
            If kk = kwater Then
                Color _RGB32(40, 120, 250)
                wb = Int(Rnd * 6)
                'If wb = 1 Then _PrintString (vx * 16, (y + 12) * 16), Chr$(45)
                If wb = 1 Then coltileat 136, _RGB32(40, 120, 250), vx * 16, (y + 12) * 16
                If wb = 2 Then coltileat 136, _RGB32(40, 120, 250), vx * 16, (y + 12) * 16
                If wb = 3 Then _PrintString (vx * 16 + 4, (y + 12) * 16), Chr$(240)
                Color _RGB32(255, 255, 255)
            End If
        Next
        y = y + 1
    Wend
    Line (598, 18)-(795, 124), Kdgrey, BF
    '_PrintString ((12) * 8, (12) * 16), "@"
    If ptemp > 199 Then coltileat 470, _RGB32(40, 0, 0), (12) * 16, (12) * 16
    coltileat 304, _RGB32(250, 250, 250), (12) * 16, (12) * 16
    o$ = "Stamina " + Str$(pstamina)
    _PrintString (600, 20), o$
    o$ = "Health " + Str$(phealth)
    _PrintString (600, 40), o$
    o$ = "Wounds " + Str$(pwounds)
    _PrintString (600, 60), o$
    o$ = "Temperature " + Str$(ptemp)
    _PrintString (600, 80), o$
    edd = Int(Sqr((ppx - exitX) * (ppx - exitX) + (ppy - exitY) * (ppy - exitY)))
    o$ = "Distance to Exit " + Str$(edd)
    _PrintString (600, 100), o$
    Print "Turn", turn
    Do
        _Limit 60
        kk$ = InKey$
    Loop Until kk$ <> ""
    turn = turn + 1
    lastx = ppx
    lasty = ppy
    Select Case kk$
        Case "w", "8"
            If pstamina > 0 And Point(ppx, ppy - 1) <> Kdgrey Then ppy = ppy - 1
        Case "s", "2"
            If pstamina > 0 And Point(ppx, ppy + 1) <> Kdgrey Then ppy = ppy + 1
        Case "a", "4"
            If pstamina > 0 And Point(ppx - 1, ppy) <> Kdgrey Then ppx = ppx - 1
        Case "d", "6"
            If pstamina > 0 And Point(ppx + 1, ppy) <> Kdgrey Then ppx = ppx + 1
        Case "7"
            If pstamina > 0 And Point(ppx - 1, ppy - 1) <> Kdgrey Then
                ppy = ppy - 1
                ppx = ppx - 1
            End If
        Case "9"
            If pstamina > 0 And Point(ppx + 1, ppy - 1) <> Kdgrey Then
                ppy = ppy - 1
                ppx = ppx + 1
            End If
        Case "1"
            If pstamina > 0 And Point(ppx - 1, ppy + 1) <> Kdgrey Then
                ppy = ppy + 1
                ppx = ppx - 1
            End If
        Case "3"
            If pstamina > 0 And Point(ppx + 1, ppy + 1) <> Kdgrey Then
                ppy = ppy + 1
                ppx = ppx + 1
            End If
        Case "5", "."
            If Int(1 + Rnd * 50) < phealth And pstamina < 100 Then pstamina = pstamina + Int(1.5 + Rnd * (phealth / 25))
    End Select
    If Point(ppx, ppy) = krubble Then pwounds = pwounds + checkrubble(ppx, ppy)
    If Point(ppx, ppy) = kcrystal Then pwounds = pwounds + checkcrystal(ppx, ppy)

    If Int(1 + Rnd * 80 + pwounds) > phealth Then pstamina = pstamina - 1
    If Point(ppx, ppy) = kslime Then
        Print "The slime is nauseating...";
        If Int(Rnd * 120) > phealth Then phealth = phealth - Int(Rnd * 4)
        If Int(Rnd * 120) > phealth Then
            Select Case Int(1 + Rnd * 6)
                Case 1, 2, 3
                    Print " it's making you itch."
                Case 4, 5, 6
                    Print " it's feel's like it is burning you."
                    wounds = wounds + Abs(Int(Rnd * 2 - Rnd * 2))
            End Select
        End If
    End If
    If Point(ppx, ppy) = kwater Then ptemp = ptemp - Int(Abs(Rnd * 2 - Rnd * 2))
    If Point(ppx, ppy) = klava Then
        ptemp = ptemp + 100
        dmg = 10 + Int(Rnd * 20)
        pwounds = pwounds + dmg
        Print "YOU ARE STANDING IN LAVA !!!"
        Print "....suffering "; dmg; " points of damage !"
    End If
    If ptemp < 0 Then
        Print "You are dangerously COLD .... brrrrr"
        pstamina = pstamina - Int(Rnd * 2)
        If Int(1 + Rnd * (50 + Abs(ptemp))) > pstamina Then
            pwounds = pwounds + Int(1 + Rnd * 2)
            phealth = phealth - Int(Rnd * 2)
        End If
    End If
    tcheck = ptemp + Rnd * 10
    If tcheck > 108 Then
        pstamina = pstamina - 1
        Print "You are dangerously warm!"
        If Int(1 + Rnd * ptemp) > pstamina Then
            pwounds = pwounds + 1
            phealth = phealth - Int(Rnd * 2)
        End If
    End If
    'If Point(ppx, ppy) = (kfloor2 Or kfloor3 or kfloor4 or klgrey) Then
    If ptemp < 98 Then ptemp = ptemp + 1
    If ptemp > 98 Then ptemp = Int((ptemp + 98) / 2)
    ' End If
    If pstamina < 20 Then
        Print "You are ";
        If pstamina < 1 Then
            Print "exhausted."
        Else
            Print "fatigued."
        End If
    End If
    If wounds > phealth Then
        Print "You are in intense pain !"
        pstamina = pstamina = Int(Rnd * 2)
    End If
    If Point(ppx, ppy) = kexit Then
        Print
        Print "YOU HAVE FOUND THE EXIT"
        Print
        Print "it took you "; turn; " turns after starting "; start_dx; " spaces away from the exit."
        Print
        kk$ = Chr$(27)
    End If
    If phealth < 1 Or pwounds > 99 Then
        Print "YOU HAVE PERISHED DUE TO YOUR POOR CONDITION."
        Print
        Print "(press any key to continue)"
        any$ = Input$(1)
        kk$ = Chr$(27)
    End If
Loop Until kk$ = Chr$(27)
Print "GAME OVER"
Print "play again?"
Print "Y or N?"
Do
    ask$ = Input$(1)
    ask$ = UCase$(ask$)
Loop Until ask$ = "Y" Or ask$ = "N"
If ask$ = "Y" Then
    Screen cmap
    GoTo restartdungeon
End If
System
'SUBS======================================================================
'$INCLUDE: 'DTDtiles.bi'
'==========================================================================
Sub bisectrect (r)
    If r > 0 Or r < rect_count + 1 Then
        Select Case Int(1 + Rnd * 6)
            Case 1, 2, 3 'vertical split
                tries = 0
                Do
                    tries = tries + 1
                    vpercent = (Int(1 + Rnd * 4) + Int(1 + Rnd * 4)) * .1
                Loop Until vpercent * rect(r).ww >= min_rectd And vpercent * rect(r).hh >= min_rectd Or tries > 7
                If tries < 8 Then
                    oldWW = Int(rect(r).ww * vpercent)
                    newX = rect(r).xx + oldWW
                    newWW = rect(r).ww - oldWW
                    If oldWW >= min_rectd And newWW >= min_rectd Then
                        rect(r).ww = oldWW
                        newrect newX, rect(r).yy, newWW, rect(r).hh, rect(r).lk, rect(r).fk
                    End If
                End If
            Case 4, 5, 6 'horizontal split
                tries = 0
                Do
                    tries = tries + 1
                    vpercent = (Int(1 + Rnd * 4) + Int(1 + Rnd * 4)) * .1
                Loop Until vpercent * rect(r).ww >= min_rectd And vpercent * rect(r).hh >= min_rectd Or tries > 7
                If tries < 8 Then
                    oldHH = Int(rect(r).hh * vpercent)
                    newYY = (rect(r).yy + oldHH)
                    newHH = rect(r).hh - oldHH
                    If oldHH >= min_rectd And newHH >= min_rectd Then
                        rect(r).hh = oldHH
                        newrect rect(r).xx, newYY, rect(r).ww, newHH, rect(r).lk, rect(r).fk
                    End If
                End If

        End Select
    End If
End Sub

Sub wrect (rx, ry, ww, hh, line_klr As _Unsigned Long, fill_klr As _Unsigned Long)
    If fill_klr > 0 Then Line (rx, ry)-(rx + ww - 1, ry + hh - 1), fill_klr, BF
    If line_klr > 0 Then Line (rx, ry)-(rx + ww - 1, ry + hh - 1), line_klr, B
End Sub

Sub drawrect (r)
    wrect rect(r).xx, rect(r).yy, rect(r).ww, rect(r).hh, rect(r).lk, rect(r).fk
End Sub

Sub newrect (XX, YY, WW, HH, klk, kfl)
    rect_count = rect_count + 1
    ReDim _Preserve rect(rect_count) As rect_type
    rect(rect_count).xx = XX
    rect(rect_count).yy = YY
    rect(rect_count).ww = WW
    rect(rect_count).hh = HH
    rect(rect_count).lk = klk
    rect(rect_count).fk = kfl
    rect(rect_count).notes = "newrect"
End Sub
Sub addwater (rno, pcx, pcy, scale)
    prr = Int(6 + Rnd * (12 * scale))
    preps = (3 + Int(Rnd * prr))
    For wr = 1 To preps
        pcxx = pcx + Int(Rnd * (prr / 2)) - Int(Rnd * (prr / 2))
        pcyy = pcy + Int(Rnd * (prr / 2)) - Int(Rnd * (prr / 2))
        rsqrd = prr * prr
        y = -prr
        While y <= prr
            x = Int(Sqr(rsqrd - y * y))
            For x2 = pcxx - x To pcxx + x
                If x2 >= rect(rno).xx And x2 <= rect(rno).xx + rect(rno).ww Then
                    If pcyy + y >= rect(rno).yy And pcyy + y <= rect(rno).yy + rect(rno).hh Then
                        kk = Point(x2, pcyy + y)
                        If kk = Klgrey Then
                            PSet (x2, pcyy + y), kwater
                        End If
                    End If
                End If
            Next
            y = y + 1
        Wend
        prr = Int((prr + Int(6 + Rnd * (12 * scale))) / 2)
    Next
End Sub
Sub addslime (rno, pcx, pcy, scale)
    prr = Int(5 + Rnd * (10 * scale))
    preps = (3 + Int(Rnd * prr))
    For wr = 1 To preps
        pcxx = pcx + Int(Rnd * (prr / 2)) - Int(Rnd * (prr / 2))
        pcyy = pcy + Int(Rnd * (prr / 2)) - Int(Rnd * (prr / 2))
        rsqrd = prr * prr
        y = -prr
        While y <= prr
            x = Int(Sqr(rsqrd - y * y))
            For x2 = pcxx - x To pcxx + x
                If x2 >= rect(rno).xx And x2 <= rect(rno).xx + rect(rno).ww Then
                    If pcyy + y >= rect(rno).yy And pcyy + y <= rect(rno).yy + rect(rno).hh Then
                        kk = Point(x2, pcyy + y)
                        If kk = Klgrey Or kk = kwater Then
                            PSet (x2, pcyy + y), kslime
                        End If
                    End If
                End If
            Next
            y = y + 1
        Wend
        prr = Int((prr + Int(6 + Rnd * (12 * scale))) / 2)
    Next
End Sub
Sub addlava (rno, pcx, pcy, scale)
    prr = Int(5 + Rnd * (10 * scale))
    preps = (3 + Int(Rnd * prr))
    For wr = 1 To preps
        pcxx = pcx + Int(Rnd * (prr / 2)) - Int(Rnd * (prr / 2))
        pcyy = pcy + Int(Rnd * (prr / 2)) - Int(Rnd * (prr / 2))
        rsqrd = prr * prr
        y = -prr
        While y <= prr
            x = Int(Sqr(rsqrd - y * y))
            For x2 = pcxx - x To pcxx + x
                If x2 >= rect(rno).xx And x2 <= rect(rno).xx + rect(rno).ww Then
                    If pcyy + y >= rect(rno).yy And pcyy + y <= rect(rno).yy + rect(rno).hh Then
                        kk = Point(x2, pcyy + y)
                        If kk = Klgrey Or kk = kwater Or kk = kslime Then
                            If kk = kwater Then
                                If Abs(y) < prr / 2 Then
                                    PSet (x2, pcyy + y), klava
                                Else
                                    Select Case Int(1 + Rnd * 12)
                                        Case 1, 2, 3, 4, 5
                                            PSet (x2, pcyy + y), klava
                                        Case 6, 7, 8
                                            PSet (x2, pcyy + y), krubble
                                        Case 9, 10
                                            PSet (x2, pcyy + y), Klgrey
                                        Case 11
                                            PSet (x2, pcyy + y), Kdgrey
                                        Case 12
                                            PSet (x2, pcyy + y), kcrystal
                                    End Select
                                End If
                            Else
                                PSet (x2, pcyy + y), klava
                            End If
                        End If
                    End If
                End If
            Next
            y = y + 1
        Wend
        prr = Int((prr + Int(6 + Rnd * (12 * scale))) / 2)
    Next
End Sub

Sub addfungus (rno, pcx, pcy, scale)
    prr = Int(2 + Rnd * (2 * scale))
    preps = (3 + Int(Rnd * prr))
    For wr = 1 To preps
        pcxx = pcx + Int(Rnd * (prr / 2)) - Int(Rnd * (prr / 2))
        pcyy = pcy + Int(Rnd * (prr / 2)) - Int(Rnd * (prr / 2))
        rsqrd = prr * prr
        y = -prr
        While y <= prr
            x = Int(Sqr(rsqrd - y * y))
            For x2 = pcxx - x To pcxx + x
                If x2 >= rect(rno).xx And x2 <= rect(rno).xx + rect(rno).ww Then
                    If pcyy + y >= rect(rno).yy And pcyy + y <= rect(rno).yy + rect(rno).hh Then
                        kk = Point(x2, pcyy + y)
                        If kk = Klgrey Or kk = kwater Then
                            If Int(1 + Rnd * 100) <= 30 Then PSet (x2, pcyy + y), kfungus
                        End If
                    End If
                End If
            Next
            y = y + 1
        Wend
        prr = Int((prr + Int(6 + Rnd * (12 * scale))) / 2)
    Next
End Sub
Function checkrubble (xx, yy)
    stumblecheck = Int(1 + Rnd * 120)
    dmg = 0
    If stumblecheck > health Then
        Print "whooops.... you stumbled on the rubble...";
        Select Case Int(1 + Rnd * 20)
            Case 1
                If Point(ppx - 1, ppy - 1) <> Kdgrey Then
                    ppx = ppx - 1: ppy = ppy - 1
                End If
            Case 2
                If Point(ppx, ppy - 1) <> Kdgrey Then
                    ppy = ppy - 1
                End If
            Case 3
                If Point(ppx + 1, ppy + 1) <> Kdgrey Then
                    ppx = ppx + 1: ppy = ppy + 1
                End If
            Case 4
                If Point(ppx - 1, ppy) <> Kdgrey Then
                    ppx = ppx - 1
                End If
            Case 6
                If Point(ppx + 1, ppy) <> Kdgrey Then
                    ppx = ppx + 1
                End If
            Case 7
                If Point(ppx - 1, ppy + 1) <> Kdgrey Then
                    ppx = ppx - 1: ppy = ppy + 1
                End If
            Case 8
                If Point(ppx, ppy + 1) <> Kdgrey Then
                    ppy = ppy + 1
                End If
            Case 9
                If Point(ppx + 1, ppy + 1) <> Kdgrey Then
                    ppy = ppy + 1: ppx = ppx + 1
                End If
            Case 10, 11, 12, 13, 14
                Print " knocking the wind out of you... ";
                pstamina = Int(pstamina / 4)
            Case 15, 16, 17, 18, 19, 20
                ppx = lastx: ppy = lasty
                Print "you tumble back...";
        End Select
        dmg = Abs(Int((Rnd * 3) - (Rnd * 3)))
        If dmg > 0 Then
            Print "you suffer "; dmg; " points of damage!"
        Else
            Print "."
        End If
    End If
    checkrubble = dmg
End Function
Sub addcornerrubble (rno)
    numcorn = Int(1 + Rnd * 4)
    For crr = 1 To numcorn
        Select Case Int(Rnd * 5)
            Case 1
                crx = rect(rno).xx + 1
                cry = rect(rno).yy + 1
            Case 2
                crx = rect(rno).xx + 1
                cry = rect(rno).yy + rect(rno).hh - 2
            Case 3
                crx = rect(rno).xx + rect(rno).ww - 2
                cry = rect(rno).yy + 1
            Case 4
                crx = rect(rno).xx + rect(rno).ww - 2
                cry = rect(rno).yy + rect(rno).hh - 2
        End Select
        prr = Int((rect(rno).hh + rect(rno).ww) / 12)
        rsqrd = prr * prr
        y = -prr
        While y <= prr
            x = Int(Sqr(rsqrd - y * y))
            For x2 = crx - x To crx + x
                If x2 >= rect(rno).xx And x2 <= rect(rno).xx + rect(rno).ww Then
                    If cry + y >= rect(rno).yy And cry + y <= rect(rno).yy + rect(rno).hh Then
                        kk = Point(x2, cry + y)
                        If kk = Klgrey And Int(1 + Rnd * 100) < (cornerrubblechance * 2.5) Then
                            PSet (x2, cry + y), krubble
                        End If
                    End If
                End If
            Next
            y = y + 1
        Wend
    Next crr
End Sub

Function checkcrystal (xx, yy)
    climbcheck = Int(1 + Rnd * 100)
    If climbcheck > phealth Then
        Print "You just can't gain any purchase to climb the crystal."
    Else
        stumblecheck = Int(1 + Rnd * 120)
        dmg = 0
        If stumblecheck > health Then
            Print ".... you fell from the crytsal...";
            Select Case Int(1 + Rnd * 9)
                Case 1
                    If Point(ppx - 1, ppy - 1) <> Kdgrey Then
                        ppx = ppx - 1: ppy = ppy - 1
                    End If
                Case 2
                    If Point(ppx, ppy - 1) <> Kdgrey Then
                        ppy = ppy - 1
                    End If
                Case 3
                    If Point(ppx + 1, ppy + 1) <> Kdgrey Then
                        ppx = ppx + 1: ppy = ppy + 1
                    End If
                Case 4
                    If Point(ppx - 1, ppy) <> Kdgrey Then
                        ppx = ppx - 1
                    End If
                Case 5
                    ppx = lastx: ppy = lasty
                Case 6
                    If Point(ppx + 1, ppy) <> Kdgrey Then
                        ppx = ppx + 1
                    End If
                Case 7
                    If Point(ppx - 1, ppy + 1) <> Kdgrey Then
                        ppx = ppx - 1: ppy = ppy + 1
                    End If
                Case 8
                    If Point(ppx, ppy + 1) <> Kdgrey Then
                        ppy = ppy + 1
                    End If
                Case 9
                    If Point(ppx + 1, ppy + 1) <> Kdgrey Then
                        ppy = ppy + 1: ppx = ppx + 1
                    End If
            End Select
            dmg = Abs(Int((Rnd * 4) - (Rnd * 4)))
            If dmg > 0 Then
                Print "you suffer "; dmg; " points of damage!"
            Else
                Print "."
            End If

        End If
    End If
    checkcrystal = dmg
End Function
Sub coltileat (tn, ktc, xx, yy)
    Dim kc As _Unsigned Long
    _Source tiles&
    _Dest ms
    tx = tilespot(tn, 1): ty = tilespot(tn, 2)
    For px = 0 To 16
        For py = 0 To 15
            kc = Point(tx + px, ty + py)
            If kc <> Kblack Then
                PSet (xx + px, yy + py), ktc
            End If
        Next py
    Next px
    _Source dmap
End Sub
Function getwalltile
    wt = Int(1 + Rnd * 8)
    Select Case wt
        Case 1, 2, 3
            wt = 8
        Case 4, 5
            wt = 15
        Case 6
            wt = 14
        Case 7
            wt = 11
        Case 8
            wt = 12
    End Select
    getwalltile = wt
End Function

Here's the tile set and loading function "DTDtiles.bi"
 
Code: (Select All)
'DeathTestDungeon Tileset
'Tiles are original and modifed versions of a monochrome tileset Distributed for use
'for private and commercial projects with no licensing or credit required
'
'The data and function are made possible due to DAV's BASIMAGE progam available here:
'https://staging.qb64phoenix.com/showthread.php?tid=217
'
Function Loadtileset1& 'smallrogue01.png
    v& = _NewImage(768, 176, 32)
    Dim m As _MEM: m = _MemImage(v&)
    A$ = ""
    A$ = A$ + "ha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6]^ogXL][M][M][M][M]["
    A$ = A$ + "M][M][M][M][m;KAokf#5oZONJlMboWV[kliYcMdOGGVk_NfClk8m6k_kFoC"
    A$ = A$ + "MOWo>I^J[gPnkJGkJafYnK1?ao^1^fe^fi\kkooLlLW?W`7MN_i\l0UWIm6e"
    A$ = A$ + "O?1ogmmoWZn[^6cm[dFkjofP:MPjm[dUIgOB]`en]\Cm>W_QgmUM71K=h4GU"
    A$ = A$ + "k=El_fo>7N:loJ6R?DNVjKgjnncA_[cCSoKim4jnnk_93]g6mOkPc_SNo#UO"
    A$ = A$ + "7YcHomD_oODniLOfgC^[VZcN`MOo[M]^_okoPcii?EcKk>fO6[>?34]oU=f>"
    A$ = A$ + "iPK\_F\nY[nodeBWjFU7Z`anN=IlOgna9haoik>hkXQV0OWlo9ii_m?IW;HN"
    A$ = A$ + "^Xj_GSQc_SdI\oNRjO2nK=gZjEXIR<lImS8^ain8]EENM][m?6cN6EoXP_Kl"
    A$ = A$ + "MSkWW_J^92Ce\VblVCl[`Sb_MYOj4_Yc?ghgU_f=?_[nFWjQM61M6Ukm6=ei"
    A$ = A$ + "f<N\Sf[;n_UgCXjmeHnl=I<__:jI=:of5GFNZnk^eo4lgZFXB_dA;55S[M]g"
    A$ = A$ + "TQV=[^7jMVHelIc]>HENG^ZmKEci\l2CMTU3^HMjUIaWUo[fkbRObmSZnDAc"
    A$ = A$ + "h`5CMnYc5eWQYN?fL8kM6nVNVYbLK5GfAke5OWlo9ii>O>Q?RfCklkZl:knX"
    A$ = A$ + "Wajn<H7MRc_kFoIGSmn<?_=kiIZJAT6>BKXLo\WIQ^oe^fo[eiio\J9gHdmM"
    A$ = A$ + "CHmOd<BflT:Fdn4VmAIc]CT3[iBf_IifZmHEa5Ukkf7>eMGlkNW<Sok>SU53"
    A$ = A$ + "fJ3YQSR?CoNW6C_gYW^b5ZjMUN:C_N:NI2mKVV`mcCJ8NCA_ilkENDmgAjMe"
    A$ = A$ + "OGiCgkSl_2WbXmHWUZZ3f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oCLoZW"
    A$ = A$ + "g6YEbd?EWi=Ze^feR<gWm_[lhYSYcm#LHWlXcc?oFOoQgPeUk^L_>O=aIN3f"
    A$ = A$ + "mmoOVgoORgm_[?Vhm`AiEfm[N7DVO?AO^kkogYnc^Vkm[d4Eog=X>CDUOAL6"
    A$ = A$ + "cmcNW=dm_fe^foW5=SLZiUk<je^fgYMOookoooEZc<NRmi?^og1dmo^UXnUj"
    A$ = A$ + "_WhmocNGGUkGm^c8>_S6SEO_[kO][M][M][M]I\kkooMloooCoIFMcnO?Pkk"
    A$ = A$ + "mWacWhmokDoCOO6nfa7\JQ8obNOdo=<>inen]]o7JMYZ%%%0"
    btemp$ = ""
    For i& = 1 To Len(A$) Step 4: B$ = Mid$(A$, i&, 4)
        If InStr(1, B$, "%") Then
            For C% = 1 To Len(B$): F$ = Mid$(B$, C%, 1)
                If F$ <> "%" Then C$ = C$ + F$
            Next: B$ = C$: End If: For j = 1 To Len(B$)
            If Mid$(B$, j, 1) = "#" Then
        Mid$(B$, j) = "@": End If: Next
        For t% = Len(B$) To 1 Step -1
            B& = B& * 64 + Asc(Mid$(B$, t%)) - 48
            Next: X$ = "": For t% = 1 To Len(B$) - 1
            X$ = X$ + Chr$(B& And 255): B& = B& \ 256
    Next: btemp$ = btemp$ + X$: Next
    btemp$ = _Inflate$(btemp$)
    _MemPut m, m.OFFSET, btemp$: _MemFree m
    Loadtileset1& = _CopyImage(v&): _FreeImage v&
End Function
Reply
#2
Here's a list of the tiles in the tileset I'm using, just in case you want them for reference.

Tile list of tiles in "DTDtiles.bi"

0 - blank 
=== PATHS ===
1 - Leafy path
2- rocky path
3- stone path
4 - big stone path
5 - sparse grass
6 - heather  (leaves and tiny flowers)
7 - raked earth (variegated pattern)
=== INERIORS ===
8 - Wall
9 - Wall with center column
10 - Wall with edge column
11 - Wall2
12 - Wall3
13 - Wall4
14 - Wall5 - Big Masonry
15 - wall6 - big rock wall
16 - OPEN DOOR
17 - Closed Wooded door
18 - Closed Locked door
19 - Magical Door
20 - Iron Door
21 - Cell Door
22 - Barred Door
23 - Panel Door
24 - STAIRS UP
25 - Stairs down
26 - Ladder up
27 - ladder down
28 - Rope up (through hole)
29 - Rope down (through hole)
30 - Shaft in ceiling
31 - PIT, Hole, Or Shaft in floor
32 - Mirror
33 - stool
34 - table
35 - Bed
36 - Cauldron or Urn--- pot
37 - Treasure Chest
38 - Shelves
39 - Crate
40 - Torch in sconce 1
41 - Torch in sconce 2
42 - candles
43 - Fire --campfire
44 - Blazing Fire
45 - Hunting Trophy
46 - SWITCH LEFT
47 - SWITCH RIGHT

=== OUTDOOR ===
48 - Tree 1  (pine)
49 - Tree 2  (alt pine)
50 - Tree 3
51 - Tree Pair
52 - Tree 4
53 - Tree 5
54 - Cactus
55 - Cactus Pair
56 - Mushroom
57 - Mushroom Pair
58 - VINE or beanstalk
59 - Tree Pair 2 (pine)
60 - Tree 6 (mighty oak)
61 - BIG ROCKS (boulders)
62 - Bramble
63 - Palm
64 - plowed field
65 - seeded field
66 - sprouts in field
67 - Crop A
68 - Crop B
69 -  Crop C (Cabbages?)
70 - Crop D
71 - Crop E  (tall grain or corn)
72 - SIGN POST
73 - grave 1
74 - grave 2
75 - grave 3
76 - grave 4
77 - grave 5 or Mound of Dirt
78 - Sealed Crypt door
79 - Open Crypt Door
80 - OPEN FENCE GATE
81 - Closed Fence Gate
82 - Closed Metal Gate
83 - Low Fence
84 - High Fence 1
85 - High Fence 2
86 - Metal Fence
87 - Broken Metal Fence
88 - WELL
89 - Puddle
90 - Fountain
91 - Geyser
92 - BONES - People
93 - BONES - cowskull
94 - Bones - generic bone
95 - Bones - Dino Skull
=== TOWN ===
96 - Roof 1
97 - Roof 2
98 - Roof 3
99 - Roof up from left  - BRIDGE LEFT
100 - roof flat top    - BRIDGE CENTER
101 - Roof up from right - BRIDGE RIGHT
102 - chimney top
103 - steeple top
104 - Window 1 - barred window 1
105 - Window 2
106 - Window 3
107 - Window 4 - barred window 2
108 - Window 5 - cross window
109 - Window 6 - modern house window
110 - Window 7 - arrow slit 1
111 - Window 8 - arrow slit 2
112 - HOLE IN WALL
113 - boarded up hole in wall or window
114 - Old Archway (open door 2)
115 - Crumbling Doorway  (open door 3)- crumbled door
116 - ruin wall left(low on left)
117 - ruined wall 2 (low on right)
118 - ruined wall 3 (low in middle)
119 - rubble
120 - SIGN - generic
121 - Sign- tavern
122 - sign- Inn
123 - Sign - food or provisons
124 - Sign - Alchemy
125 - Sign - gambling-casino
126 - Sign - armorer
127 - sign - weaponeer or weapon trainer

== PIPES ==
128 - PIPE - ground left 
129 - pipe - horizontal
130 - pipe - horizontal with CONTROL VALVE
131 - pipe - horizontal with support
132 -  pipe ground right
133 - pipe vertical
134 - pipe left to vertical up
135 - pipe right to vertical up

== ADDITONAL TERRAIN ==
136 - SHALLOW WATER
137 - DEEP WATER
138 - WEB
139 - Mosaic 1
140 - Mosaic 2
141 - Grass
142 - big LOCK
143 - Machinery

=== MONSTERS ====
144 - Generic Goon1
145 - Goon2 - spear
146 - Goon3 - polearm
147 - Goon4 -  sword and shield
148 - trooper1 - sword and shield
149 - trooper2 - spear and shield
150 - Knight- unarmed
151 - Knight - armed
152 - Brute
153 - Brute2
154 - Brute3 - Bugabear
155 - Brute4- Cyclops
156 - Brute5
157 - Brute6- Gump
158 - Devilkin with fork
159 - Devlikin with sword

===Cultists and Thugs ===
160 - cultist
161 - cultist with staff
162 - cultist with sword
163 - cultist with spear
164 - faceless cultist
165 - faceless cultist with staff
166 - faceless cultist with sword
167 - faceless cultist with spear
168 - mystery cultist
169 - mystery cultist with staff
170 - mystery cultist with sword
171 - mystery cultist with spear
172 - Hooded Cultist
173 - Hooded cultist with Staff
174 - Hooded cultist with sword
175 - Hooded Cultists with spear

=== Mants ===
176 - Mant Drone
177 - Mant with sword
178 - Mant with sword and shield-mansns
179 - mant with polearm
180 - mant Brute
181 - mant Brain
182 - mant noble
183 - mant mutant
(191 - Mant Scout)

=== Bugs ===
184 - Scorpion
185 - Crab
186 - Wasp or Bee
187 - Claw bug
188 - Spider
189 - Beetle
190 - Ant
191 - Bug Sprite or Mant Scout

=== Dwarves ===
192 - dwarf
193 - dwarf with sword
194 - dwarf with spear
195 - dwarf with polearm
196 - armored dwarf with sword
197 - armored dwarf with spear
198 - armored dwarf with polearm
199 - dwarf with staff
200 - dwarf king
201 - dwarf queen

=== pixies ===
202 - Pixie
203 - pixie stick , sword or wand
204 - pixie with two swords
205 - pixie sparkling

=== brownies ===
206 - Brownie
207 - Brownie with sword
208 - Brownie with Axe
209 - brownie with spear
210 - armored brownie with spear
211 - armored brownie with polearm
212 - armored brownie with sword
213 - brownie lord

=== Octons ===
214 - Octon with sword
215 - octon with trident
216 - octon with sword and trident
217 - octon with two swords
218 - armored octon with two swords
219 - armored octon with sword and trident
220 - octon wizard
221 - octon noble

== bats ===
222  - bat
223 - Razor-clawed bat
224 - stingbat
225 - Gallows Bat
226 - Sickle Bat
227 - Flail Bat

=== batkin ===
228 - batkin with blade
229 - batkin with fork
230 - batkin with 2 blades
231 - batkin with battle axe

=== boggarts ===
232 - boggart
233 - boggart with spear
234 - boggart with blade
235 - boggart with axe (or hammer)
236 - boggart with staff
237 - armored boggart with spear
238 - armored boggart with blade
239 - armored boggart with axe (or hammer)

=== Undead ===
240 - skeleton
241 - skeleton with spear
242 - skeleton with sword
243 - skeleton with 2 swords
244 - spook 1
245 - spook 2
246 - spook 3
247 - spook 4
248 - wraith 1
249 - wraith 2
250 - wraith king
251 - hopping skull
252 - skull bat
253 - Zombie
254 - spine snake
255 - Necron 1
256 - Necron 2
257 - Necron Lord
258 - Ghoul
259 - Mummy
260 - Mummy Guardian
261 - Noble Mummy
262 - Mummy Champion
263 - Anubian Mummy
264 - Magi 1
265 - Magi 2
266 - Magi 3
267 - Magi 4
268 - Magi 5
269 - Magi 6
270 - Magi 7
271 - Magi 8

=== freaks ===
272 - Flying eye
273 - Cactus Creep
274 - Mad Tree
275 - Shroomian
276 - Trifid or giant flytrap
277 - Blob
278 - Bigger Blob
279 - unicycle golem
280 - golem 2
281 - golem 3
282 - golem 4
283 - golem 5
284 - mermaid, merrow or undine
285 - mysterious visitor
286 - mysterious visitor 2
287 - mysterious visitor 3

=== beasts ===
288 - Big Rat
289 - Giant Rat
290 - Giant Worm
291 - Crocigator
292 - Bear
293 - Octopus or Kraken
294 - Duck
295 - Chicken
296 - Cow
297 - Horse
298 - Hog
299 - Cat
300 - Dog
301 - Stag or Moose
302 - Moof or Donkey
303 - Monoceros or Unicorn
304 - Person 1
305 - person 2
306 - person 3
307 - person 4
308 - person 5
309 - person 6
310 - Lord
311 - Lady
312 - boy
313 - girl
314 - person 7
315 - person 8
316 - person 9
317 - person 10
318 - person 11
319 - person 12

=== Catkin ===
320 - Catkin
321 - catkin spear and shield
322 - catkin sword and shield in shirt
323 - catkin sword and shield
324 - catkin halberd
325 - catkin with spear

=== Doggen === (or Wolfen)
326 -  doggen
327 - doggen with spear
328 - doggen with halberd
329 - doggen with sword and shield

=== Piglin ===
330 - Piglin
331 - Piglin with sword
332 - piglin with spear
333 - piglin with polearm
334 - piglin Lord
335 - piglin Lady

===Trolde===
336 - Trolde
337 - Trolde with spear
338 - Trolde with Polearm
339 - Trolde with sword
340 - Trolde with Staff

=== Trollkin ===
341 - Trollkin
342 - Trollkin with spear
343 - trollkin polearm
344 - trollkin wizard
345 - armored trollkin with spear
346 - armored torllkin with polearm

=== serpents and dragons ===
347 - giant snake
348 - Fire Serpent
349 - Sword Snake
350 - Two-headed giant snake
351 - Snake
352 - Winged Serpent
353 - Wyvern
354 - Dragon
355 - Wyrmme
356 - Drake
357 - Two Headed Drake
358 - Giant Turtle

=== Creeps ===
359 - Grat 
360 - Giant Grat

=== Demons ===
361 - Least Demon
362 - Minor Demon
363 - Lesser Demon
364 - Demon
365 - Demon Greater
366 - Demon Major
367 - Demon Oracle
368 - Demon Prince

== elementals ==
369 - notion 1
370 - notion 2
371 - notion 3
372 - angry fundemental
373 - happy fundemental
374 - sad fundemental
375 - angry elemental
376 - happy elemental
377 - sad elemental
378 - angry elemental noble
379 - happy elemental noble
380 - sad elemental noble
381 - Angry Primal
382 - happy primal
383 - sad primal

== goods, gear, and loot===
384 - coin
385 - piles of coins
386 - shovel
387 - pickaxe
388 - hoe
389 - torch
390 - Dagger
391 - short sword
392 - sword
393 - Long Sword
394 - Great Sword
395 - axe
396 - battle axe
397 - Hammer
398 - war hammer
399 - club
400 - mace
401 - spear
402 - fork
403 - trident
404 - Glaive
405 - Halberd
406 - self bow
407 - arrow
408 - crossbow
409 - quarter staff
410 - Staff-2 -krook
411 - wand
412 - rod
413 - Staff -3- wizardstaff
414 - Buckler
415- Shield
416 - Large Shield
417 - gloves
418 - gauntlets
419 - helmet
420 - Full helm
421 - Jacket
422 - Robes
423 - cuirass, leather armor
424 - hauberk, chainmail
425 - Heavy Armor
426 - boots
427 - saboton (armored boots)
428 - Hat
429 - quiver
430 - belt
431 - pack
432 - gem
433 - huge gem
434 - key 1
435 - key 2
436 - potion 1
437 - potion 2
438 - scroll 1
439 - scroll 2
440 - ring 1
441 - ring 2
442 - amulet 1
443 - amulet 2
444 - meat
445 - cheese
446 - fish
447 - fruit
448 - vegetable
449 - drink,flask
450 - bread
451 - grain, corn, or seeds
452 - leafy veg or herb
453 - soporifc herb
454 - medicinal herb
455 - toxic herb
456 - medicine, phial
457 - bomb
458 - sack
459 - jar

==== splashes and effects===
460 - bubbles 1
461 - sparkles
462 - flash
463 - death
464 - slash
465 - slash 2
466 - slash 3
467 - orbs
468 - flames
469 - comet
470 - blam
471 - bloom
472 - blosom
473 - frost 1
474 - frost 2
475 - flash 2

=== talkies===
476 - excited
477 - curious
478 - sleeping
479 - unhappy

=== ui ===
480 - open up
481 - open left
482 - open down
483 - open left
484 - filled up
485 - filled right
486 - filled down
487 filled left
488 - unchecked radio button
489 - checked radio button
490 - turn left
491 - turn right
492 - up (or straight)
493 - down (or back)
494 - left
495 - right
496 - open checkbox
497 - checked box
498 - marked box
499 - frame, horizontal bottom
500 - frame, horizontal top
501 - frame, vertical left
502 - frame, vertical right
503 - frame, bottom right corner
504 - frame, bottom left corner
505 - frame, top right corner
506 - frame, top left corner

===  fill patterns ===
507 -519  fill patterns
Reply
#3
WOW. So this is what you've been up to while wandering around in that cave. If I ever get out, I'll give this a try. Probably my fault. I keep turning left. I used to drive for NASCAR in my younger days.

Pete
Reply
#4
This is ingenious source code from Dav. I was going to say, "Why doesn't he just use the new functions based on zlib?" Then I took another look and noticed that "_INFLATE$" for example was being used, but something had to be done to guard against those troublesome control characters. Otherwise something like this would have involved base-64. As base-64 the string would have been much larger. One of my requests for QB64PE used to be support for multiline strings. It's because all that concatenation could be very slow, even on 64-bit and quad-core CPU and so on.
Reply
#5
The trick to speeding up string evolution is to use replacement instead of concatenation. Of course this requires some idea of the magnitude of the final string, so a template string can be dimensioned.

Pete
If eggs are brain food, Biden takes his scrambled.
Reply
#6
This is a modification and expansion of the original programs level generation, really just a test so I'm including it here in this thread.   
The fungus can be harvested with "h"  and eaten with "e".
The monsters are just for show currently and don't do much beyond jumping into lava.
The file "DTDtiles.bi" in this thread is required to be in the folder to compile.

Code: (Select All)
'ruingen
'By James D. Jarvis
'testing combination indoor/outdoor roguelike level generation.
'need to have the file 'DTDtiles.bi' in the same folder to compile
'$dynamic
Screen _NewImage(800, 500, 32)
_Title "ruinedcity v0.0"
_Define K As _UNSIGNED LONG
Dim Shared dmap As _Unsigned Long
Dim Shared ms As _Unsigned Long
Dim Shared Kblack, Kwhite, Kdgrey, Klgrey, kredm, kwater, kslime, klava, krubble, kcrystal, kexit, kfungus, kwaste
Dim Shared kfloor2, kfloor3, kfloor4, cornerrubblechance, kgrass, ktree1, ktree2, ktree3, ktree4, kcactus1, kcactus2
Dim Shared mp(1000, 1000) As Integer
Dim Shared tiles&
Dim Shared rect_count As Integer
Type rect_type
    xx As Integer
    yy As Integer
    ww As Integer
    hh As Integer
    lk As _Unsigned Long
    fk As _Unsigned Long
    notes As String
End Type
Type monster_type
    tile As Integer
    mx As Integer
    my As Integer
End Type
Dim Shared monst(300) As monster_type
Dim Shared tilespot(0 To 528, 2) As Integer
Dim Shared rect(0) As rect_type
Dim Shared min_rectd
Dim Shared fillcell, openwallchance, pillarchance, puddleno, slimechance, lavachance, cactuschance, funcguschance
Dim Shared phealth, pstamina, pwounds, ptemp, ppx, ppy, lastx, lasty, prads, rwid, rht, pshrooms
Randomize Timer
Kblack = _RGB32(0, 0, 0) 'this is visible black as 0,0,0 will be "nothing is here" eventually
Kwhite = _RGB32(250, 250, 250) 'this is cooled paper white
kwaste = _RGB32(240, 200, 100)
kcactus1 = _RGB32(240, 201, 101): kcactus2 = _RGB32(240, 201, 102)
Kdgrey = _RGB32(40, 40, 40)
Klgrey = _RGB32(150, 150, 150)
kgrass = _RGB32(170, 200, 50): ktree1 = _RGB32(170, 201, 50): ktree2 = _RGB32(170, 202, 50): ktree3 = _RGB32(170, 203, 50): ktree4 = _RGB32(170, 204, 50)
kfloor2 = _RGB32(151, 151, 151): kfloor3 = _RGB32(152, 152, 152): kfloor4 = _RGB32(153, 153, 153)
kred = _RGB32(250, 0, 0)
kwater = _RGB32(10, 30, 240): kslime = _RGB32(20, 240, 100): klava = _RGB32(200, 5, 5)
krubble = _RGB32(120, 120, 120): kcrystal = _RGB32(250, 250, 0): kexit = _RGB32(255, 0, 255)
kfungus = _RGB32(200, 50, 150)
dmap = _NewImage(1000, 1000, 32)
ms = _NewImage(800, 500, 32)
tiles& = Loadtileset1& 'loads the tileset in the file DTDtiles.bi
Const tilemaxx = 48
Const tilemaxy = 11
t = 0
For y = 0 To tilemaxy - 1
    For x = 0 To tilemaxx - 1
        tilespot(t, 1) = x * 16
        tilespot(t, 2) = y * 16
        t = t + 1
    Next x
Next y
maxtiles = t - 1
fh = _FontHeight
fw = _FontWidth

restartdungeon:
walltile = getwalltile

Screen dmap
_Dest dmap
_Source dmap
_PrintMode _KeepBackground
Color Kdgrey, Kdgrey
rwid = 980
rht = 980

Do
    ReDim rect(0) As rect_type
    makemonsters
    rect_count = 0
    Cls
    newrect 10, 10, rwid, rht, Kdgrey, kwaste
    min_rectd = 40
    'If min_rectd < 4 Then min_rectd = 4
    fillcell = 85
    cornerrubblechance = Int(10 + Rnd * 35)
    puddleno = Int(Rnd * 30)
    slimechance = Int(2 + Rnd * 28)
    lavachance = Int(Rnd * 25)
    funguschance = Int(Rnd * 15)
    cactuschance = Int(10 + Rnd * 30)

    drawrect 1
    bisectrect 1
    n = 0
    min_rectd = Int(1 + Rnd * 30)
    If min_rectd < 10 Then min_rectd = 10

    Do
        'Cls
        For r = 1 To rect_count
            bisectrect r
        Next r
        For r = 1 To rect_count
            drawrect r
        Next r

        _Limit 5
        kk$ = InKey$
        n = n + Int(1 + Rnd * 8)
    Loop Until kk$ <> "" Or n > 90
    kk$ = Chr$(27)
Loop Until kk$ = Chr$(27)
For r = 1 To rect_count
    If Int(1 + Rnd * 100) < fillcell Then
        rect(r).fk = kwaste
        rect(r).lk = kwaste
    Else
        rect(r).fk = Klgrey
    End If
    drawrect r
Next r
For treps = 2 To 4
    current_rect = rect_count

    For r = 1 To current_rect
        min_rectd = 10
        If rect(r).fk = Klgrey Then bisectrect r
    Next r
Next treps
For r = 1 To rect_count 'if there's an open space across a wall open a space in the wall
    If rect(r).fk <> Kdgrey Then
        mx = rect(r).xx + Int(rect(r).ww / 2)
        my = rect(r).yy + Int(rect(r).hh / 2)
        If Point(mx, my + Int(rect(r).hh / 2) + 2) = Klgrey Then
            Line (mx, my)-(mx, my + Int(rect(r).hh / 2) + 2), Klgrey
        End If

        If Point(mx, my - Int(rect(r).hh / 2) - 2) = Klgrey Then
            Line (mx, my)-(mx, my - Int(rect(r).hh / 2) - 2), Klgrey
        End If

        If Point(mx - Int(rect(r).ww / 2) - 2, my) = Klgrey Then
            Line (mx - Int(rect(r).ww / 2) - 2, my)-(mx, my), Klgrey
        End If

        If Point(mx + Int(rect(r).ww / 2) + 2, my) = Klgrey Then
            Line (mx + Int(rect(r).ww / 2) + 2, my)-(mx, my), Klgrey
        End If
    End If
Next r
For y = 11 To rht - 1
    For x = 11 To rwid - 2
        If Point(x, y) = Klgrey And Point(x + 1, y) = Kdgrey And Point(x + 2, y) = Klgrey Then
            PSet (x + 1, y), kred
        End If
        If Point(x, y) = Klgrey And Point(x + 1, y) = kred And Point(x + 2, y) = Kdgrey And Point(x + 3, y) = Klgrey Then
            PSet (x + 2, y), kred
        End If
        If Point(x, y) = kdrgey And Point(x + 1, y) = Klgrey And Point(x + 2, y) = Kdgrey And Point(x + 3, y) = Kdgrey And Point(x + 4, y) = Klgrey And Point(x + 5, y) = Kdgrey Then
            PSet (x + 2, y), Klgrey
            PSet (x + 3, y), Klgrey
        End If
    Next x
Next y

For x = 11 To rwid - 2
    For y = 11 To rht - 2
        If Point(x, y) = Klgrey And Point(x, y + 1) = Kdgrey And Point(x, y + 2) = Klgrey Then
            PSet (x, y + 1), kred
        End If
        If Point(x, y) = Klgrey And Point(x, y + 1) = kred And Point(x, y + 2) = Kdgrey And Point(x, y + 3) = Klgrey Then
            PSet (x, y + 2), kred
        End If
        If Point(x, y) = kdrgey And Point(x, y + 1) = Klgrey And Point(x, y + 2) = Kdgrey And Point(x, y + 3) = Kdgrey And Point(x, y + 4) = Klgrey And Point(x, y + 5) = Kdgrey Then
            PSet (x, y + 2), Klgrey
            PSet (x, y + 3), Klgrey
        End If
    Next
Next
aa$ = Input$(1)
For y = 10 To rht
    For x = 10 To rwid
        If Point(x, y) = kred Then PSet (x, y), Klgrey
    Next
Next
Color Kblack, Kwhite
'check to open walls
For r = 1 To rect_count
    If rect(r).fk <> Kdgrey And Int(1 + Rnd * 100) <= openwallchance Then
        Select Case Int(1 + Rnd * 4)
            Case 1
                rect(r).xx = rect(r).xx - 2
                rect(r).ww = rect(r).ww + 2
            Case 2
                rect(r).xx = rect(r).xx + 2
                rect(r).ww = rect(r).ww + 2

            Case 3
                rect(r).yy = rect(r).yy - 2
                rect(r).hh = rect(r).hh + 2
            Case 4
                rect(r).yy = rect(r).yy + 2
                rect(r).hh = rect(r).hh + 2
        End Select
        Line (rect(r).xx, rect(r).yy)-(rect(r).xx + rect(r).ww, rect(r).yy + rect(r).hh), Klgrey, BF
    End If
Next r

'straysspaces
sp = Int(Rnd * 12)
For ss = 1 To sp
    sx = Int(10 + Rnd * rwid - 30)
    sy = Int(10 + Rnd * rht - 30)
    sw = 10 + Int(Rnd * 20)
    sh = 10 + Int(Rnd * 20)
    Line (sx, sy)-(sx + sw, sy + sh), Klgrey, BF
Next
'add wanderingpaths
nwt = Int(Rnd * (12 + fillcell))
For ww = 1 To nwt
    wsx = Int(20 + Rnd * rwid - 50)
    wsy = Int(20 + Rnd * rht - 50)
    wtx = Int(20 + Rnd * rwid - 50)
    wty = Int(20 + Rnd * rht - 50)
    If wsx < wtx Then xtrend = 1
    If wsx > wtx Then xtrend = -1
    If wsy < wty Then ytrend = 1
    If wsy > wty Then ytrend = -1
    sx = wsx
    sy = wsy
    rl = 0
    Do
        nx = sx + Int(xtrend + Rnd * 2 - Rnd * 2)
        ny = sy + Int(ytrend + Rnd * 2 - Rnd * 2)
        If nx < 11 Then
            nx = 11
            xtrend = xtrend * -1
        End If
        If ny < 11 Then
            ny = 11
            ytrend = ytrend * -1
        End If
        If nx > rwid Then
            nx = rwid
            xtrend = xtrend * -1
        End If
        If ny > rht Then
            ny = rht
            ytrend = ytrend * -1
        End If
        dx = Abs(nx - wtx)
        dy = Abs(ny - wty)
        Line (sx, sy)-(nx, ny), Klgrey
        sx = nx
        sy = ny
        rl = rl + 1
    Loop Until dx < 5 And dy < 5 Or rl > rwid + 40
    Line (sx, sy)-(wtx, wty), Klgrey
Next ww

For r = 1 To rect_count 'add pillars
    pillarspread = 2 + Int(Rnd * 7)
    If rect(r).fk <> Kdgrey And Int(1 + Rnd * 100) <= pillarchance Then
        For y = rect(r).yy + pillarspread To rect(r).yy + rect(r).hh - pillarspread Step pillarspread
            For x = rect(r).xx + pillarspread To rect(r).xx + rect(r).ww - pillarspread Step pillarspread
                PSet (x, y), Kdgrey
            Next
        Next
    End If
Next

For pr = 1 To rect_count
    If Int(1 + Rnd * 100) < 35 Then addgrass pr, Int(rect(pr).xx + 1 + Rnd * (rect(pr).ww - 2)), Int(rect(pr).yy + 1 + Rnd * (rect(pr).hh - 2)), Int(1 + Rnd * 3)
    If rect(pr).fk <> Kdgrey And Int(1 + Rnd * 100) <= cornerrubblechance Then
        addcornerrubble pr
    End If
    If rect(pr).fk <> Kdgrey And Int(1 + Rnd * 100) <= puddleno Then
        addwater pr, Int(rect(pr).xx + 1 + Rnd * (rect(pr).ww - 2)), Int(rect(pr).yy + 1 + Rnd * (rect(pr).hh - 2)), Int(1 + Rnd * 3)
    End If
    If rect(pr).fk <> Kdgrey And Int(1 + Rnd * 100) <= slimechance Then
        addslime pr, Int(rect(pr).xx + 1 + Rnd * (rect(pr).ww - 2)), Int(rect(pr).yy + 1 + Rnd * (rect(pr).hh - 2)), Int(1 + Rnd * 3)
    End If
    If rect(pr).fk <> Kdgrey And Int(1 + Rnd * 100) <= lavachance Then
        addlava pr, Int(rect(pr).xx + 1 + Rnd * (rect(pr).ww - 2)), Int(rect(pr).yy + 1 + Rnd * (rect(pr).hh - 2)), Int(1 + Rnd * 3)
    End If
    If rect(pr).fk <> Kdgrey And Int(1 + Rnd * 100) <= funguschance Then
        addfungus pr, Int(rect(pr).xx + 1 + Rnd * (rect(pr).ww - 2)), Int(rect(pr).yy + 1 + Rnd * (rect(pr).hh - 2)), Int(1 + Rnd * 3)
    End If
    If Int(1 + Rnd * 100) < 65 Then addtrees pr, Int(rect(pr).xx + 1 + Rnd * (rect(pr).ww - 2)), Int(rect(pr).yy + 1 + Rnd * (rect(pr).hh - 2)), Int(1 + Rnd * 3)
    If Int(1 + Rnd * 100) < cactuschance Then addcactus pr, Int(rect(pr).xx + 1 + Rnd * (rect(pr).ww - 2)), Int(rect(pr).yy + 1 + Rnd * (rect(pr).hh - 2)), Int(1 + Rnd * 3)


Next pr
'dress floor to make it more interesting
For y = 1 To rht
    For x = 1 To rwid
        kpp = Point(x, y)

        If kpp = kgrass Then
            Select Case Int(1 + Rnd * 100)
                Case 1, 2
                    PSet (x, y), _RGB32(171, 200, 50)
                Case 3, 4
                    PSet (x, y), _RGB32(172, 200, 50)
                Case 5
                    PSet (x, y), _RGB32(173, 200, 50)
            End Select

        End If

        If kpp = Klgrey Then
            Select Case Int(1 + Rnd * 100)
                Case 1, 2
                    PSet (x, y), kfloor2
                Case 3
                    PSet (x, y), kfloor3
                Case 4
                    PSet (x, y), kfloor4
            End Select
        End If
        If kpp = Kdgrey Then 'convert some wall near lava inot rubble
            If Point(x - 1, y) = klava And Int(1 + Rnd * 100) < 30 Then PSet (x, y), krubble
            If Point(x + 1, y) = klava And Int(1 + Rnd * 100) < 30 Then PSet (x, y), krubble
            If Point(x, y + 1) = klava And Int(1 + Rnd * 100) < 30 Then PSet (x, y), krubble
            If Point(x, y - 1) = klava And Int(1 + Rnd * 100) < 30 Then PSet (x, y), krubble
            If Point(x - 2, y) = klava And Int(1 + Rnd * 100) < 10 Then PSet (x, y), krubble
            If Point(x + 2, y) = klava And Int(1 + Rnd * 100) < 10 Then PSet (x, y), krubble
            If Point(x, y + 2) = klava And Int(1 + Rnd * 100) < 10 Then PSet (x, y), krubble
            If Point(x, y - 2) = klava And Int(1 + Rnd * 100) < 10 Then PSet (x, y), krubble
        End If
        If kpp = kwaste Then
            whl = Int(1 + Rnd * 10)
            Select Case whl
                Case 1
                    PSet (x, y), _RGB32(250, 200, 100)
                Case 2
                    PSet (x, y), _RGB32(245, 205, 100)
                Case 3
                    PSet (x, y), _RGB32(245, 200, 105)
                Case 4
                    PSet (x, y), _RGB32(240, 205, 105)
            End Select


        End If


    Next
Next

For e = 0 To 9 'clean edge
    Line (e, e)-(_Width - e, e), Kdgrey: Line (e, e)-(e, _Height - e), Kdgrey: Line (_Width - e, e)-(_Width - e, _Height - e), Kdgrey
Next e
Screen ms
_Source dmap
pick = 0
Do
    pick = pick + 1
    ppx = rect(pick).xx + Int(rect(pick).ww / 2): ppy = rect(pick).yy + Int(rect(pick).hh / 2)
    kk = Point(ppx, ppy)
Loop Until kk <> Kdgrey

lightradius = 10: pstamina = 100: phealth = 100: pwounds = 0: ptemp = 98: prads = 0: pshrooms = 0
turn = 0

Do
    If rec_count > 12 Then
        exitspot = Int(6 + Rnd * (rect_count - 7))
    Else
        exitspot = Int(1 + Rnd * rect_count)
    End If
    exitX = rect(exitspot).xx + Int(rect(exitspot).ww / 2)
    exitY = rect(exitspot).yy + Int(rect(exitspot).hh / 2)
    startX = Abs(exitX - ppx)
    startY = Abs(exitY - ppy)
    start_dx = Sqr(startX * startX + startY * startY)
Loop Until Point(exitX, exitY) <> Kdgrey And exitspot <> pick
_Dest dmap
PSet (exitX, exitY), kexit
_Dest ms
_PrintMode _KeepBackground
View Print 25 To 30
Cls
Do
    'draw location
    rsqrd = (lightradius + .4) * (lightradius + .4)
    y = -lightradius
    While y <= lightradius
        x = Int(Sqr(rsqrd - y * y))
        For x2 = ppx - x To ppx + x
            vx = x2 - ppx + 12
            kk = Point(x2, ppy + y)
            Line (vx * 16, (y + 12) * 16)-(vx * 16 + 15, (y + 12) * 16 + 15), kk, BF
            If kk = ktree1 Then
                coltileat 48, _RGB32(10, 100, 10), vx * 16, (y + 12) * 16
            End If
            If kk = ktree2 Then
                coltileat 49, _RGB32(10, 105, 10), vx * 16, (y + 12) * 16
            End If
            If kk = ktree3 Then
                coltileat 50, _RGB32(15, 105, 10), vx * 16, (y + 12) * 16
            End If
            If kk = ktree4 Then
                coltileat 51, _RGB32(20, 110, 10), vx * 16, (y + 12) * 16
            End If

            If kk = _RGB32(171, 200, 50) Then
                coltileat 5, _RGB32(100, 80, 80), vx * 16, (y + 12) * 16
            End If
            If kk = _RGB32(172, 200, 50) Then
                coltileat 5, _RGB32(90, 110, 80), vx * 16, (y + 12) * 16
            End If
            If kk = _RGB32(173, 200, 50) Then
                coltileat 6, _RGB32(200, 0, 150), vx * 16, (y + 12) * 16
            End If




            If kk = _RGB32(250, 200, 100) Then
                coltileat 2, _RGB32(200, 180, 80), vx * 16, (y + 12) * 16
            End If
            If kk = _RGB32(245, 205, 100) Then
                coltileat 5, _RGB32(140, 150, 10), vx * 16, (y + 12) * 16
            End If
            If kk = _RGB32(245, 200, 105) Then
                coltileat 7, _RGB32(120, 150, 80), vx * 16, (y + 12) * 16
            End If
            If kk = _RGB32(240, 205, 105) Then
                coltileat 3, _RGB32(180, 180, 180), vx * 16, (y + 12) * 16
            End If
            If kk = kcactus1 Then
                coltileat 54, _RGB32(15, 105, 10), vx * 16, (y + 12) * 16
            End If

            If kk = kcactus2 Then
                coltileat 55, _RGB32(15, 105, 10), vx * 16, (y + 12) * 16
            End If

            If kk = Kdgrey Then
                coltileat walltile, _RGB32(100, 100, 100), vx * 16, (y + 12) * 16
            End If
            If kk = kfloor2 Then
                coltileat 2, _RGB32(160, 160, 160), vx * 16, (y + 12) * 16
            End If
            If kk = kfloor3 Then
                coltileat 3, _RGB32(165, 165, 170), vx * 16, (y + 12) * 16
            End If
            If kk = kfloor4 Then
                coltileat 4, _RGB32(175, 165, 165), vx * 16, (y + 12) * 16
            End If

            If kk = kexit Then
                coltileat 24, _RGB32(40, 40, 40), vx * 16, (y + 12) * 16
            End If

            If kk = kfungus Then
                Color _RGB32(250, 100, 200)
                ' _PrintString (vx * 16, (y + 12) * 16), Chr$(234)
                coltileat 57, _RGB32(250, 100, 200), vx * 16, (y + 12) * 16
                Color _RGB32(255, 255, 255)
            End If
            If kk = kcrystal Then
                '_PrintString (vx * 16, (y + 12) * 16), Chr$(127)
                coltileat 433, _RGB32(10, 0, 10), vx * 16, (y + 12) * 16
            End If
            If kk = krubble Then
                Color _RGB32(150, 150, 150)
                '_PrintString (vx * 16, (y + 12) * 16), Chr$(177)
                '61
                coltileat 119, _RGB32(220, 200, 180), vx * 16, (y + 12) * 16
                Color _RGB32(255, 255, 255)
            End If
            If kk = kslime Then
                Color _RGB32(250, 250, 150)
                sb = Int(Rnd * 4)
                'If sb = 1 Then _PrintString (vx * 16, (y + 12) * 16), Chr$(247)
                If sb = 1 Then coltileat 61, _RGB32(250, 250, 150), vx * 16, (y + 12) * 16
                ' If sb = 2 Then _PrintString (vx * 16, (y + 12) * 16), Chr$(126)
                If sb = 2 Then coltileat 61, _RGB32(150, 250, 150), vx * 16, (y + 12) * 16
                Color _RGB32(255, 255, 255)
            End If
            If kk = klava Then
                Color _RGB32(250, 250, 150)
                lb = Int(Rnd * 7)
                'If lb = 1 Then _PrintString (vx * 16, (y + 12) * 16), Chr$(249)
                If lb = 1 Then coltileat 61, _RGB32(250, 250, 150), vx * 16, (y + 12) * 16
                'If lb = 2 Then _PrintString (vx * 16, (y + 12) * 16), Chr$(9)
                If lb = 2 Then coltileat 468, _RGB32(250, 250, 150), vx * 16, (y + 12) * 16
                'If lb = 3 Then _PrintString (vx * 16, (y + 12) * 16), Chr$(176)
                If lb = 3 Then coltileat 461, _RGB32(250, 250, 150), vx * 16, (y + 12) * 16
                'If lb = 4 Then _PrintString (vx * 16, (y + 12) * 16), Chr$(248)
                If lb = 4 Then coltileat 61, _RGB32(250, 0, 0), vx * 16, (y + 12) * 16

                'If lb = 5 Then _PrintString (vx * 16, (y + 12) * 16), Chr$(46)
                If lb = 5 Then coltileat 468, _RGB32(250, 100, 0), vx * 16, (y + 12) * 16
                Color _RGB32(255, 255, 255)
            End If
            If kk = kwater Then
                Color _RGB32(40, 120, 250)
                wb = Int(Rnd * 6)
                'If wb = 1 Then _PrintString (vx * 16, (y + 12) * 16), Chr$(45)
                If wb = 1 Then coltileat 136, _RGB32(40, 120, 250), vx * 16, (y + 12) * 16
                If wb = 2 Then coltileat 136, _RGB32(40, 120, 250), vx * 16, (y + 12) * 16
                If wb = 3 Then _PrintString (vx * 16 + 4, (y + 12) * 16), Chr$(240)
                Color _RGB32(255, 255, 255)
            End If
            If mp(x2, ppy + y) >= 1 Then
                coltileat monst(mp(x2, ppy + y)).tile, _RGB32(10, 10, 10), (vx) * 16, (y + 12) * 16
            End If
        Next

        y = y + 1
    Wend
    Line (598, 18)-(795, 144), Kdgrey, BF
    '_PrintString ((12) * 8, (12) * 16), "@"
    If ptemp > 199 Then coltileat 470, _RGB32(40, 0, 0), (12) * 16, (12) * 16
    coltileat 304, _RGB32(250, 250, 250), (12) * 16, (12) * 16
    o$ = "Stamina " + Str$(pstamina)
    _PrintString (600, 20), o$
    o$ = "Health " + Str$(phealth)
    _PrintString (600, 40), o$
    o$ = "Wounds " + Str$(pwounds)
    _PrintString (600, 60), o$
    dptemp = 0.1 * (Int(ptemp * 10))
    o$ = "Temperature " + Str$(dptemp)
    _PrintString (600, 80), o$
    o$ = "Radiation " + Str$(prads)
    _PrintString (600, 100), o$

    edd = Int(Sqr((ppx - exitX) * (ppx - exitX) + (ppy - exitY) * (ppy - exitY)))
    o$ = "Distance to Exit " + Str$(edd)
    _PrintString (600, 120), o$
    Print "Turn", turn
    handlemonsters
    minimap
    Do
        _Limit 60
        kk$ = InKey$
    Loop Until kk$ <> ""
    turn = turn + 1
    lastx = ppx
    lasty = ppy
    Select Case kk$
        Case "e", "E"
            eatshrooms
        Case "h", "H"
            pshrooms = pshrooms + harvestfungus

        Case "w", "8"
            If pstamina > 0 And Point(ppx, ppy - 1) <> Kdgrey Then ppy = ppy - 1
        Case "s", "2"
            If pstamina > 0 And Point(ppx, ppy + 1) <> Kdgrey Then ppy = ppy + 1
        Case "a", "4"
            If pstamina > 0 And Point(ppx - 1, ppy) <> Kdgrey Then ppx = ppx - 1
        Case "d", "6"
            If pstamina > 0 And Point(ppx + 1, ppy) <> Kdgrey Then ppx = ppx + 1
        Case "7"
            If pstamina > 0 And Point(ppx - 1, ppy - 1) <> Kdgrey Then
                ppy = ppy - 1
                ppx = ppx - 1
            End If
        Case "9"
            If pstamina > 0 And Point(ppx + 1, ppy - 1) <> Kdgrey Then
                ppy = ppy - 1
                ppx = ppx + 1
            End If
        Case "1"
            If pstamina > 0 And Point(ppx - 1, ppy + 1) <> Kdgrey Then
                ppy = ppy + 1
                ppx = ppx - 1
            End If
        Case "3"
            If pstamina > 0 And Point(ppx + 1, ppy + 1) <> Kdgrey Then
                ppy = ppy + 1
                ppx = ppx + 1
            End If
        Case "5", "."
            If Int(1 + Rnd * 50) < phealth And pstamina < 100 Then pstamina = pstamina + Int(1.5 + Rnd * (phealth / 25))
    End Select
    If Point(ppx, ppy) = krubble Then pwounds = pwounds + checkrubble(ppx, ppy)
    If Point(ppx, ppy) = kcrystal Then pwounds = pwounds + checkcrystal(ppx, ppy)
    If Point(ppx, ppy) = ktree1 Then
        ppx = lastx: ppy = lasty
    End If
    If Point(ppx, ppy) = ktree2 Then
        ppx = lastx: ppy = lasty
    End If
    If Point(ppx, ppy) = ktree3 Then
        ppx = lastx: ppy = lasty
    End If
    If Point(ppx, ppy) = ktree4 Then
        ppx = lastx: ppy = lasty
    End If
    If Point(ppx, ppy) = kcactus1 Or Point(ppx, ppy) = kcactus2 Then
        Print "Ouch... that hurts.."
        dmg = Int(Rnd * 5) - 2: If dmg < 0 Then dmg = 0
        If dmg > 1 Then Print "You got poked for "; dmg; " pt(s) of damage"
        pwounds = pwounds + dmg
        ppx = lastx: ppy = lasty
    End If
    If Point(ppx, ppy) = kwaste And Int(1 + Rnd * 102) > phealth Then
        tinc = (Int(1 + Rnd * 5) - 2) / 20: If tinc < .05 Then tinc = 0
        ptemp = ptemp + tinc
    End If


    If Int(1 + Rnd * 80 + pwounds) > phealth Then pstamina = pstamina - 1
    If Point(ppx, ppy) = kslime Then
        Print "The slime is nauseating...";
        If Int(Rnd * 120) > phealth Then phealth = phealth - Int(Rnd * 4)
        If Int(Rnd * 120) > phealth Then
            Select Case Int(1 + Rnd * 6)
                Case 1, 2, 3
                    Print " it's making you itch."
                Case 4, 5, 6
                    Print " it's feel's like it is burning you."
                    wounds = wounds + Abs(Int(Rnd * 2 - Rnd * 2))
                    pexpo = Int(Rnd * 5) - 2: If pexpo < 1 Then pexpo = 0
                    prads = prads + pexpo
                    If pexpo > 0 Then phealth = phealth - 1
            End Select
        End If
    End If
    If Point(ppx, ppy) = kwater Then ptemp = ptemp - Int(Abs(Rnd * 2 - Rnd * 2))
    If Point(ppx, ppy) = klava Then
        ptemp = ptemp + 100
        dmg = 10 + Int(Rnd * 20)
        pwounds = pwounds + dmg
        Print "YOU ARE STANDING IN LAVA !!!"
        Print "....suffering "; dmg; " points of damage !"
    End If
    If ptemp < 0 Then
        Print "You are dangerously COLD .... brrrrr"
        pstamina = pstamina - Int(Rnd * 2)
        If Int(1 + Rnd * (50 + Abs(ptemp))) > pstamina Then
            pwounds = pwounds + Int(1 + Rnd * 2)
            phealth = phealth - Int(Rnd * 2)
        End If
    End If
    tcheck = ptemp + Rnd * 10
    If tcheck > 108 Then
        pstamina = pstamina - 1
        Print "You are dangerously warm!"
        If Int(1 + Rnd * ptemp) > pstamina Then
            pwounds = pwounds + 1
            phealth = phealth - Int(Rnd * 2)
        End If
    End If

    If ptemp < 98 Then ptemp = ptemp + 1
    If ptemp > 107 Then ptemp = Int((ptemp + 107) / 2)
    If Point(ppx, ppy) = Klgrey Then
        If ptemp > 98 Then ptemp = ptemp - 0.1
    End If
    If Int(1 + Rnd * (100 + prads)) > phealth * 1.5 Then
        phealth = phealth - 1
        pstamina = pstamina - 1
        dmg = Int(Rnd * 5) - 2: If dmg < 1 Then dmg = 0
        If Int(1 + Rnd * 100) > phealth Then pwounds = pwounds + dmg
    End If
    If pstamina < 20 Then
        Print "You are ";
        If pstamina < 1 Then
            Print "exhausted."
        Else
            Print "fatigued."
        End If
    End If
    If wounds > phealth Then
        Print "You are in intense pain !"
        pstamina = pstamina - Int(Rnd * 2)
    End If
    If pstamina < 1 Then pstamina = 0
    If Point(ppx, ppy) = kexit Then
        Print
        Print "YOU HAVE FOUND THE EXIT"
        Print
        Print "it took you "; turn; " turns after starting "; start_dx; " spaces away from the exit."
        Print
        kk$ = Chr$(27)
    End If
    If phealth < 1 Or pwounds > 99 Then
        Print "YOU HAVE PERISHED DUE TO YOUR POOR CONDITION."
        Print
        Print "(press any key to continue)"
        any$ = Input$(1)
        kk$ = Chr$(27)
    End If
Loop Until kk$ = Chr$(27)
Print "GAME OVER"
Print "play again?"
Print "Y or N?"
Do
    ask$ = Input$(1)
    ask$ = UCase$(ask$)
Loop Until ask$ = "Y" Or ask$ = "N"
If ask$ = "Y" Then
    Screen cmap
    GoTo restartdungeon
End If
System
'SUBS======================================================================
'$INCLUDE: 'DTDtiles.bi'
'==========================================================================
Sub bisectrect (r)
    If r > 0 Or r < rect_count + 1 Then
        Select Case Int(1 + Rnd * 6)
            Case 1, 2, 3 'vertical split
                tries = 0
                Do
                    tries = tries + 1
                    vpercent = (Int(1 + Rnd * 4) + Int(1 + Rnd * 4)) * .1
                Loop Until vpercent * rect(r).ww >= min_rectd And vpercent * rect(r).hh >= min_rectd Or tries > 7
                If tries < 8 Then
                    oldWW = Int(rect(r).ww * vpercent)
                    newX = rect(r).xx + oldWW
                    newWW = rect(r).ww - oldWW
                    If oldWW >= min_rectd And newWW >= min_rectd Then
                        rect(r).ww = oldWW
                        newrect newX, rect(r).yy, newWW, rect(r).hh, rect(r).lk, rect(r).fk
                    End If
                End If
            Case 4, 5, 6 'horizontal split
                tries = 0
                Do
                    tries = tries + 1
                    vpercent = (Int(1 + Rnd * 4) + Int(1 + Rnd * 4)) * .1
                Loop Until vpercent * rect(r).ww >= min_rectd And vpercent * rect(r).hh >= min_rectd Or tries > 7
                If tries < 8 Then
                    oldHH = Int(rect(r).hh * vpercent)
                    newYY = (rect(r).yy + oldHH)
                    newHH = rect(r).hh - oldHH
                    If oldHH >= min_rectd And newHH >= min_rectd Then
                        rect(r).hh = oldHH
                        newrect rect(r).xx, newYY, rect(r).ww, newHH, rect(r).lk, rect(r).fk
                    End If
                End If

        End Select
    End If
End Sub


Sub wrect (rx, ry, ww, hh, line_klr As _Unsigned Long, fill_klr As _Unsigned Long)
    If fill_klr > 0 Then Line (rx, ry)-(rx + ww - 1, ry + hh - 1), fill_klr, BF
    If line_klr > 0 Then Line (rx, ry)-(rx + ww - 1, ry + hh - 1), line_klr, B
End Sub

Sub drawrect (r)
    wrect rect(r).xx, rect(r).yy, rect(r).ww, rect(r).hh, rect(r).lk, rect(r).fk
End Sub

Sub newrect (XX, YY, WW, HH, klk, kfl)
    rect_count = rect_count + 1
    ReDim _Preserve rect(rect_count) As rect_type
    rect(rect_count).xx = XX
    rect(rect_count).yy = YY
    rect(rect_count).ww = WW
    rect(rect_count).hh = HH
    rect(rect_count).lk = klk
    rect(rect_count).fk = kfl
    rect(rect_count).notes = "newrect"
End Sub
Sub addwater (rno, pcx, pcy, scale)
    prr = Int(6 + Rnd * (12 * scale))
    preps = (3 + Int(Rnd * prr))
    For wr = 1 To preps
        pcxx = pcx + Int(Rnd * (prr / 2)) - Int(Rnd * (prr / 2))
        pcyy = pcy + Int(Rnd * (prr / 2)) - Int(Rnd * (prr / 2))
        rsqrd = prr * prr
        y = -prr
        While y <= prr
            x = Int(Sqr(rsqrd - y * y))
            For x2 = pcxx - x To pcxx + x
                If x2 >= rect(rno).xx And x2 <= rect(rno).xx + rect(rno).ww Then
                    If pcyy + y >= rect(rno).yy And pcyy + y <= rect(rno).yy + rect(rno).hh Then
                        kk = Point(x2, pcyy + y)
                        If kk = kwaste Or kk = kgrass Or kk = Klgrey Then
                            PSet (x2, pcyy + y), kwater
                        End If
                    End If
                End If
            Next
            y = y + 1
        Wend
        prr = Int((prr + Int(6 + Rnd * (12 * scale))) / 2)
    Next
End Sub
Sub addgrass (rno, pcx, pcy, scale)
    prr = Int(6 + Rnd * (12 * scale))
    preps = (3 + Int(Rnd * prr))
    For wr = 1 To preps
        pcxx = pcx + Int(Rnd * (prr / 2)) - Int(Rnd * (prr / 2))
        pcyy = pcy + Int(Rnd * (prr / 2)) - Int(Rnd * (prr / 2))
        rsqrd = prr * prr
        y = -prr
        While y <= prr
            x = Int(Sqr(rsqrd - y * y))
            For x2 = pcxx - x To pcxx + x
                If x2 >= rect(rno).xx And x2 <= rect(rno).xx + rect(rno).ww Then
                    If pcyy + y >= rect(rno).yy And pcyy + y <= rect(rno).yy + rect(rno).hh Then
                        kk = Point(x2, pcyy + y)
                        If kk = kwaste Then
                            PSet (x2, pcyy + y), kgrass
                        End If
                    End If
                End If
            Next
            y = y + 1
        Wend
        prr = Int((prr + Int(6 + Rnd * (12 * scale))) / 2)
    Next
End Sub

Sub addtrees (rno, pcx, pcy, scale)
    prr = Int(6 + Rnd * (12 * scale))
    preps = (3 + Int(Rnd * prr))
    For wr = 1 To preps
        pcxx = pcx + Int(Rnd * (prr / 2)) - Int(Rnd * (prr / 2))
        pcyy = pcy + Int(Rnd * (prr / 2)) - Int(Rnd * (prr / 2))
        rsqrd = prr * prr
        y = -prr
        While y <= prr
            x = Int(Sqr(rsqrd - y * y))
            For x2 = pcxx - x To pcxx + x
                If x2 >= rect(rno).xx And x2 <= rect(rno).xx + rect(rno).ww Then
                    If pcyy + y >= rect(rno).yy And pcyy + y <= rect(rno).yy + rect(rno).hh Then
                        kk = Point(x2, pcyy + y)
                        If kk = kgrass Then
                            If Int(1 + Rnd * 100) < 20 Then
                                tc = Int(1 + Rnd * 4)
                                Select Case tc
                                    Case 1
                                        PSet (x2, pcyy + y), ktree1
                                    Case 2
                                        PSet (x2, pcyy + y), ktree2
                                    Case 3
                                        PSet (x2, pcyy + y), ktree3
                                    Case 4
                                        PSet (x2, pcyy + y), ktree4
                                End Select
                            End If
                        End If

                    End If
                End If
            Next
            y = y + 1
        Wend
        prr = Int((prr + Int(6 + Rnd * (12 * scale))) / 2)
    Next
End Sub

Sub addcactus (rno, pcx, pcy, scale)
    prr = Int(6 + Rnd * (12 * scale))
    preps = (3 + Int(Rnd * prr))
    For wr = 1 To preps
        pcxx = pcx + Int(Rnd * (prr / 2)) - Int(Rnd * (prr / 2))
        pcyy = pcy + Int(Rnd * (prr / 2)) - Int(Rnd * (prr / 2))
        rsqrd = prr * prr
        y = -prr
        While y <= prr
            x = Int(Sqr(rsqrd - y * y))
            For x2 = pcxx - x To pcxx + x
                If x2 >= rect(rno).xx And x2 <= rect(rno).xx + rect(rno).ww Then
                    If pcyy + y >= rect(rno).yy And pcyy + y <= rect(rno).yy + rect(rno).hh Then
                        kk = Point(x2, pcyy + y)
                        If kk = kwaste Then
                            If Int(1 + Rnd * 100) < 15 Then
                                tc = Int(1 + Rnd * 2)
                                Select Case tc
                                    Case 1
                                        PSet (x2, pcyy + y), kcactus1
                                    Case 2
                                        PSet (x2, pcyy + y), kcactus2
                                End Select
                            End If
                        End If

                    End If
                End If
            Next
            y = y + 1
        Wend
        prr = Int((prr + Int(6 + Rnd * (12 * scale))) / 2)
    Next
End Sub






Sub addslime (rno, pcx, pcy, scale)
    prr = Int(5 + Rnd * (10 * scale))
    preps = (3 + Int(Rnd * prr))
    For wr = 1 To preps
        pcxx = pcx + Int(Rnd * (prr / 2)) - Int(Rnd * (prr / 2))
        pcyy = pcy + Int(Rnd * (prr / 2)) - Int(Rnd * (prr / 2))
        rsqrd = prr * prr
        y = -prr
        While y <= prr
            x = Int(Sqr(rsqrd - y * y))
            For x2 = pcxx - x To pcxx + x
                If x2 >= rect(rno).xx And x2 <= rect(rno).xx + rect(rno).ww Then
                    If pcyy + y >= rect(rno).yy And pcyy + y <= rect(rno).yy + rect(rno).hh Then
                        kk = Point(x2, pcyy + y)
                        If kk = Klgrey Or kk = kwater Or kk = kgrass Then
                            PSet (x2, pcyy + y), kslime
                        End If
                        If kk = kwaste And Int(Rnd * 100) < 75 Then
                            PSet (x2, pcyy + y), kslime
                        End If

                    End If
                End If
            Next
            y = y + 1
        Wend
        prr = Int((prr + Int(6 + Rnd * (12 * scale))) / 2)
    Next
End Sub
Sub addlava (rno, pcx, pcy, scale)
    prr = Int(5 + Rnd * (10 * scale))
    preps = (3 + Int(Rnd * prr))
    For wr = 1 To preps
        pcxx = pcx + Int(Rnd * (prr / 2)) - Int(Rnd * (prr / 2))
        pcyy = pcy + Int(Rnd * (prr / 2)) - Int(Rnd * (prr / 2))
        rsqrd = prr * prr
        y = -prr
        While y <= prr
            x = Int(Sqr(rsqrd - y * y))
            For x2 = pcxx - x To pcxx + x
                If x2 >= rect(rno).xx And x2 <= rect(rno).xx + rect(rno).ww Then
                    If pcyy + y >= rect(rno).yy And pcyy + y <= rect(rno).yy + rect(rno).hh Then
                        kk = Point(x2, pcyy + y)
                        If kk = Klgrey Or kk = kwater Or kk = kslime Or kk = kgrass Or kk = kwaste Then
                            If kk = kwater Then
                                If Abs(y) < prr / 2 Then
                                    PSet (x2, pcyy + y), klava
                                Else
                                    Select Case Int(1 + Rnd * 12)
                                        Case 1, 2, 3, 4, 5
                                            PSet (x2, pcyy + y), klava
                                        Case 6, 7, 8
                                            PSet (x2, pcyy + y), krubble
                                        Case 9, 10
                                            PSet (x2, pcyy + y), Klgrey
                                        Case 11
                                            PSet (x2, pcyy + y), Kdgrey
                                        Case 12
                                            PSet (x2, pcyy + y), kcrystal
                                    End Select
                                End If
                            Else
                                PSet (x2, pcyy + y), klava
                            End If
                        End If
                    End If
                End If
            Next
            y = y + 1
        Wend
        prr = Int((prr + Int(6 + Rnd * (12 * scale))) / 2)
    Next
End Sub

Sub addfungus (rno, pcx, pcy, scale)
    prr = Int(2 + Rnd * (2 * scale))
    preps = (3 + Int(Rnd * prr))
    For wr = 1 To preps
        pcxx = pcx + Int(Rnd * (prr / 2)) - Int(Rnd * (prr / 2))
        pcyy = pcy + Int(Rnd * (prr / 2)) - Int(Rnd * (prr / 2))
        rsqrd = prr * prr
        y = -prr
        While y <= prr
            x = Int(Sqr(rsqrd - y * y))
            For x2 = pcxx - x To pcxx + x
                If x2 >= rect(rno).xx And x2 <= rect(rno).xx + rect(rno).ww Then
                    If pcyy + y >= rect(rno).yy And pcyy + y <= rect(rno).yy + rect(rno).hh Then
                        kk = Point(x2, pcyy + y)
                        If kk = Klgrey Or kk = kwater Then
                            If Int(1 + Rnd * 100) <= 30 Then PSet (x2, pcyy + y), kfungus
                        End If
                        If kk = kgrass Then
                            If Int(1 + Rnd * 100) <= 65 Then PSet (x2, pcyy + y), kfungus
                        End If
                        If kk = kwaste Then
                            If Int(1 + Rnd * 100) <= 15 Then PSet (x2, pcyy + y), kfungus
                        End If

                    End If
                End If
            Next
            y = y + 1
        Wend
        prr = Int((prr + Int(6 + Rnd * (12 * scale))) / 2)
    Next
End Sub
Function checkrubble (xx, yy)
    stumblecheck = Int(1 + Rnd * 120)
    dmg = 0
    If stumblecheck > health Then
        Print "whooops.... you stumbled on the rubble...";
        Select Case Int(1 + Rnd * 20)
            Case 1
                If Point(ppx - 1, ppy - 1) <> Kdgrey Then
                    ppx = ppx - 1: ppy = ppy - 1
                End If
            Case 2
                If Point(ppx, ppy - 1) <> Kdgrey Then
                    ppy = ppy - 1
                End If
            Case 3
                If Point(ppx + 1, ppy + 1) <> Kdgrey Then
                    ppx = ppx + 1: ppy = ppy + 1
                End If
            Case 4
                If Point(ppx - 1, ppy) <> Kdgrey Then
                    ppx = ppx - 1
                End If
            Case 6
                If Point(ppx + 1, ppy) <> Kdgrey Then
                    ppx = ppx + 1
                End If
            Case 7
                If Point(ppx - 1, ppy + 1) <> Kdgrey Then
                    ppx = ppx - 1: ppy = ppy + 1
                End If
            Case 8
                If Point(ppx, ppy + 1) <> Kdgrey Then
                    ppy = ppy + 1
                End If
            Case 9
                If Point(ppx + 1, ppy + 1) <> Kdgrey Then
                    ppy = ppy + 1: ppx = ppx + 1
                End If
            Case 10, 11, 12, 13, 14
                Print " knocking the wind out of you... ";
                pstamina = Int(pstamina / 4)
            Case 15, 16, 17, 18, 19, 20
                ppx = lastx: ppy = lasty
                Print "you tumble back...";
        End Select
        dmg = Abs(Int((Rnd * 3) - (Rnd * 3)))
        If dmg > 0 Then
            Print "you suffer "; dmg; " points of damage!"
        Else
            Print "."
        End If
    End If
    checkrubble = dmg
End Function
Sub addcornerrubble (rno)
    numcorn = Int(1 + Rnd * 4)
    For crr = 1 To numcorn
        Select Case Int(Rnd * 5)
            Case 1
                crx = rect(rno).xx + 1
                cry = rect(rno).yy + 1
            Case 2
                crx = rect(rno).xx + 1
                cry = rect(rno).yy + rect(rno).hh - 2
            Case 3
                crx = rect(rno).xx + rect(rno).ww - 2
                cry = rect(rno).yy + 1
            Case 4
                crx = rect(rno).xx + rect(rno).ww - 2
                cry = rect(rno).yy + rect(rno).hh - 2
        End Select
        prr = Int((rect(rno).hh + rect(rno).ww) / 12)
        rsqrd = prr * prr
        y = -prr
        While y <= prr
            x = Int(Sqr(rsqrd - y * y))
            For x2 = crx - x To crx + x
                If x2 >= rect(rno).xx And x2 <= rect(rno).xx + rect(rno).ww Then
                    If cry + y >= rect(rno).yy And cry + y <= rect(rno).yy + rect(rno).hh Then
                        kk = Point(x2, cry + y)
                        If kk = kwaste And Int(1 + Rnd * 100) < (cornerrubblechance * 2.5) Then
                            PSet (x2, cry + y), krubble
                        End If
                    End If
                End If
            Next
            y = y + 1
        Wend
    Next crr
End Sub

Function checkcrystal (xx, yy)
    climbcheck = Int(1 + Rnd * 100)
    If climbcheck > phealth Then
        Print "You just can't gain any purchase to climb the crystal."
    Else
        stumblecheck = Int(1 + Rnd * 120)
        dmg = 0
        If stumblecheck > health Then
            Print ".... you fell from the crytsal...";
            Select Case Int(1 + Rnd * 9)
                Case 1
                    If Point(ppx - 1, ppy - 1) <> Kdgrey Then
                        ppx = ppx - 1: ppy = ppy - 1
                    End If
                Case 2
                    If Point(ppx, ppy - 1) <> Kdgrey Then
                        ppy = ppy - 1
                    End If
                Case 3
                    If Point(ppx + 1, ppy + 1) <> Kdgrey Then
                        ppx = ppx + 1: ppy = ppy + 1
                    End If
                Case 4
                    If Point(ppx - 1, ppy) <> Kdgrey Then
                        ppx = ppx - 1
                    End If
                Case 5
                    ppx = lastx: ppy = lasty
                Case 6
                    If Point(ppx + 1, ppy) <> Kdgrey Then
                        ppx = ppx + 1
                    End If
                Case 7
                    If Point(ppx - 1, ppy + 1) <> Kdgrey Then
                        ppx = ppx - 1: ppy = ppy + 1
                    End If
                Case 8
                    If Point(ppx, ppy + 1) <> Kdgrey Then
                        ppy = ppy + 1
                    End If
                Case 9
                    If Point(ppx + 1, ppy + 1) <> Kdgrey Then
                        ppy = ppy + 1: ppx = ppx + 1
                    End If
            End Select
            dmg = Abs(Int((Rnd * 4) - (Rnd * 4)))
            If dmg > 0 Then
                Print "you suffer "; dmg; " points of damage!"
            Else
                Print "."
            End If

        End If
    End If
    checkcrystal = dmg
End Function
Sub coltileat (tn, ktc, xx, yy)
    Dim kc As _Unsigned Long
    _Source tiles&
    _Dest ms
    tx = tilespot(tn, 1): ty = tilespot(tn, 2)
    For px = 0 To 16
        For py = 0 To 15
            kc = Point(tx + px, ty + py)
            If kc <> Kblack Then
                PSet (xx + px, yy + py), ktc
            End If
        Next py
    Next px
    _Source dmap
End Sub
Function getwalltile
    wt = Int(1 + Rnd * 8)
    Select Case wt
        Case 1, 2, 3
            wt = 8
        Case 4, 5
            wt = 15
        Case 6
            wt = 14
        Case 7
            wt = 11
        Case 8
            wt = 12
    End Select
    getwalltile = wt
End Function
Sub makemonsters
    ReDim mp(1000, 1000) As Integer
    For m = 1 To 300

        monst(m).tile = 144 + Int(Rnd * 239)
        monst(m).mx = Int(11 + Rnd * 980)
        monst(m).my = Int(11 + Rnd * 980)
        mp(monst(m).mx, monst(m).my) = m
    Next m
End Sub

Sub handlemonsters
    ReDim mp(1000, 1000)
    For m = 1 To 300
        If monst(m).my <> 0 Then
            If Int(Rnd * 100) < 30 Then
                If ppx < monst(m).mx Then monst(m).mx = monst(m).mx - 1
                If ppx > monst(m).mx Then monst(m).mx = monst(m).mx + 1
                If ppy < monst(m).my Then monst(m).my = monst(m).my - 1
                If ppy > monst(m).my Then monst(m).my = monst(m).my + 1
                mk = Point(monst(m).mx, monst(m).my)
                If mk = klava Then
                    Print "Monster Falls in lava! ";
                    monst(m).my = 0
                    monst(m).mx = 0
                End If
            End If
        End If
        mp(monst(m).mx, monst(m).my) = m
    Next m
End Sub
Function harvestfungus
    If Point(ppx, ppy) = kfungus And pstamina > 0 Then
        nf = Int(Rnd * 3)
        Print "You root among the fungus and harvest "; nf; " decent mushrooms";
        _Dest cmap
        PSet (ppx, ppy), kfloor
        _Dest ms
        pstamina = pstamina - Int(Rnd * 3)
        If Int(1 + Rnd * 100) > phealth Then
            Print " getting a face full of toxic spores."
            phealth = phealth - Int(Rnd * 4)
        Else
            Print "."
        End If
        If Int(Rnd * 100) < 67 Then
            _Dest dmap
            Select Case Int(Rnd * 3)
                Case 0
                    PSet (ppx, ppy), kfloor2
                Case 1
                    PSet (ppx, ppy), kfloor3
                Case 2
                    PSet (ppx, ppy), kfloor4
                    _Dest ms
            End Select
        End If

        harvestfungus = nf
    Else
        Print "No mushrooms to pick here."
    End If
End Function
Sub eatshrooms
    If pshrooms < 1 Then Print "You don't have any mushrooms."
    If pshrooms > 0 Then
        pshrooms = pshrooms - 1
        eat = Int(1 + Rnd * 100)
        If eat > phealth Then
            Select Case eat
                Case 1 To 50
                    Print "Oh.... that was horrible, it makes you terribly ill."
                    phealth = Int(phealth * .7)
                    pstamina = Int(pstamina / 2)
                    pwounds = pwounds + Int(1 + Rnd * 3)
                Case 51 To 75
                    Print "Oh..That was awful, it tasted like dirt."
                    pstamina = Int(pstamina * .9)
                    phealth = Int(phealth * .9)
                Case 76 To 100
                    Print "That didn't go down right."
                    pstamina = Int(pstamina * .9)
            End Select

        Else
            Select Case eat
                Case 1 To 25
                    Print "You've eatem worse."
                    phealth = phealth + Int(Rnd * 2)
                    pstamina = pstamina + 2
                Case 26 To 75
                    Print "That tasted great!"
                    pwounds = pwounds - Int(Rnd * 2)
                    phealth = phealth + Int(1 + Rnd * 6)
                    pstamina = pstamina + 3
                Case 76 To 100
                    pwounds = pwounds - Int(Rnd * 3)
                    Print "Munch, munch... well that hit the spot."
                    pstamina = pstamina + 4
            End Select
        End If
        If pstamina < 1 Then pstamina = 0
        If phealth < 1 Then phealth = 0
        If phealth > 100 Then phealth = 100
        If pwounds < 1 Then pwounds = 0
        If pstamina > 100 Then pstamina = pstamina - 1
    End If
End Sub

Sub minimap
    minx = ppx - 50
    maxx = ppx + 50
    miny = ppy - 50
    maxy = ppy + 50
    mvx = 51
    mvy = 51
    If minx < 10 Then
        minx = 10
        maxx = 111
    End If
    If miny < 10 Then
        miny = 10
        maxy = 111
    End If
    If maxx > 990 Then
        maxx = 990
        minx = 879
    End If
    If maxy > 990 Then
        maxy = 990
        miny = 879
    End If
    miniy = 0
    For ly = miny To maxy
        miniy = miniy + 1
        minix = 0
        For lx = minx To maxx
            minix = minix + 1
            km = Point(lx, ly)
            PSet (minix + 400, miniy + 200), km
        Next
    Next
End Sub
Reply
#7
This is very cool!

Your procedural generation is a lot further along than my experiments. Not sure if you are using it or not, but "wave function collapse" is a cool technique, if you are interested in procedural generation.

I love using the Kenny 1-bit tile set. I used it in my own rouge-like which you have already seen.

Something I found early on, was that having full brightness on every visible tile made it kinda, bleh. Fog of war can really increase the tension of a level.

So, I had decided to bake in lighting on my static components of the map. I was/will add pre-computed lighting for my sprites. Having a cache of say 8 lighting levels for each non-static tile in my level. Then based on distance from each light source you render a light to dark sprite. This would be make for easy and computationally inexpensive feature what can really set the mood for each level. I believe this is how Minecraft did it.

Now you have inspired me to go back and work on my own rouge-like.
Reply
#8
That Kenney tile set was just extensive enough and easy to edit I couldn't keep away from using it.

As for lighting I was figuring on eventually just dropping a lighting mask over the play area image on the mainscreen with a varying alpha channel, that would cut out a lot of computation and wouldn't require keeping track of any extra data elsewhere.
Reply




Users browsing this thread: 2 Guest(s)