Page 1 of 1

Enemy stats in PSII

PostPosted: Tue Nov 14, 2017 12:55 am
by Zucca
While I've been working to sort out the enemy data in PSII disassembly, I've noticed that there are more then two bits reserved for each enemy. In fact there are total of 8-bits, exactly one byte.
Normally enemies are categorized into three types in PSII:
  • biomonster
  • robot
  • both (Dezo enemies)
This yields to three different possibilities, so 2-bits should be enough. Leaving 00 (none) unused.

Here's few enemies and their type bits:
  • 00100000 - Buzzer
  • 00100000 - Fanbite
  • 00100000 - Neifirst
  • 01000000 - Mazgamma
  • 01000000 - Sonomech
  • 01000000 - Cooley61
  • 01000000 - Army Eye
  • 01100000 - Sakoff
  • 01100000 - Shadow
  • 01100000 - Capeone
  • 01100000 - Dark Force
  • 01000000 - Mother Brain

Also all the non-existent enemies from the missing group are biomonsters.
Vanleader is a robot as expected.

Anyway, If you ask me, there's a lot of space left. Most interestingly (to me at least) the two needed bits are 2nd and 3rd significat bits. Why the shift?
I wonder if flipping the other bits one could give monsters weakness or immunity to something.
A set bit in this list always means wekness (or rather non-immunity).

Also Dark Force being weak to Hugh and Kain techs was quite a surprise. I would have thought the opposite.
Motherbrain on the other hand makes sense.

Army Eye is quite a normal enemy. It has reasonable stats. Defence of 104. So it shouldn't be impossible to beat as a normal enemy. Although 3000HP makes it quite a tough one.

I'll leave you with stats of Army Eye and friends.
Code: Select all
Enemy_ArmyEye:
        dc.w     $0000, $0000, $0246, $0468, $068A, $08AC, $0ACE, $0CEE, $0EEE, $0CCC, $0888, $0666, $0444, $0060, $000E
        dc.l    Battle_ArmyEyeArt
        dc.w     2      ; EXP
        dc.w     0      ; MES
        dc.w     35     ; ATTACK
        dc.w     104    ; DEFENCE
        dc.b     $40    ; TYPE
        dc.b     38     ; AGILITY
        dc.w     3000   ; HITPOINTS
        dc.b     $07    ; TECH/ABILITY
        dc.b     255    ; TECH/ABILITY FREQ (0-255)
        dc.b     $00    ; EnemyTechSuccessRate table index id/number
        dc.b     0      ; Chances to run (0-255)
        dc.b     $0F    ; Init obj prop
        dc.b     3      ; Animation frame delay (0-255)
        dc.b     $60, $00, $68, $14     ; Unknown data - Two words?
        dc.b    SFXID_ArmyEyeAttack, SFXID_BeeAttack
        dc.l    Battle_ArmyEyeMap
        dc.b     $55, $55       ; Enemy ID twice?


Enemy_Trcrbase:
        dc.w     $0000, $0020, $0242, $0464, $0686, $08A8, $0ACA, $0CEC, $0EEE, $0CCC, $0AAA, $0888, $0666, $00CE, $008E
        dc.l    Battle_ArmyEyeArt
        dc.w     1773   ; EXP
        dc.w     864    ; MES
        dc.w     127    ; ATTACK
        dc.w     104    ; DEFENCE
        dc.b     $40    ; TYPE
        dc.b     40     ; AGILITY
        dc.w     201    ; HITPOINTS
        dc.b     $DD    ; TECH/ABILITY
        dc.b     178    ; TECH/ABILITY FREQ (0-255)
        dc.b     $08    ; EnemyTechSuccessRate table index id/number
        dc.b     25     ; Chances to run (0-255)
        dc.b     $0F    ; Init obj prop
        dc.b     3      ; Animation frame delay (0-255)
        dc.b     $60, $00, $68, $00     ; Unknown data - Two words?
        dc.b    SFXID_ArmyEyeAttack, SFXID_VanAttack
        dc.l    Battle_ArmyEyeMap
        dc.b     $56, $56       ; Enemy ID twice?


Enemy_Specter:
        dc.w     $0000, $0022, $0044, $0066, $0288, $04AA, $06CC, $08EE, $0CEE, $0CCC, $0888, $0666, $0444, $00CE, $008E
        dc.l    Battle_ArmyEyeArt
        dc.w     2395   ; EXP
        dc.w     124    ; MES
        dc.w     157    ; ATTACK
        dc.w     122    ; DEFENCE
        dc.b     $40    ; TYPE
        dc.b     51     ; AGILITY
        dc.w     268    ; HITPOINTS
        dc.b     $00    ; TECH/ABILITY
        dc.b     0      ; TECH/ABILITY FREQ (0-255)
        dc.b     $00    ; EnemyTechSuccessRate table index id/number
        dc.b     51     ; Chances to run (0-255)
        dc.b     $0F    ; Init obj prop
        dc.b     3      ; Animation frame delay (0-255)
        dc.b     $60, $00, $60, $14     ; Unknown data - Two words?
        dc.b    SFXID_ArmyEyeAttack, SFXID_VanAttack
        dc.l    Battle_ArmyEyeMap
        dc.b     $57, $57       ; Enemy ID twice?


The unknown data is probably a bitfield like TYPE is. That field might, for example, remove the legs from Army Eye. All these robots use the same base graphics. So something is controlling the leg visibility.
The topmost line on each enemy is color palette information.

Re: Enemy stats in PSII

PostPosted: Tue Nov 14, 2017 5:52 am
by etony33
You think beating the Army Eyes might actually be possible?

Re: Enemy stats in PSII

PostPosted: Tue Nov 14, 2017 10:15 am
by Zucca
etony33 wrote:You think beating the Army Eyes might actually be possible?
Not in that specific battle, no.
If you place one Army Eye as a normal enemy somewhere, you could maybe beat it. The problem may be the tech Army Eye uses every turn: $07. Haven't dug up what it means.

Re: Enemy stats in PSII

PostPosted: Tue Nov 14, 2017 3:07 pm
by MrStarbird
This actually is very useful information. I am working on a Phantasy Star II randomizer, and having this information will give me the ability to randomize enemy stats.

I can't wait to see the rest of this!

Re: Enemy stats in PSII

PostPosted: Tue Nov 14, 2017 4:41 pm
by Zucca
MrStarbird wrote:This actually is very useful information. I am working on a Phantasy Star II randomizer, and having this information will give me the ability to randomize enemy stats.
As soon as I get my script working I can sort all the enemy information in (more or less) human-readable form, while still being m68k assembly code.

Re: Enemy stats in PSII

PostPosted: Tue Nov 14, 2017 8:32 pm
by MrStarbird
I know I have seen a lot of the same data on Lorenzo's PSII disassemby for enemies. I just need addresses and I can work from there.

Re: Enemy stats in PSII

PostPosted: Tue Nov 14, 2017 9:09 pm
by Zucca
MrStarbird wrote:I know I have seen a lot of the same data on Lorenzo's PSII disassemby for enemies. I just need addresses and I can work from there.
When I'm ready, I'll submit these for lorenzo. The sources I'm using here are the ones from him. ;)

I just got few things sorted out.
Now I need to basically cram the data back to one line and from there split out the values. The other script then can add those comments to each line so that it's easy for programs and humans to find a specific line.

Could you create a palette randomizer too into your program? With certain limits that would give some nice visual variety to the game.

Re: Enemy stats in PSII

PostPosted: Wed Nov 15, 2017 1:02 am
by Zucca
YEAH!
I got all the enemy data sorted. There was some inconsistency how the data was presented.
They now have identical layout in code.

Next up I'll modify my "labeller+converter" script that labels every stat with explanation what they'll affect and converts some hex values to decimal so that it's easier to read (just like above).

I think I can pull this tomorrow. Yay.

Re: Enemy stats in PSII

PostPosted: Wed Nov 15, 2017 9:51 am
by lorenzo
That sounds great!

Re: Enemy stats in PSII

PostPosted: Wed Nov 15, 2017 11:14 pm
by MrStarbird
A palette randomizer built in could be done, it's just nothing I've ever included with any of the randos I've done.

Re: Enemy stats in PSII

PostPosted: Thu Nov 16, 2017 12:12 am
by Zucca
I'm close...
Unfortunately this process has been much more complicated and also I rushed the scripting so I had to do TONS of debugging.

This is what it outputs currently:
Code: Select all
Enemy_Van:
         dc.w   $5757, $0000, $0020, $0242, $0464, $0686, $08A8, $0ACA, $0CEC, $0EEE, $00CE, $008E, $004E, $002E, $0008, $000E   ; Palette data
        dc.l    Battle_VanArt
         dc.w   1259     ; EXPERIENCE POINTS
         dc.w   596      ; MESETA
         dc.w   93       ; ATTACK
         dc.w   83       ; DEFENSE
         dc.b   %01000000        ; Enemy type (%00100000 - biomonster, %01000000 - robot, %01100000 - both)
         dc.b   55       ; AGILITY (0-255)
         dc.w   197      ; HITPOINTS
         dc.b   $F1      ; Enemy tech (index number from EnemyTechniqueTable)
         dc.b   102      ; Chances of using tech instead of attack (0-255)
         dc.b   $04      ; Tech success rate (index number from EnemyTechSuccessRate table)
         dc.b   25       ; Chances of escaping from (0-255)
         dc.b   %00001111        ; Initial object properties
         dc.b   3        ; Animation frame delay
         dc.b   $64, $1C, $64, $1C       ; Unknown data
        dc.b    SFXID_VanAttack
        dc.b    SFXID_ArmyEyeAttack
        dc.l    Battle_VanMap


Enemy_Vanleadr:
         dc.w   $5858, $0000, $0024, $0246, $0468, $068A, $08AC, $0ACE, $0CEE, $0EEE, $06E2, $00C0, $0080, $0060, $0040, $000E   ; Palette data
        dc.l    Battle_VanArt
         dc.w   1624     ; EXPERIENCE POINTS
         dc.w   747      ; MESETA
         dc.w   108      ; ATTACK
         dc.w   95       ; DEFENSE
         dc.b   %01000000        ; Enemy type (%00100000 - biomonster, %01000000 - robot, %01100000 - both)
         dc.b   63       ; AGILITY (0-255)
         dc.w   239      ; HITPOINTS
         dc.b   $E7      ; Enemy tech (index number from EnemyTechniqueTable)
         dc.b   127      ; Chances of using tech instead of attack (0-255)
         dc.b   $08      ; Tech success rate (index number from EnemyTechSuccessRate table)
         dc.b   51       ; Chances of escaping from (0-255)
         dc.b   %00001111        ; Initial object properties
         dc.b   3        ; Animation frame delay
         dc.b   $64, $1C, $64, $1C       ; Unknown data
        dc.b    SFXID_VanAttack
        dc.b    SFXID_ArmyEyeAttack
        dc.l    Battle_VanMap


Enemy_Aerotank:
         dc.w   $5959, $0000, $0220, $0442, $0664, $0886, $0AA8, $0CCA, $0EEC, $0EEE, $0EC8, $0EA0, $0E60, $0C20, $0800, $000E   ; Palette data
        dc.l    Battle_VanArt
         dc.w   2709     ; EXPERIENCE POINTS
         dc.w   1080     ; MESETA
         dc.w   168      ; ATTACK
         dc.w   144      ; DEFENSE
         dc.b   %01000000        ; Enemy type (%00100000 - biomonster, %01000000 - robot, %01100000 - both)
         dc.b   76       ; AGILITY (0-255)
         dc.w   306      ; HITPOINTS
         dc.b   $E2      ; Enemy tech (index number from EnemyTechniqueTable)
         dc.b   102      ; Chances of using tech instead of attack (0-255)
         dc.b   $0C      ; Tech success rate (index number from EnemyTechSuccessRate table)
         dc.b   76       ; Chances of escaping from (0-255)
         dc.b   %00001111        ; Initial object properties
         dc.b   3        ; Animation frame delay
         dc.b   $64, $1C, $64, $1C       ; Unknown data
        dc.b    SFXID_VanAttack
        dc.b    SFXID_ArmyEyeAttack
        dc.l    Battle_VanMap


I'll clean it tomorrow. Now I need sleep. \o

@MrStarbird: Would data like this be of any help?

Re: Enemy stats in PSII

PostPosted: Thu Nov 16, 2017 6:32 am
by Zucca
Image

I've compiled the game with the reformatted enemy data and the resulting binary is a 1-to-1 match with the original.
I'll fine tune it so that the indentation is at least correct.
What a journey it has been if I should say so...

Enemy stats in PSII - done

PostPosted: Thu Nov 16, 2017 5:24 pm
by Zucca
Stats done.
The changes will probably appear soon in lorenzo's GitHub repository.

The indentation is still a bit off... I may sort them later.

But there you go, people. "Use it or lose it." ;)

Re: Enemy stats in PSII

PostPosted: Fri Nov 17, 2017 2:19 pm
by Zucca
Zucca wrote:Army Eye is quite a normal enemy. It has reasonable stats. Defence of 104. So it shouldn't be impossible to beat as a normal enemy. Although 3000HP makes it quite a tough one.

I have to correct that. Army Eye has a technique (id $07) which probably displays the "Trapped by plasma rings" message. Army Eye uses that tech as soon (probability of using it is 100%) as conditions for its usage are met. The success rate is also 100% (id 00 on EnemyTechSuccessRate table shows FF).

The plasma ring attack then calls some a subroutine (loc_2E24 subroutine on the disassembly) to exit the battle subroutine in the middle, remove and store all the equipments elswere and give every party member plasma rings.

This gives me some ideas of hacking some other monsters and giving them some tech to kick out party from battle and move them to somewhere the player wouldn't want.

EDIT: I made a branch for the Army Eye hacking: https://github.com/Zuccace/ps2disasm/tree/ArmyEye-test