Author Topic: flevel patching shenanigans  (Read 3744 times)

luksy

  • *
  • Posts: 375
    • View Profile
flevel patching shenanigans
« on: 2014-01-16 11:48:30 »
Many mods at the moment distribute entire files instead of patching, I'm sure that those who have tried to distribute multiple mods will agree that this is not the best way to go about things.

I'd like to focus on flevel.lgp as it's directly related to most of what I've worked on in the past, although I'm sure the following ideas can be applied to most of the other game files if necessary.

Most of you will already know this, but the field files inside flevel.lgp can be simply split into logical sections, and each section can be split again depending on the data inside. Splitting the files down into manageable chunks will allow modders to include only the data they need to change, instead of overwriting everything wholesale. This won't eliminate conflicts entirely, but it's a start and at worst it would make mods smaller and easier to distribute.

As an example, the first section of a field file can be broken down into individual scripts, text, and akao blocks. I'm mostly concerned with the first two so as a test I made a small app that does precisely this, for example gldelev is split up as follows:

Code: [Select]
├───0_dic
│       0

├───1_cloud
│       0
│       1
│       2

├───2_esto
│       0
│       1
│       2

├───3_ele
│       0
│       1
│       2

├───4_shade1
│       0

└───text
        0
        1
        2

The scripts for each entity are added to their own folder, and the text to a separate folder. Note that the app automatically removes unused scripts and text to reduce clutter.

Making changes to the scripts and text for a mod could be performed in a number of different ways, but the most obvious would be to use Makou Reactor to make the necessary changes, dump only the relevant parts, and distribute the files along with the app that will reinject them into the target flevel during installation of the mod. Even the script and text from the entire game could be included if necessary, they only occupy about 2 megs uncompressed.

So far the tool only splits the first section (minus akao blocks), but it could be easily extended for the other sections too.

If you'd like to see what the structure looks like, download this, and run it specifying the location of the flevel (e.g. "flevel_dump.exe foo/bar/flevel.lgp"), it creates a root flevel directory in the dir where it is run. There is zero error checking right now, but as long as you specify a valid flevel and the current directory has write permissions you should be good to go. Note that it dumps a lot of files (about 60,000) so depending on your hardware it might take some time.

This probably ties in with kaldarasha's community flevel project somewhat, and perhaps other projects besides, and I'm open to any feedback at all.

* I may have overthought this, the field files themselves could work fine as a patching format, unused parts can be marked with zeroed out offsets. This means far less file clutter compared to above.
« Last Edit: 2014-01-16 23:00:56 by luksy »

luksy

  • *
  • Posts: 375
    • View Profile
Re: flevel patching shenanigans
« Reply #1 on: 2014-02-06 01:36:08 »
After messing around on and off for two weeks I've come to the conclusion that there really is no easy way to pull this off while keeping it:

  • easy for modders, and
  • foolproof for users

Ironically I've gone 180˚ and distributing entire scripts seems to be the way to go, but with a few twists:

  • Mods should start with a clean, common base flevel (essentially the idea behind the community flevel project), the vanilla flevel contains a number of bugs, data formatting errors, and unused crud that need fixing. Starting with a "normalized" flevel means we're all on the same page.
  • For nearly all fields only the first section need be included, this means that the entire script for the game can be zipped into a single 1mb file
  • For a mod to be compatible with another, multiple fields will be needed for each conflicting field, unless the authors collaborate and make common fields

Flevel fixes I have implemented include:

  • Breaking down and rebuilding each field to strip out junk data
  • Parsing and rewriting all scripts (gets rid of more junk at the end of some scripts, makes sure each script owns its own data and doesn't fall through like in ealin_2 0/3 and 0/4)
  • Stripping unused scripts, text, and akao blocks (including tutorials which aren't needed for the PC)
  • Reorganizing the text entries so that all dialogue is in-game order
  • Making sure each text entry has its own window so that each entry can be individually resized

Manual fixes to individual files:

  • life, life2: remove map name (menu inaccessible, text pointer overflows)
    junair2, junone7, sininb1, sininb2: removed music ops pointing to invalid akao block
  • Certain fixes implemented by touphScript, tbd


EQ2Alyza

  • 7th Heaven Crew
  • Global moderator
  • *
  • Posts: 3200
  • Dilly-Dally Shilly-Shally
    • View Profile
    • EQ2Alyza - YouTube Channel
Re: flevel patching shenanigans
« Reply #2 on: 2015-03-03 04:19:13 »
Is this tool abandoned? I'm looking for solutions to getting the Reunion working with New Threat. The flevels between them are tricky.

DLPB_

  • Banned
  • *
  • Posts: 11006
    • View Profile
Re: flevel patching shenanigans
« Reply #3 on: 2015-03-03 05:16:34 »
Which fields are you having trouble with?  The next Reunion is gonna scale back the fixes as much as possible when the option to fix is not selected.