Author Topic: Reorganizing Encounters/Reducing Scene.bin size  (Read 11411 times)

xLostWingx

  • *
  • Posts: 801
  • No Comment
    • View Profile
    • FFVII Lost Wing Mod/Hacks
Reorganizing Encounters/Reducing Scene.bin size
« on: 2011-02-15 03:53:07 »
I wanted to know if I could reorganize the order of the scenes contained in scene.bin on the PSX version of FFVII.  So I started reading some threads and gathering information while also messing around with the file and some tools.  I tried extracting the 256 scenes from scene.bin and once that worked I simply renamed some (scene77 renamed scene195 and scene195 renamed scene77).  Repacked the files with SceneReader (please tell me if I should be using something else), and oh no, the new file size is too big (272kb I think). 

I looked around on some threads and asked some people questions and one potential solution was to reduce the size of the scene.bin by deleting AI or other information.  I was basically wondering what people had to say about this or other possible solutions.  I will continue experimenting and hunting for information, but I wonder if there is a better program for repacking the scenes that will not produce this extra data.

nfitc1

  • *
  • Posts: 3013
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
Re: Reorganizing Encounters/Reducing Scene.bin size
« Reply #1 on: 2011-02-15 13:43:35 »
Unfortunately, this is the way it is. You have blocks of 8K each where you try to pack as many as 16 scenes into. If one doesn't compress as much as others it might not fit. You've got the right idea though, but it might take some further creative re-working. You could also blank out the initial few scenes (7808 bytes of FFh's) to try to squeeze more in. The first, maybe 7, aren't used at all. They're those test pyramids that say you've found an error and a test Adamantaimai.

xLostWingx

  • *
  • Posts: 801
  • No Comment
    • View Profile
    • FFVII Lost Wing Mod/Hacks
Re: Reorganizing Encounters/Reducing Scene.bin size
« Reply #2 on: 2011-02-15 16:05:41 »
Alrite thanks.  I plan to spend some time today trying to figure this out.  As always I appreciate your assistance.
---------------------------------------------------------------------

Alrite so I had a successful test.  I took a scene.bin and opened it in PrC.  I deleted (FFed out) the first 7 scenes.  I checked the number of enemies in the scenes (some contain 1 and some BLANKs, some contain 2 and a BLANK, some contain only 2, and some contain 3 enemies).  I then unpacked the altered scene.bin with Scene Reader.  I made sure that I swapped a scene containing 3 enemies (scene82 with Guard Scorp) with another scene that also contained 3 enemies (scene97 with Corneo's Lackeys) - Just renamed them.  Packed them back up - 264kb good - and opened repacked scene.bin in Hojo, checked the kernel, and made a new Disc1.bin.  When I made it to the Guard Scorp battle, voila, Corneo's Lackey's showed up.  So it seems that this method works.

I don't think it works if you switch a scene with 2 enemies with one containing 3 enemies.  I also don't think it will repack to the correct file size if those first 7 scenes were not deleted.  This attempt has worked, and hopefully future attempts will work.  Now I can make a PSX version with Marlboros and Dragon Zombies as bosses and Materia Keepers and Red Dragons running around on the world map or in dungeons!!!
-
Sidenote:  I have heard that by doing this the Battle Square will cease to be functional.  I hope not, but it may be a price I'm willing to pay.
« Last Edit: 2011-02-15 19:27:46 by xLostWingx »

poofacetherisen

  • *
  • Posts: 31
  • My coffin smells...
    • View Profile
Re: Reorganizing Encounters/Reducing Scene.bin size
« Reply #3 on: 2011-02-15 20:52:25 »
This should be related... But the PC version of FFVII doesn't have this limitation right?
I hope not.

nfitc1

  • *
  • Posts: 3013
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
Re: Reorganizing Encounters/Reducing Scene.bin size
« Reply #4 on: 2011-02-16 02:29:30 »
...When I made it to the Guard Scorp battle, voila, Corneo's Lackey's showed up.  So it seems that this method works. ...

Remember you need to rebuild your scene look-up table anytime you play around with your scenes.

Sidenote:  I have heard that by doing this the Battle Square will cease to be functional.  I hope not, but it may be a price I'm willing to pay.

Indeed it will destroy the Battle Arena. Those start on specific formations and if the "next Arena Battle" value for that formation is blank the whole sequence will end prematurely. If you rebuild your look-up table (which PrC can do for you) then you'll be fine again.

This should be related... But the PC version of FFVII doesn't have this limitation right?
I hope not.

I weakly don't think it does. I know it can run scene.bin files that are larger than the originals, but it may have some surprise limitation on it like the kernel2.bin does. I know that the game only loads scenes on a need-to-battle basis so size might not matter. Every scene HAS to be 7808 in size uncompressed. As far as compressed scene.bin goes it should be able to work if it were the full 2MB in size it can expand to.
« Last Edit: 2011-02-16 02:33:38 by NFITC1 »

Aali

  • *
  • Posts: 1196
    • View Profile
Re: Reorganizing Encounters/Reducing Scene.bin size
« Reply #5 on: 2011-02-16 02:46:44 »
Kernel2.bin doesn't have that "surprise" limitation anymore if you're using 0.7.10b (just in case you missed it)

Are there any other arbitrary limits I should take a look at?

nfitc1

  • *
  • Posts: 3013
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
Re: Reorganizing Encounters/Reducing Scene.bin size
« Reply #6 on: 2011-02-16 11:55:45 »
Kernel2.bin doesn't have that "surprise" limitation anymore if you're using 0.7.10b (just in case you missed it)

Are there any other arbitrary limits I should take a look at?

I know, but I don't use it so I have to remain conscious of these limitations.
I would think that anything it loads into memory would have a limitation. The game was designed to work within a measly 32MB of RAM. That might include size limits on files inside lgp archives. Those are probably translated during load anyway.

xLostWingx

  • *
  • Posts: 801
  • No Comment
    • View Profile
    • FFVII Lost Wing Mod/Hacks
Re: Reorganizing Encounters/Reducing Scene.bin size
« Reply #7 on: 2011-02-17 05:11:40 »
I am looking throgh Proud Clod and have been experimenting with replacing/deleting/copying scenes and see that under the formations tab, it displays enemy IDs.  So does that mean I can use any of the enemy IDs in that scene - Scene217 Gargoyle, Gargoyle, Dark Dragon - Form 0364 contains enemy IDs 126 and 127,the Gargoyles.  Form 0366 has ID 142, the Dark Dragon.  Change the numbers and the enemy that shows up changes?  I had no idea PrC could do this, I spent all my time in Hojo  :| I have to go test this and reread the PrC manual.
Maybe I won't have to compromise on which enemies I use as replacements  ;D
« Last Edit: 2011-02-17 05:19:15 by xLostWingx »

nfitc1

  • *
  • Posts: 3013
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
Re: Reorganizing Encounters/Reducing Scene.bin size
« Reply #8 on: 2011-02-17 13:25:49 »
I had no idea PrC could do this, I spent all my time in Hojo  :| I have to go test this and reread the PrC manual.

Why, yes, I believe you should. ;)

Yes, that's all it takes. Not only is that the enemy ID, but it's also the way the game references the model to use. You can change that in a particular scene to make any enemy look like another, but it'll have the original's AI. PrC can edit almost anything (and it WILL be able to edit everything when the next version comes out) so you should take advantage of it.

gjoerulv

  • *
  • Posts: 1233
  • me
    • View Profile
    • My Youtube
Re: Reorganizing Encounters/Reducing Scene.bin size
« Reply #9 on: 2011-02-17 23:04:46 »
Another thing that get screwed up are continuous fights. For instance: in the hojo fight there are 2 formation IDs which are called upon by the previous formation. The game shouldn't crash, but will produce odd formations.

This shouldn't be too much of a problem though. There aren't many of these. Actually, I can't think of any other than the hojo fight.  :-P If you don't move that scene it should be fine.

Timber

  • *
  • Posts: 386
    • View Profile
Re: Reorganizing Encounters/Reducing Scene.bin size
« Reply #10 on: 2011-02-17 23:52:03 »
Actually, I can't think of any other than the hojo fight.  :-P If you don't move that scene it should be fine.

Also the plant monster in Gongaga.

Bosola

  • Fire hazard!
  • *
  • Posts: 1749
    • View Profile
    • My YouTube Channel
Re: Reorganizing Encounters/Reducing Scene.bin size
« Reply #11 on: 2011-02-17 23:56:44 »
...Don't the battle arena encounters use this?

nfitc1

  • *
  • Posts: 3013
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
Re: Reorganizing Encounters/Reducing Scene.bin size
« Reply #12 on: 2011-02-18 12:20:24 »
Actually, I can't think of any other than the hojo fight.  :-P If you don't move that scene it should be fine.

Also the plant monster in Gongaga.

Those aren't different fights. The first plant gets replaced by the second after so long, etc.

I think this is the events that happen during the elevator descent of the Shinra Bldg. Other than that...I can't think of one that does this either.

Kudistos Megistos

  • Banned
  • *
  • Posts: 3929
    • View Profile
Re: Reorganizing Encounters/Reducing Scene.bin size
« Reply #13 on: 2011-02-18 20:55:23 »
...Don't the battle arena encounters use this?

I believe the "special battle" (i.e. Cloud vs a series of strong enemies culminating in Proud Clod) works this way and the rest call the next formation in a different way. Don't quote me on this, as I could be completely wrong.

Also, I haven't paid sufficient attention to this thread, but couldn't the problem that gjoerulv mentions be solved by just changing the two bytes in the scene so that they correspond to the new formation ID?

xLostWingx

  • *
  • Posts: 801
  • No Comment
    • View Profile
    • FFVII Lost Wing Mod/Hacks
Chocobo Lure in reference to Scenes/Formations
« Reply #14 on: 2011-02-19 18:29:20 »
I was looking through the scenes to mark which ones I want to remove to make room for different enemy encounters.  I can do this without any problem.  But I came to a scene with a Chocobo in it.  If I stick a different scene (containing no chocobo or no formations with a chocobo) will the game still treat it as if there was a chocobo in it?  I mean to say, if you have Chocobo Lure equipped you get into battles that you otherwise would not have gotten into.  Does the Chocobo Lure 'unlock' these scenes or does it make the game search for a scene with a chocobo or something else?  If I removed all the scenes with a Chocobo, then equipped Chocobo Lure would I just never enter those scenes or would I instead get into a battle with whatever new monsters are in the scene?

I really have no idea how the Choco Lure materia works, but if it unlocks certain scenes then we could have a "WEAPON Lure" or a lure for any enemy provided it was in a scene that was suppose to contain a chocobo.  On the other hand, I could be completely wrong about all this. 

Kudistos Megistos

  • Banned
  • *
  • Posts: 3929
    • View Profile
Re: Chocobo Lure in reference to Scenes/Formations
« Reply #15 on: 2011-02-19 18:37:07 »
I was looking through the scenes to mark which ones I want to remove to make room for different enemy encounters.  I can do this without any problem.  But I came to a scene with a Chocobo in it.  If I stick a different scene (containing no chocobo or no formations with a chocobo) will the game still treat it as if there was a chocobo in it?  I mean to say, if you have Chocobo Lure equipped you get into battles that you otherwise would not have gotten into.  Does the Chocobo Lure 'unlock' these scenes or does it make the game search for a scene with a chocobo or something else?  If I removed all the scenes with a Chocobo, then equipped Chocobo Lure would I just never enter those scenes or would I instead get into a battle with whatever new monsters are in the scene?

I really have no idea how the Choco Lure materia works, but if it unlocks certain scenes then we could have a "WEAPON Lure" or a lure for any enemy provided it was in a scene that was suppose to contain a chocobo.  On the other hand, I could be completely wrong about all this.

Does anyone know how chocobo lure works? Its function is all in the .exe and probably hasn't been reverse engineered yet.

Anyway, there's a simple way to find out what will happen: try it!

Replace a formation with chocobos in it with one that doesn't and see if equipping master level chocobo lure makes that encounter come up more often. Granted, it's not an exact science because the encounters are (more-or-less) random, but it should be clear quite early whether chocobo lure is making the newly non-chocobo battles happen more often.

Bosola

  • Fire hazard!
  • *
  • Posts: 1749
    • View Profile
    • My YouTube Channel
Re: Reorganizing Encounters/Reducing Scene.bin size
« Reply #16 on: 2011-02-19 20:33:55 »
I know 80062E70 stores the chocobo lure value in the NTSC PSX memory map. You'd have to see what reads from it. Unfortunately, I'm not an assembly guru, nor do I have any real experience using debuggers, so someone else would have to extend the research.

xLostWingx

  • *
  • Posts: 801
  • No Comment
    • View Profile
    • FFVII Lost Wing Mod/Hacks
Re: Reorganizing Encounters/Reducing Scene.bin size
« Reply #17 on: 2011-02-19 21:37:09 »
I'll probably do some testing with this tonite or tomorrow.  I'll try various combinations of putting chocobos in scenes, not putting them in, and using other scenes and formations and report back with what I learn.  I don't have any of the finer technical skills or knowledge, so I'll be taking the scenic route.  It will be very exciting if Chocobo Lure can attract any monster occupying a chocobo's position in the scene while running on tracks.  Custom side quests and optional bosses galore.  Might end up ruining Chocobo breeding...or at least diminishing it, or for all I know you'll kick  New Monster A's ass and have a chocobo after the fight lol

gjoerulv

  • *
  • Posts: 1233
  • me
    • View Profile
    • My Youtube
Re: Reorganizing Encounters/Reducing Scene.bin size
« Reply #18 on: 2011-02-19 22:33:06 »
No matter how the game decides how to encounter a chocobo battle, you definitely won't get one after a fight if it isn't specified in the AI.

My guess is that the game most likely pick chocofights from fixed IDs (calculated). At least fixed relative to the scene called upon. 

Bosola

  • Fire hazard!
  • *
  • Posts: 1749
    • View Profile
    • My YouTube Channel
Re: Reorganizing Encounters/Reducing Scene.bin size
« Reply #19 on: 2011-02-20 00:45:43 »
I would guess that specific tiles on the world map simply call certain scenes when chocobo lure is held. Which monsters appear in those scenes are up to you.

The chocobo message, and chocobo 'handling' (eg the way the battles end differently when chocobos are present) is all due to the scene's AI. You can remove that at will.

xLostWingx

  • *
  • Posts: 801
  • No Comment
    • View Profile
    • FFVII Lost Wing Mod/Hacks
Re: Reorganizing Encounters/Reducing Scene.bin size
« Reply #20 on: 2011-02-20 01:17:46 »
I would guess that specific tiles on the world map simply call certain scenes when chocobo lure is held. Which monsters appear in those scenes are up to you.

The chocobo message, and chocobo 'handling' (eg the way the battles end differently when chocobos are present) is all due to the scene's AI. You can remove that at will.

This is how I thought it worked.  I'm making other preparations for my next mod so I won't be able to test this for a little while, but I will before I start working on my scene.bin.  Think the battle music will be chocobo music or normal battle music? (or is this determined by the AI too?  I can't remember if switching out Guard Scorp still played boss battle music).

Bosola

  • Fire hazard!
  • *
  • Posts: 1749
    • View Profile
    • My YouTube Channel
Re: Reorganizing Encounters/Reducing Scene.bin size
« Reply #21 on: 2011-02-20 03:19:43 »
The music is set by the Field module. So you'll have to find a way to edit the world map, or at least the specific data that calls for the chocobo theme.