C64 BTII: BEASTIARY ENTRY BREAKDOWN

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

C64 BTII: BEASTIARY ENTRY BREAKDOWN

Post by Darendor »

This thread will attempt to examine how the beastiary in a dungeon file is broken down and just what all the bytes mean.

I took the entry from Dark Domain Level 1, Kobolds, and used that as a sort of template.

After much playtesting and SPBI-casting and killing and whatnot, I've made the following determinations:

Code: Select all

DATA RECORD #1 - SAMPLED FROM DARK DOMAIN LEVEL 1

37ea 21    ora $21,x		K
37eb 05				o
37ec 08    ora $08		b	
37ed 05				o
37ee 06    ora $06		l
37ef 0e				d
37f0 45				[Unknown]
37f1 36 asl $3645		[EOT]
37f2 19				s
37f3 36				[EOT]
37f4 15 ora $1536,y		>
37f5 15				>
37f6 15    ora $15,x		>
37f7 15				>
37f8 15    ora $15,x		>
37f9 15				>
37fa ed    ora $ed,x		07	Data byte 0: Max random HP added to low byte 2 (high byte)
37fb ea       nop 		00	Data byte 1: Max random HP added to byte 3 (high byte)
37fc eb       ???		01	Data byte 2: Base HP low byte
37fd ea       nop 		00	Data byte 3: Base HP high byte
37fe eb       ???		01	Data byte 4: Maximum group size
37ff eb       ???		01	Data byte 5: Advance speed (i.e. how many feet this monster advances in 1 round)
3800 ea       nop 		00	Data byte 6: AC; also base to-hit
3801 ea       nop 		00	Data byte 7: # attacks per round (1 + this decimal value?)
3802 ea       nop 		00	Data byte 8: Attack type (0 = melee attack, 0xff = No attack, etc)
3803 ea       nop 		00	Data byte 9: Attack type (0 = melee attack, 0xff = No attack, etc)
3804 ea       nop		00 	Data byte 10: Attack type (0 = melee attack, 0xff = No attack, etc)
3805 ea       nop 		00	Data byte 11: Attack type (0 = melee attack, 0xff = No attack, etc)
3806 ea       nop 		00	Data byte 12: Bitfield; high 4 bits are the melee attack type (swings at, slashes at, etc), low 4 bits are special attack type
3807 eb       ???		01	Data byte 13: Minimum damage this monster deals in combat; max damage is 4x this value (in this case 1-4)
3808 c0				2a	Data byte 14: Picture file to load
3809 fb    cpy #$fb		11	Data byte 15: Bitfield; 0: 0 = "Him", 1 = "It" (e.g. "for XXXX damage, killing [him][it]!")
						1: Unused?
						2: Unused?
						3: Unused?
						4-7: Staring distance (10' to 90')
Update: 18 April 2019 courtesy of drifting.

It seems I was wrong about some of this information; drifting has kindly offered insight into some of the more mysterious bytes. Between the two of us we would appear to have the beastiary code figured out.
---------------------------------------------------------------------------------------------------------------------------

Each beastiary entry is 32 bytes. The first 16 are for the name, including the pluralization convention. The unused bytes are padded with ff (represented by ">", as in text strings).

The 16 bytes after that represent the monster's stats.

What eludes me so far is the XP value, the gold value, the treasure range, the treasure chance, what spells (if any) it casts, and some other variables that are probably not strictly listed here. :?

What's kind of interesting is that you can fight the same monster many times, and while the XP value remains constant, you will get varying amounts of GP.

It occurs to me that perhap the XP, gold, treasure chance, treasure range, and whatnot might be tied to the dungeon's difficulty flag. Worth investigating.
Last edited by Darendor on Thu Apr 18, 2019 9:04 pm, edited 2 times in total.
drifting
Posts: 152
Joined: Wed Dec 07, 2011 10:21 pm

Re: C64 BTII: BEASTIARY ENTRY BREAKDOWN

Post by drifting »

Darendor wrote: Wed Apr 17, 2019 8:31 am The 16 bytes after that represent the monster's stat. As seen above, I have discovered the high & low bytes for the MAX HP and MIN HP fields, represented by data bytes 0, 1, 2, and 3. The high bytes are 00 because these are low level monsters (compared to, say, level 3 of the Destiny Stone). Data bytes 4, 5, and 6 are blank and as yet unknown.

I believe data byte 7 to be a bitfield that represents the type of special attack the monster has. Data byte 8 is the # attacks per round; i.e. 1 plus the decimal value stored here.

Data bytes 9, 10, 11, and 12 are a mystery.

Data byte 13 is the minimum damage this monster deals in combat; the maximum is derived from this byte by simply multiplying by 4. So you get damage ranges of 11-44, 1-4, 4-16, 8-32, etc.

Data byte 14 is the file # to load for the monster's animation/display picture.

Data byte 15 is, I believe, the monster's AC value.


What eludes me so far is the XP value, the gold value, the treasure range, the treasure chance, the chance for the monster to hit, what spells (if any) it casts, how many feet per turn it advances, what adjectives it uses for melee/range combat (...slams..., ...slashes at..., etc), and some other variables that are probably not strictly listed here. :?

What's kind of interesting is that you can fight the same monster many times, and while the XP value remains constant, you will get varying amounts of GP.

It occurs to me that perhap the XP, gold, treasure chance, treasure range, and whatnot might be tied to the dungeon's difficulty flag. Worth investigating.
In the DOS version, it's not MAX HP and MIN HP. Byte 2 & 3 are the base HP for the monster and bytes 0 & 1 are the maximum random points added.

More from DOS

Code: Select all

      4: Maximum group size
      5: Advance speed
      6: AC (also base to-hit value)
      7: Number of attacks
 8 - 11: Attack types (0 - melee attack, 0xff - No attack, etc)
     12: High 4 bits are the melee attack type (swings at, slashes at, etc)
     	 Low 4 bits are the special attack type
     13: Base melee damage
     14: Picture index
     15: Flag field
     	  bit   0: 0 for "Him", 1 for "It"
     	  bit 1-3: Not used (as far as I can tell)
     	  bit 4-8: Starting distance
User avatar
Darendor
Posts: 1502
Joined: Wed Jan 14, 2009 1:53 am
Location: Red Deer, Alberta, Canada

Re: C64 BTII: BEASTIARY ENTRY BREAKDOWN

Post by Darendor »

Oh.

Well I was right about some of it at least.

I will take your corrections and apply them to my post.

Thank you for your insight, I appreciate it.
Weber G
Posts: 125
Joined: Tue Dec 15, 2020 9:58 am

Re: C64 BTII: BEASTIARY ENTRY BREAKDOWN

Post by Weber G »

I found the following out of the code (BT2 C64):

Code: Select all

###monster table###

byte 00 - FF	;name
byte 10 - 13	;used for hitpoint creation
		;byte 12 and 13 are the min hipoints
		;but all four bytes are used for max hipoints calculation
byte 14		;# of monsters calculation
		;the following table is used:
		;byte 14	max #
		;00		1
		;01		4
		;02		8
		;03		16
		;04		32
		;05		64
		;06		127
		;07		256
byte 15		;bit 0 -3 * 10 is the advance speed
byte 16		;10 - byte 16 = AC
byte 17		;is used together with byte 1D for XP calculation
byte 18 - 1B	;attack type:
		;00: 		melee attack
		;01 - 4F:	cast spell
		;50 - 5F:	breathres
		;60 - 6F:	distance attack (e.g. bow...)
byte 1C		;bit 0 - 3 special attack effect:
		;0:		nothing
		;1:		poisons
		;2:		drains level
		;3:		insanity
		;4:		ages
		;5:		possesses
		;6:		stones
		;7:		critical hits
		;8:		unequip item
		;9:		spell drain
		;bit 4 - 7 melee attack text (e.g. swings at, claws at...)
byte 1D		;1:	is used together with byte 17 for XP calculation
		;2:	is the initiative value
		;3:	bitwise moved left: attack value
		;4:	byte 1D * (1-4) => melee damage
byte 1E		;picture index
byte 1F		;bit 0 - 3 used for text creation:
		;0:	"HIM!"
		;1:	"IT!"
		;bit 4 - 7 * 10 => distance at start
two examples are attached
BT2_ex.png
BT2_ex.png (129.78 KiB) Viewed 1183 times
the corresponding raw data for Destiny Stone level 1:

Code: Select all

>C:cd00  ca e1 e3 eb  a0 ef e6 a0  d3 f0 e1 e4  e5 f3 dc ff   ................
>C:cd10  ff 03 ff 01  00 09 1a 04  00 00 00 00  02 11 3b 10   ..............;.
>C:cd20  cb e9 ee e7  a0 ef e6 a0  c3 ec f5 e2  f3 dc ff ff   ................
>C:cd30  ff 03 40 00  00 02 1a 03  00 43 46 4b  40 12 26 50   ..@......CFK@.&P
>C:cd40  c2 f2 e1 e7  e7 e1 f2 f4  af dc f3 dc  ff ff ff ff   ................
>C:cd50  ff 07 04 00  02 02 19 02  00 00 00 00  51 21 3f 10   ............Q!?.
>C:cd60  cb ee e9 e7  e8 f4 a0 c4  e9 e1 ed ef  ee e4 f3 ff   ................
>C:cd70  ff 01 ff 01  00 03 1c 03  00 00 00 6e  00 14 38 10   ...........n..8.
>C:cd80  cb f7 ef ee  a0 c4 f2 e1  e7 ef ee af  dc f3 dc ff   ................
>C:cd90  ff 03 ff 02  02 04 1b 02  00 5b 5b 5c  20 22 20 81   .........[[\ " .
>C:cda0  d6 e1 ee e4  f2 f9 ec dc  ff ff ff ff  ff ff ff ff   ................
>C:cdb0  ff 01 02 00  03 03 19 07  6d 6d 6d 6d  00 07 26 80   ........mmmm..&.
>C:cdc0  c9 ee e7 f2  ef e9 e4 af  dc f3 dc ff  ff ff ff ff   ................
>C:cdd0  ff 01 40 00  03 03 18 02  00 00 00 00  23 20 3a 11   ..@.........# :.
>C:cde0  d3 e3 e1 f4  e8 e5 a0 cd  e1 e7 e5 af  dc f3 dc ff   ................
>C:cdf0  ff 01 ff 02  01 01 19 00  4e 24 24 33  00 40 35 90   ........N$$3.@5.
>C:ce00  cf e7 f2 e5  a0 c8 e5 f2  ef af dc f3  dc ff ff ff   ................
>C:ce10  ff 03 ff 01  01 05 1b 03  00 59 6e 46  24 14 37 31   .........YnF$.71
>C:ce20  cd e1 e7 e9  e3 a0 c4 f2  e1 e7 ef ee  af dc f3 ff   ................
>C:ce30  ff 03 ff 03  01 04 1c 08  00 5d 5b 5c  28 09 20 81   .........][\(. .
>C:ce40  cd e1 f3 f4  e5 f2 f3 f7  ef f2 e4 af  dc f3 dc ff   ................
>C:ce50  ff 07 40 01  02 02 1b 05  00 00 00 00  41 10 2b 10   ..@.........A.+.
>C:ce60  d0 e9 f4 a0  d3 eb f2 f5  ec ec af dc  f3 dc ff ff   ................
>C:ce70  ff 03 ff 04  01 04 19 00  00 00 5c 5e  60 42 36 41   ..........\^`B6A
>C:ce80  cd e9 eb e5  a7 f3 a0 c7  ef ec e5 ed  af dc f3 ff   ................
>C:ce90  ff 0f ff 01  01 01 1c 00  00 00 00 00  56 50 34 11   ............VP4.
>C:cea0  c1 f0 f0 f2  e5 ee f4 e9  e3 e5 dc ff  ff ff ff ff   ................
>C:ceb0  ff 03 ff 00  00 02 19 00  37 43 4b 45  00 46 29 51   ........7CKE.F)Q
>C:cec0  d3 e3 e1 ec  ef f2 e4 af  dc f3 dc ff  ff ff ff ff   ................
>C:ced0  ff 03 ff 04  03 02 1b 00  00 5c 30 30  25 45 30 31   .........\00%E01
>C:cee0  c1 f2 e7 ef  ee e1 f5 f4  af dc f3 dc  ff ff ff ff   ................
>C:cef0  ff 0f ff 01  02 02 1b 05  00 00 6e 6f  41 0f 3b 10   ..........noA.;.
User avatar
Darendor
Posts: 1502
Joined: Wed Jan 14, 2009 1:53 am
Location: Red Deer, Alberta, Canada

Re: C64 BTII: BEASTIARY ENTRY BREAKDOWN

Post by Darendor »

I presume that you have a copy of BTII that is de-PirateSlayered, then?
Post Reply