Bwa-hahahaha!

Any developer realated stuff
User avatar
Darendor
Posts: 1503
Joined: Wed Jan 14, 2009 1:53 am
Location: Red Deer, Alberta, Canada

Post by Darendor »

HOw else do I edit this disk?
User avatar
Darendor
Posts: 1503
Joined: Wed Jan 14, 2009 1:53 am
Location: Red Deer, Alberta, Canada

Post by Darendor »

What a worthless program, that Vim is. :?
User avatar
Darendor
Posts: 1503
Joined: Wed Jan 14, 2009 1:53 am
Location: Red Deer, Alberta, Canada

Post by Darendor »

Oh wait, there we go. :?
User avatar
Horpner
Posts: 224
Joined: Thu Jan 08, 2009 11:53 pm
Location: New England
Contact:

Post by Horpner »

Yeah, Vim takes a long time to master. Emacs can probably handle a similar task.

Anyway, it's crude and feature-poor still, but without further ado, here's the very first (as far as I know) automatic computer generated dungeon map from Tales of the Unknown:

Code: Select all

    0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21
   +--+--+--+--+--+--+--+--+--+--+--+--+  +--+--+--+--+--+--+--+--+--+
21 |           #     |     |     |  |  |        #     |  #  |     |  | 21
   +  +  +  +  +--+--+  +  +  +  +ss+  +  +##+  +  +--+  +--+  +##+  +
20 |                       |           |  |  |  |  |           |     | 20
   +--+  +  +  +  +  +  +  +--+  +--+  +--+  +  +--+  +--+  +--+--+  +
19 s  |                    #  |              |        |           |  s 19
   +--+  +  +  +--+--+--+--+--+--+  +--+  +--+--+--+  +  +--+--+  +--+
18 |           |     |     |     |  |              |  |  |     |     | 18
   +  +  +  +  +  +  +  +##+  +ss+  +--+  +--+--+  +--+  +  +--+  +--+
17 |           |  |     |  |  |     |     |  #  |  |     |        |  | 17
   +  +--+  +--+  +  +--+--+  +--+  +  +--+##+--+  +--+  +--+--+  +  +
16 |  s  |  |        |           |  |        |        |        |  |  | 16
   +--+  +  +  +--+--+  +--+  +--+--+--+  +--+  +--+--+--+--+##+  +##+
15 |     |  |  |  |     |  |  |        |  |     |           |  |     | 15
   +  +  +--+  +  +  +--+  +  +  +--+  +  +--+ss+  +  +--+  +--+  +--+
14 |           |  |  |        |  #  |  |  |     |  |  |  |        |  | 14
   +  +  +--+  +##+  +##+--+  +  +--+  +  +--+  +  +--+  +--+  +--+  +
13 |     |  |  |     |  |  |  |        |     |  |        |  |  #     | 13
   +  +--+  +  +--+  +--+  +--+--+--+  +  +--+  +--+--+--+  +  +--+--+
12    |  #  |        |        |  #  |     |     |  #  |     |          12
   +##+--+  +--+  +--+  +  +--+##+--+--+--+--+  +--+  +--+  +  +--+--+
11 |  |           |     |  |  |  |  |  |  |     |              |     | 11
   +  +--+--+  +  +  +--+  +  +  +  +  +##+  +--+  +--+##+--+  +--+  +
10 |  |     |     |  |  #  |  |              |     |  |     |     |  | 10
   +  +  +  +  +--+  +--+--+  +--+--+  +--+  +  +ss+  +--+--+--+  +  +
 9 |  |     |  |  |           |     #  |  |     |        |        |  | 9
   +  +  +  +--+  +--+--+  +--+  +  +--+  +--+--+  +  +  +--+--+--+  +
 8 |  |  |  #           |  |                    |        |           | 8
   +  +--+  +--+--+--+  +  +  +  +  +  +  +  +  +--+  +--+  +  +  +  +
 7                   |  |  |                       |  |                7
   +  +--+  +--+  +  +##+  +  +  +  +  +  +--+  +  +  +  +--+--+--+  +
 6 |  |  |  |  |           |              |  #     |  |  |        |  | 6
   +  +  +--+  +--+--+  +--+  +  +  +  +  +--+  +--+  +  +  +  +  +  +
 5 |  |              |  |                       #  |  |  |        |  | 5
   +  +  +  +--+  +--+  +  +  +  +  +  +  +  +  +--+  +--+  +--+  +  +
 4 |  |     |  |        |                       |           |  |  |  | 4
   +  +  +  +##+  +--+  +  +  +  +  +  +  +  +--+  +  +--+  +  +  +  +
 3 |  |     |  |     |  |                    |        |  |  |  |  |  | 3
   +  +--+--+##+--+  +  +  +--+--+--+--+--+--+##+--+  +  +  +  +  +  +
 2 |           |  |  |  |  |     |     |  #     |  |  |  |  |  |  |  | 2
   +  +  +  +  +  +  +  +  +  +  +  +  +  +--+  +  +  +  +  +  +  +  +
 1 |           |  |  |  |  #     #     |  |  |  |  |  |  |  |  |  |  | 1
   +  +--+--+--+  +--+  +--+--+--+--+--+--+  +--+  +--+  +--+  +--+  +
 0 |  |                                   #     #     #     #     #  | 0
   +--+--+--+--+--+--+--+--+--+--+--+--+  +--+--+--+--+--+--+--+--+--+
    0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21
The above is the output of a short Python program that reads a Vice snapshot (.vsf) file and outputs the map stored at location $f800 in the C64's memory. Many enhancements are incoming.

In order to create a usable snapshot, you have to enter the dungeon level you want to map, and save a Vice snapshot.

The code is quick-hack quality. Use at your own risk.

Code: Select all

import sys

NOTHING = 0
WALL = 1
DOOR = 2
SECRET_DOOR = 3

if len(sys.argv) < 2:
    print >> sys.stderr, "usage: asciimap file"
    sys.exit(1)
else:
    fname = sys.argv[1]

class Tile(object):
    def __init__(self, byte):
        self.west = (byte >> 6) & 0x3
        self.east = (byte >> 4) & 0x3
        self.south = (byte >> 2) & 0x3
        self.north = byte & 0x03

disk_image = file(fname, "rb")

# Look for 'C64MEM'

target = 'C64MEM'
i = 0
while i < 6:
    c = disk_image.read(1)
    if c == '':
        print >> sys.stderr, "Not a valid Vice snapshot."
        sys.exit(1)
    if c == target[i]:
        i += 1
    else:
        i = 0

# Skip forward in memory to the location of the dungeon info.
fp = disk_image.tell()

fp += 0xf800 + 0x14

disk_image.seek(fp)

# Read one dungeon row at a time, and store them in rows.
rows = []
for _ in xrange(22):
    rows.append([Tile(ord(byte)) for byte in disk_image.read(22)])
rows.reverse()

legend = '    0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21' 
# Draw a crude ASCII map.
print legend
rnum = 21
write = sys.stdout.write
for row in rows:
    # north
    write('   ')
    for tile in row:
        write({NOTHING: '+  ', 
               WALL: '+--', 
               DOOR: '+##', 
               SECRET_DOOR: '+ss'}[tile.north])
    write('+\n')
    write(str(rnum).rjust(2))
    write(' ')
    # west and east
    for tile in row:
        write({NOTHING: ' ',
               WALL: '|',
               DOOR: '#',
               SECRET_DOOR: 's'}[tile.west])
        write('  ')
    # south and east are not generally bothered with. No one-way doors or walls
    # currently allowed. However, special handling is then needed for the right
    # and bottom edges.
    write({NOTHING: ' ',
           WALL: '|',
           DOOR: '#',
           SECRET_DOOR: 's'}[row[0].west])
    write(' ')
    write(str(rnum))
    write('\n')
    rnum -= 1
write('   ')
for tile in rows[0]:
    write({NOTHING: '+  ', 
           WALL: '+--', 
           DOOR: '+##', 
           SECRET_DOOR: '+ss'}[tile.north])
write('+\n')
print legend
Death and drek? WTF?
User avatar
Darendor
Posts: 1503
Joined: Wed Jan 14, 2009 1:53 am
Location: Red Deer, Alberta, Canada

Post by Darendor »

This is the disk code for WINE CELLAR. It's apparently wrong, but my patience is expended.

Code: Select all

WINE CELLAR
0009c00 [5th byte] - 0009de0 [8th byte]

0009c00: ---- ---- c414 4505 0505 0505 0505 0505  ...@..E......... begin cellar 5th[C4..]
0009c10: 0505 0505 0505 0505 0534 4100 0505 0405  .........4A.....
0009c20: 0505 0504 0404 0505 0505 0505 0505 1450  ...............P
0009c30: 5450 4415 5044 0404 1440 0010 5444 0505  TPD.PD...@..TD..
0009c40: 0505 0514 5050 5050 5054 5040 0000 1040  ....PPPPPTP@...@
0009c50: 0010 5050 5456 5656 5650 5050 5050 5050  ..PPTVVVVPPPPPPP
0009c60: 5041 0100 1040 0010 5050 6188 0808 1850  PA...@..PPa....P
0009c70: 5050 5060 9150 4005 1440 1040 0010 5050  PPP`.P@..@.@..PP
0009c80: 6580 0000 1050 5050 5050 4410 5054 5040  e....PPPPPD.PTP@
0009c90: 1040 0010 5050 6482 0202 1050 5050 5050  .@..PPd....PPPPP
0009ca0: 4111 5050 5040 1040 0010 5050 5159 5959  A.PPP@.@..PPQYYY
0009cb0: 5050 5050 5060 9565 9050 5140 1040 0110  PPPPP`.e.PQ@.@..
0009cc0: 5041 0505 0515 5050 5050 5050 4515 5041  PA....PPPPPPE.PA
0009cd0: 0501 1150 5550 4105 0505 0515 5251 5050  ...PUPA.....RQPP
0009ce0: 5040 0404 0004 0404 0500 0400 0504 0404  P@..............
0009cf0: 0404 0804 1050 5040 0000 0000 0010 5540  .....PP@......U@
0009d00: 0814 c500 cb80 cb00 cc80 cc00 cd80 cd00  ................
0009d10: ce00 0000 0100 0000 0000 2100 0000 0000  ..........!.....
0009d20: 0120 0000 0000 0000 0405 2240 0022 0100  . ........"@."..
0009d30: 0000 0020 0041 0000 0000 0001 0000 0000  ... .A..........
0009d40: 0022 2304 2102 0222 0000 0001 0000 0000  ."#.!.."........
0009d50: 0002 2304 2241 0000 0000 0000 0000 0000  ..#."A..........
0009d60: 0000 0000 2200 0000 0000 0000 0300 4122  ....".........A"
0009d70: 0002 0000 0000 0000 0000 0000 4300 0000  ............C...
0009d80: 0000 0000 0000 0001 0202 0304 0501 0101  ................
0009d90: 0100 0000 1003 0405 0004 1000 0010 0202  ................
0009da0: 1000 0600 0002 0002 2020 1012 0200 2004  ........  .... .
0009db0: 2003 0320 2000 0002 0002 0005 0607 0603   ..  ...........
0009dc0: 0502 0000 1020 3220 0000 0030 0530 0400  ..... 2 ...0.0..
0009dd0: 0020 1010 1010 0308 0502 0100 0100 0000  . ..............
0009de0: 0200 0103 5000 0001 ---- ---- ---- ---- ....P.......@... end cellar 8th [..01]
User avatar
Darendor
Posts: 1503
Joined: Wed Jan 14, 2009 1:53 am
Location: Red Deer, Alberta, Canada

Post by Darendor »

I put that code where?
User avatar
Darendor
Posts: 1503
Joined: Wed Jan 14, 2009 1:53 am
Location: Red Deer, Alberta, Canada

Post by Darendor »

Darendor wrote:This is the disk code for WINE CELLAR. It's apparently wrong, but my patience is expended.

Code: Select all

WINE CELLAR
0009c00 [5th byte] - 0009de0 [8th byte]

0009c00: ---- ---- c414 4505 0505 0505 0505 0505  ...@..E......... begin cellar 5th[C4..]
0009c10: 0505 0505 0505 0505 0534 4100 0505 0405  .........4A.....
0009c20: 0505 0504 0404 0505 0505 0505 0505 1450  ...............P
0009c30: 5450 4415 5044 0404 1440 0010 5444 0505  TPD.PD...@..TD..
0009c40: 0505 0514 5050 5050 5054 5040 0000 1040  ....PPPPPTP@...@
0009c50: 0010 5050 5456 5656 5650 5050 5050 5050  ..PPTVVVVPPPPPPP
0009c60: 5041 0100 1040 0010 5050 6188 0808 1850  PA...@..PPa....P
0009c70: 5050 5060 9150 4005 1440 1040 0010 5050  PPP`.P@..@.@..PP
0009c80: 6580 0000 1050 5050 5050 4410 5054 5040  e....PPPPPD.PTP@
0009c90: 1040 0010 5050 6482 0202 1050 5050 5050  .@..PPd....PPPPP
0009ca0: 4111 5050 5040 1040 0010 5050 5159 5959  A.PPP@.@..PPQYYY
0009cb0: 5050 5050 5060 9565 9050 5140 1040 0110  PPPPP`.e.PQ@.@..
0009cc0: 5041 0505 0515 5050 5050 5050 4515 5041  PA....PPPPPPE.PA
0009cd0: 0501 1150 5550 4105 0505 0515 5251 5050  ...PUPA.....RQPP
0009ce0: 5040 0404 0004 0404 0500 0400 0504 0404  P@..............
0009cf0: 0404 0804 1050 5040 0000 0000 0010 5540  .....PP@......U@
0009d00: 0814 c500 cb80 cb00 cc80 cc00 cd80 cd00  ................
0009d10: ce00 0000 0100 0000 0000 2100 0000 0000  ..........!.....
0009d20: 0120 0000 0000 0000 0405 2240 0022 0100  . ........"@."..
0009d30: 0000 0020 0041 0000 0000 0001 0000 0000  ... .A..........
0009d40: 0022 2304 2102 0222 0000 0001 0000 0000  ."#.!.."........
0009d50: 0002 2304 2241 0000 0000 0000 0000 0000  ..#."A..........
0009d60: 0000 0000 2200 0000 0000 0000 0300 4122  ....".........A"
0009d70: 0002 0000 0000 0000 0000 0000 4300 0000  ............C...
0009d80: 0000 0000 0000 0001 0202 0304 0501 0101  ................
0009d90: 0100 0000 1003 0405 0004 1000 0010 0202  ................
0009da0: 1000 0600 0002 0002 2020 1012 0200 2004  ........  .... .
0009db0: 2003 0320 2000 0002 0002 0005 0607 0603   ..  ...........
0009dc0: 0502 0000 1020 3220 0000 0030 0530 0400  ..... 2 ...0.0..
0009dd0: 0020 1010 1010 0308 0502 0100 0100 0000  . ..............
0009de0: 0200 0103 5000 0001 ---- ---- ---- ---- ....P.......@... end cellar 8th [..01]
0009d20 appears to contain 11N, from 12E to 18E. Right?
User avatar
Horpner
Posts: 224
Joined: Thu Jan 08, 2009 11:53 pm
Location: New England
Contact:

Post by Horpner »

Darendor wrote:0009d20 appears to contain 11N, from 12E to 18E. Right?
Yes. There are only 256 bytes or so in a sector, so a dungeon will be split into pieces on the disk.
Death and drek? WTF?
User avatar
Horpner
Posts: 224
Joined: Thu Jan 08, 2009 11:53 pm
Location: New England
Contact:

Post by Horpner »

Darendor wrote:I put that code where?
The Python code? To run it, you need to install Python 2.5 or below.

It probably doesn't work with 2.6 and above.

If Python is installed, you just save the Python program as asciimap.py, and then do either:

C:\> asciimap.py vice_snapshot.vcf

or if that doesn't work:

C:\> python.exe asciimap.py vice_snapshot.vcf
Death and drek? WTF?
User avatar
Darendor
Posts: 1503
Joined: Wed Jan 14, 2009 1:53 am
Location: Red Deer, Alberta, Canada

Post by Darendor »

I can't seem to find 21N, 21E on the disk on the Wine Cellar. Can you?
User avatar
Darendor
Posts: 1503
Joined: Wed Jan 14, 2009 1:53 am
Location: Red Deer, Alberta, Canada

Post by Darendor »

After much investigation, I have discovered that the dungeons on disk apparently are not stored consecutively, at least not entirely.

Consider this hex map of Wine Cellar:
Image

Everything goes nicely until 11N, 9E. Then where you expect to find the code starting 11N, 10E and onwards you get...garbage. :?

Any ideas where the other half of the wine cellar went? :?
User avatar
Darendor
Posts: 1503
Joined: Wed Jan 14, 2009 1:53 am
Location: Red Deer, Alberta, Canada

Post by Darendor »

The next line of code should be: "0010 5540 0000 0000 0000 1050 5040 0101"...but it doesn't exist at all within the file!

What...the...hell...
User avatar
Darendor
Posts: 1503
Joined: Wed Jan 14, 2009 1:53 am
Location: Red Deer, Alberta, Canada

Post by Darendor »

Got it. Here's the entire disk map of the Wine Cellar dungeon:
Image

Someone wanna confirm for me?
User avatar
Horpner
Posts: 224
Joined: Thu Jan 08, 2009 11:53 pm
Location: New England
Contact:

Post by Horpner »

Darendor wrote:I can't seem to find 21N, 21E on the disk on the Wine Cellar. Can you?
What are you seeing where the byte "should" be?
Death and drek? WTF?
User avatar
Darendor
Posts: 1503
Joined: Wed Jan 14, 2009 1:53 am
Location: Red Deer, Alberta, Canada

Post by Darendor »

Success - the Wine Cellar is now a completely blank dungeon.

All specials, stairs, and the spinner remain intact of course. 8)

So Horpner, how do we know which files on the dungeon disk contain the physical layouts of the dungeon maps (and Skara Brae), and which ones contain data for specials/darkness/antimagic and so on?
Post Reply