Author Topic: "Gears" - The FF7 Documentaion Project  (Read 38287 times)

Lord_Skylark

  • Crazy poster
  • *
  • Posts: 115
  • Karma: 0
    • View Profile
battle data
« Reply #50 on: 2004-07-08 03:04:32 »
*is eager on if a really really detailed analysis was done on the enemies AI* If not, I can try to figure it out.

I should really finish my FF4 AI (simpler...- but it took a hell of alot of work to figure it all out - just some minor battle visual effects that I didn't figure out how they were called up exactly - but I should just release it anyhow)

~Sky

halkun

  • Global moderator
  • No life
  • *
  • Posts: 2111
  • Karma: 20
  • NicoNico :)
    • View Profile
    • Q-Gears Homepage
"Gears" - The FF7 Documentaion Project
« Reply #51 on: 2004-07-08 03:37:44 »
The ai iscript is in scene.bin. SOmeone have-decrypted it. I've been burnt out as of late.

Lord_Skylark

  • Crazy poster
  • *
  • Posts: 115
  • Karma: 0
    • View Profile
Okay
« Reply #52 on: 2004-07-08 04:37:18 »
Who decrypted it? Cause I could type it up really nice and stuff. If not, I plan on working on that eventually.

~Sky

Terence Fergusson

  • Insane poster
  • *
  • Posts: 262
  • Karma: 1
    • View Profile
"Gears" - The FF7 Documentaion Project
« Reply #53 on: 2004-07-08 09:47:40 »
If you've got basic AI decryption done, I want it ^_^;  Been wanting to figure out their battle routine for a while now, especially to nail down counters and, say, work out what causes Dragon Zombies to use Pandora's Box (as example).

Oh, and yeah, there was no problem with using the Mechanics stuff in your project, Halkun, though I will warn you that there's a number of errors in it scattered around that I never bothered fixing: UW Modifiers being one of the biggest "recent" (as in, about a year ago) things I mucked about with on GameFAQs (interesting factor that put together Morph and solved some problems with Death Penalty and Conformer calculations), among other things.  Statuses as well: there's actually the full 32 in the game; Dual was in the wrong place (it should be in between Reflect and Shield), and what was in Dual's place was renamed to Seizure.

What I *really* want at the moment, though, is the LCG that FF7's random number generator uses.  If I can get that, I *should* be able to hex edit it in memory and get my own random numbers out, thus happily allowing various random things to be tested.  So if you have any information about that, I'd love to hear about it.

Terence Fergusson

  • Insane poster
  • *
  • Posts: 262
  • Karma: 1
    • View Profile
"Gears" - The FF7 Documentaion Project
« Reply #54 on: 2004-07-08 10:02:36 »
By the way, looking over the document...

Objects that you can win and steal are the *same thing*.
0x0320 is the byte mask of what items can be dropped/stolen and their chances.  00-3F means a Drop, 80-BF means a Steal, and the chance is out of 63 (basically).
0x0324 is the item you get from the *first* byte in the byte mask.  It could be a drop, steal or nothing depending on what the byte mask said.
0x0326, 0x0328 and 0x032A refer to the other bytes in the mask.
Oh, and while we're on the subject, 0x032C is 6 bytes referring to the commands allowed for Manipulate.  However, the first 2 bytes of 0x032C is *VERY* important: it's the command the monster will use when Berserk.  This leads to another very important bug: if the command listed is FF FF and the monster is *NOT* immune to Berserk, it will try to use a command that does not exist, and will (luckily) never have the MP for: so the message "<monster>'s skill power is used up." will appear over and over.  (Try Berserking 2-Faced, Doorbull, Guardian, Manhole, XCannon or Hojo's Right Arm for fun related to this)  If it *DID* have the MP necessary (I forget the exact amount), the game would crash.  Fun.


Anyways, yes, would like a basic AI primer or some data on the LCG, if anyone has it.  Failing that, the full disassembled battle routine would also be nice <cough>

mirex

  • No life
  • *
  • Posts: 1651
  • Karma: 1
    • View Profile
    • http://mirex.mypage.sk
"Gears" - The FF7 Documentaion Project
« Reply #55 on: 2004-07-08 10:16:01 »
Quote
The ai iscript is in scene.bin. SOmeone have-decrypted it.

Yup i have the scene.bin description somewhere on the disk ... but who was it from ... oh now i remember, it was from fremen i think ... but also someone else decoded it.

so here should be the link to description
http://perso.wanadoo.fr/fremensf/forumff7/ff7hack/scenebinfileformat.pdf
and here some threads relative to it:
scene.bin compression
FF7's .BIN Format Spec
Can someone send me/upload the uncompressed scene.bin please

halkun

  • Global moderator
  • No life
  • *
  • Posts: 2111
  • Karma: 20
  • NicoNico :)
    • View Profile
    • Q-Gears Homepage
"Gears" - The FF7 Documentaion Project
« Reply #56 on: 2004-07-08 10:22:35 »
I have that in gears.

Someone has been decoded more than that. Lemme shake a contact and see what I can come up with.

Terence Fergusson

  • Insane poster
  • *
  • Posts: 262
  • Karma: 1
    • View Profile
"Gears" - The FF7 Documentaion Project
« Reply #57 on: 2004-07-08 10:35:13 »
mirex, that's just the basic monster data specification that's been translated (and some of us have had that basic data from memory for years; we just didn't know *where* it was kept since scene.bin was compressed).  I was hoping someone meant that they'd done some work on the *AI*, which is also kept with monsters, but with the basic specification, no information on that appears to be listed.

(I'm glad Fremen posted that Scene decompression program though; exactly what Skylark and I wanted in the first place)

And while I'm looking through Gears again, I might also note another mistake in the old copies of my Mech document: Hero Drinks don't multiply base damage by their percentage, they affect Atk and MAt by that percentage instead.  So they work exactly the same as they do for Def/MDf.  It's done at the same place though (when Small changes Atk to 0), so no reordering necessary.

halkun

  • Global moderator
  • No life
  • *
  • Posts: 2111
  • Karma: 20
  • NicoNico :)
    • View Profile
    • Q-Gears Homepage
"Gears" - The FF7 Documentaion Project
« Reply #58 on: 2004-07-08 10:46:29 »
Oh Hi Terrence. I hope you didn't mind I shoved you doc into Gears. I did give it a bit of a facelift for readability...

Say, do you know there the 7777 check is made?

(If HP==7777 then damage == 7777)

Terence Fergusson

  • Insane poster
  • *
  • Posts: 262
  • Karma: 1
    • View Profile
"Gears" - The FF7 Documentaion Project
« Reply #59 on: 2004-07-08 10:53:20 »
No clue, and read above for what I said about Mechanics guide inserted into Gears.

I'd *assume* the 7777 check is one of the last things done.  Like, even after Element and the like.  I suppose it's easily checked though, but don't particularly want to play with Emerald right now.

Messiah99

  • Crazy poster
  • *
  • Posts: 235
  • Karma: 0
    • View Profile
"Gears" - The FF7 Documentaion Project
« Reply #60 on: 2004-07-08 11:02:01 »
Quote from: halkun
Say, do you know there the 7777 check is made?

(If HP==7777 then damage == 7777)

Just a guess on my part, and I wouldnt know how to check and verify it just now, but Id imagine the Lucky 7s factor would be located near if not along with the other status effects. Just like poison drains HP every turn and small reduces the damage modifiers so that you can only deal 1, lucky 7s alters your damage to a flat 7777 every hit.

If the applicable files governing status change information have been figured out already and its not there however, I apologize for wasting everyones time reading this, haha.

mirex

  • No life
  • *
  • Posts: 1651
  • Karma: 1
    • View Profile
    • http://mirex.mypage.sk
"Gears" - The FF7 Documentaion Project
« Reply #61 on: 2004-07-08 12:56:41 »
Terence Fergusson: yup no work on AI ... i was looking through scene.bin only for monster info ... but i would be glad to see more from it ... especially monster attack strings and so on, to add it into Leviathan program.

Terence Fergusson

  • Insane poster
  • *
  • Posts: 262
  • Karma: 1
    • View Profile
"Gears" - The FF7 Documentaion Project
« Reply #62 on: 2004-07-08 13:05:56 »
Monster attack strings are easy; each ability has its own ID and name, and they're stored directly below the basic monster data.  AI data comes after the attack strings and attack data.  Or do you mean stuff like "Warning! Warning!" that Monodrive shouts?  Those type of messages are in the AI data.

Edit: Bored, bored, bored.  Downloaded a simple disassembler and am now tracking down battle mechanics code.  Found a few promising areas that might be related, so will work on translating them and see what comes up.  Probably nothing, but at least it's something to do and kinda fun.

mirex

  • No life
  • *
  • Posts: 1651
  • Karma: 1
    • View Profile
    • http://mirex.mypage.sk
"Gears" - The FF7 Documentaion Project
« Reply #63 on: 2004-07-08 13:08:49 »
i saw them there down below, but they are not every time at the same place .. i mean their position and stuff is not documented yet, and i didn't find it out too.

Terence Fergusson

  • Insane poster
  • *
  • Posts: 262
  • Karma: 1
    • View Profile
"Gears" - The FF7 Documentaion Project
« Reply #64 on: 2004-07-08 13:17:37 »
Their position is easily documented.  The list of IDs start at 0x840 in a Scene file (each ID = 2 bytes), and the names themselves start at 0x880 in a Scene file (each name = 32 bytes).  Which attacks an enemy uses is listed by their IDs from offset 0x48 in each monster data and continues for 32 bytes (so 16 different attacks maximum).  It's that easy.

Terence Fergusson

  • Insane poster
  • *
  • Posts: 262
  • Karma: 1
    • View Profile
Result of Bored, Bored, Bored
« Reply #65 on: 2004-07-08 14:21:15 »
Hacked myself an All Lucky 9s: or rather, anytime a character has 9999 HP, they do 2345 damage ^_^  (They didn't do the 64 hit crazy thing until they were at 7777 HP though: that's a different check altogether)

Yeah, we love assembler.  Now I just have to backtrack through it all and work out what's stored where and finish off the basic damage code.  Fun.  Don't expect it any time soon... but the biggest upshot of all this is probably going to be quick location of the RNG.  And then the fun truly begins.

I should've done this YEARS ago... but then again, I didn't have as much *practice* with assembler YEARS ago.  (Blame FFTA.  The ARM assembler is one of the nicest things to work with o/~)

Lord_Skylark

  • Crazy poster
  • *
  • Posts: 115
  • Karma: 0
    • View Profile
Hey
« Reply #66 on: 2004-07-08 18:32:13 »
I just know awjile back when I first was looking through the AI very briefly that for The Jenova Synthesis and Bizarro Sephiroth that those battles call up only one enemy - like with synth is loads up the same enemy 3 times then chanages the stats of both of its arms. And in the AI I found the data where it at least alters it's HP - but I haven't looked beyond that.

But yeah, I know how the attacks are stored, but the AI tells exactly how the monster thinks on what attacks to use and stuff.

Since FF1 (which basically has no AI) and FF4 are the only two AIs I've worked on.....I imagine FF7's would be along the same lines, just more in-depth (and the FF4 one did take me a hell of a long time to figure out) But he's like examples of what I have never released from FF4 hacking I did...

156 - Gold Dragon
    If monster is confused
        1-Thunderbolt
    Normal
        1-Fight
        2-Lightning
        3-Fight
    If monster receives any damage
        1-Entwine

157 - Thunder Dragon
    Normal
        1-Lightning

158 - White Dragon
    Normal
        1-Fight
        2-Fight
        3-Fight
        4-Fight
        5-Fight
        6-Maelstrom
    If monster receives a summon attack
        1-Earthquake
    If monster receives a physical attack
        1-Slow
    If monster receives a fire attack
        1-Dragon Fire
    If monster receives an ice attack
        1-Snowstorm
    If monster receives a lightning attack
        1-Lightning

[easy ver:
[   Normal
[       1-Fight
[       2-Snowstorm
[       3-Hurricane
[   If monster receives a summon attack
[       1-Entwine
[   If monster receives a fire attack
[       1-Dragon Fire
[   If monster receives an ice attack
[       1-Snowstorm
[   If monster receives a lightning attack
[       1-Lightning

159 - Red Dragon
    If monster is confused
        1-Firaga (targets itself and its group)
        2-Fight (targets itself and its group)
    If monster is alone
        1-Fight
        2-Heat Ray
        3-Fight
    Normal
        1-Fight
        2-Fight
        3-Fight
          Fight

[easy ver
[   If monster is confused
[       1-Fire 3 (targets itself and its group)
[       2-Fight (targets itself and its group)
[   If monster is alone
[       1-Fight
[       2-Fight
[         Fight
[       3-Fight
[         Fight
[       4-Heat Ray
[   Normal
[       1-Fight
[       2-Heat Ray
[         Fight
[   If monster receives a summon attack
[       1-Needles (targets a monster)

160 - Behemoth
     Normal
         1-Fight
     If monster is alone & if monster receives a holy attack
         1-Maelstrom [easy: Hurricane]
     If mosnter receives any damage
         1-Fight
     If monster receives a magical attack
         1-Fight

~Sky

Terence Fergusson

  • Insane poster
  • *
  • Posts: 262
  • Karma: 1
    • View Profile
"Gears" - The FF7 Documentaion Project
« Reply #67 on: 2004-07-08 18:41:50 »
Yeah, that's the thing.  I've looked at FF6 long enough to understand *their* AI (there's plenty of documents on it around to learn).  So it was a *SHOCK* to look at the standard AI for, say, an MP (only has two attacks and no counters) and see it go up to 100+ bytes.

FF7 AI is strange, and until some basic commands can be pulled out, we're going to be stuck.  (Although getting stuff like the HP setting stuff from Jenova and the messages that appear from, say, Air Buster do help)

Anyways, I'm working on battle mechanics again, and having fun looking through the data (I think I found Goblin Punch's code just a minute ago), so... we'll see.

Edit: Decided to look at 1st Rays, since they're *definitely* one of the simplest enemies in the game (Shadow Maker's are a close second, but they have a few checks they need to do).  Code is, thankfully, simple:

00 00 00 52 70 23 00 12 70 20 02 A0 20 03 60 41 80 84 82 90 60 20 61 [17 01] 92 10 00 00 60 01 90 72 29 00 10 00 00 60 00 90 73

They only use one attack (Laser Cannon, but it's a silent use of it that never prints up the name) which has ID 17 01 (I've marked it in the code with square brackets).

I'm not ready to play around with it just yet and make comparisons, so I'm not sure where to start... *yet*.  Eh.  If I decide to work on it more, I'll post more, but until then....

Terence Fergusson

  • Insane poster
  • *
  • Posts: 262
  • Karma: 1
    • View Profile
...
« Reply #68 on: 2004-07-08 23:19:49 »
Well... I found the RNG.

It sucks.  And that's all I'm going to say about that.

Thankfully, some good came out of all this.  Nailed down Sadness' formula (Dmg = Dmg - [Dmg * 3 / 10]), as well as random variance (Dmg = [Dmg * (3841+Rnd(0..255)) / 4096]).  Saw some other interesting things that might be related to critical strikes... but... unsure.  Need to look into it some more, but that'll take time.

I think I'll look at stats, next, anyhow.  See what I can dig out there.

halkun

  • Global moderator
  • No life
  • *
  • Posts: 2111
  • Karma: 20
  • NicoNico :)
    • View Profile
    • Q-Gears Homepage
"Gears" - The FF7 Documentaion Project
« Reply #69 on: 2004-07-10 05:01:46 »
Documenting the debug rooms are burning me out.  (>_<)

It's a neccasary evil as without them you loose a key map the the game system.

Also, it allows me to explore the opcodes. My current working theroy is that every opcode is used at least once in the debug rooms. If I need to experiment with the arguments of an opcode, all I have to do is alter the arguments is one that is already placed in a script, That just requires editing a few bytes with a hex editor and placing the field file back in the LGP for testing.

My current scedule is dumping a BLACKBGD* file's script and dialog, and comparing it to a debug document I have. I then document every script attached to a character and any significant init scripts for that field file. I also correct the debug document with correct functions (for example, change "does nothing" to "Does a SPECIAL (FE) that resets the global flags")  and put that in my doc.

I'm running into some brick walls.

1) Some of the debug rooms crash the script dumper, and I don't know which room it is then.

2) Many of these scripts are just JUMPMAPS to a particular part of the game. Once a JUMPMAP is compleated the debug room field is unloaded from memory and the map that was called is loaded an executed. Many of the JUMPMAPs have no location arguments causing the PC to be in a bad place where the new script won't execute correctly. Mapping the JUMPMAPS are causing me to burn out very quickly.

3) going through every character and matching the window with the dialog with the script name in 5 different windows is also burning me out.

I need some help so I can get this done as quick as possable. I would like to go onto finding out the script arguments next, but can't until all debug rooms are documented, the opcodes are found "in situ", and all the jumpmap map codes are properly linked to what field file they are. (I haven't even started that yet)

Anyone what to lend a hand? (See my updated GEARS doc for an example of what I'm doing)

Messiah99

  • Crazy poster
  • *
  • Posts: 235
  • Karma: 0
    • View Profile
"Gears" - The FF7 Documentaion Project
« Reply #70 on: 2004-07-10 06:45:24 »
Well, not sure what I could do, as Im not really knowledgeable of most of what youre doing, but if anyones willing to hold my hand and walk me through a bit of the technique and get me up to speed, from there Im a willing workhorse. If noone else is able to help, and someones willing to show me what to do, Im always on my instant messengers provided Im online at the time (28.8k, gotta love it).

lasyan3

  • Cool newbie
  • *
  • Posts: 76
  • Karma: 2
    • View Profile
"Gears" - The FF7 Documentaion Project
« Reply #71 on: 2004-07-10 07:27:43 »
Quote from: halkun
1) Some of the debug rooms crash the script dumper, and I don't know which room it is then.

I will take care of this :wink: . Which files are crashing ?

halkun

  • Global moderator
  • No life
  • *
  • Posts: 2111
  • Karma: 20
  • NicoNico :)
    • View Profile
    • Q-Gears Homepage
"Gears" - The FF7 Documentaion Project
« Reply #72 on: 2004-07-10 07:53:59 »
PC version:

blackbg1
blackbg6
blackbg8
blackbgc
blackbgd

The SaiNt

  • No life
  • *
  • Posts: 1302
  • Karma: 3
    • View Profile
"Gears" - The FF7 Documentaion Project
« Reply #73 on: 2004-07-10 09:36:42 »
Quote from: Terence Fergusson
Monster attack strings are easy; each ability has its own ID and name, and they're stored directly below the basic monster data.  AI data comes after the attack strings and attack data.  Or do you mean stuff like "Warning! Warning!" that Monodrive shouts?  Those type of messages are in the AI data.

Edit: Bored, bored, bored.  Downloaded a simple disassembler and am now tracking down battle mechanics code.  Found a few promising areas that might be related, so will work on translating them and see what comes up.  Probably nothing, but at least it's something to do and kinda fun.



Hey, if you need to know some stuff about the executable, just PM me.
I've got A LOT of the executable documented due to my SECRET project.

lasyan3

  • Cool newbie
  • *
  • Posts: 76
  • Karma: 2
    • View Profile
"Gears" - The FF7 Documentaion Project
« Reply #74 on: 2004-07-10 12:26:36 »
Ok, I have done some research on all the background files, so now let's make it clear once for all :
There are 20 BLACKBGx.DAT files.
--> Numbers A, F, G don't contain dialogs nor events (it's obvious when you see the size of those files : 2 ko).
Among all the others files :
--> Numbers 1, 9, C, E, J are not related with the debug room.
--> Numbers H and I perhaps contains commands for the debug room at the end of the script, but I am not sure.
--> All the others (2, 3, 4, 5, 6, 7, 8, B, D, K) contain events of the debug room.
Note : Numbers 1, 6, 8, C, D can now be opened by Hack7.
« Last Edit: 2008-03-09 10:03:48 by lasyan3 »