Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Raw diffing?  (Read 809 times)

Huin

  • Bay Watcher
    • View Profile
Raw diffing?
« on: January 05, 2010, 04:55:50 pm »

Have there been any efforts in creating tool(s) to create mods as "patches"?

In UNIX/programmer speak it would analogous to using diff/patch tools, but with tools that actually understand the raw file format, so that they can spot conflicts with more reliability and fewer false positives.

I know that there have been some efforts in creating mod management tools (such Modbase?) - although I'm thinking of something more simple to work (at least initially) as a command line tool as an aid to modders and people installing/combining multiple mods.

Typical use-case:

Modder creates two copies of a "vanilla" DF install. Modder then proceeds to change the raws in the "mod copy". Modder then uses a "raw diff" tool to create a "patch" that can then be distributed to give a specific feature (such as a new race, removal of accents from language files, etc.). This patch can then be applied to raws using a "raw patch" tool, which should allow for multiple mods to be installed to a vanilla or modded DF install (provided no conflicts detected).

Any thoughts?
Logged

Jay

  • Bay Watcher
  • ☼Not Dead Yet☼
    • View Profile
Re: Raw diffing?
« Reply #1 on: January 05, 2010, 05:05:54 pm »

Modbase attempted to do something like that.

I'm really not sure what happened to it.
Logged
Mishimanriz: Histories of Pegasi and Dictionaries

Tark

  • Bay Watcher
  • on what even did not?
    • View Profile
Re: Raw diffing?
« Reply #2 on: January 05, 2010, 06:04:48 pm »

Would be incredibly useful if someone did do this, but the closest thing was ModBase, which was canceled as far as I know.
Logged

Huin

  • Bay Watcher
    • View Profile
Re: Raw diffing?
« Reply #3 on: January 05, 2010, 06:38:08 pm »

I'm thinking of something along the lines of what Modbase tried to do, but at a much simpler level (command line tool for now). Maybe it would be useful to such things as Modbase in future (either by shelling out to command line or as a library).

Mostly, it's just scratching an itch that I have that it's hard to mix and match mods at the moment.
Logged

Huin

  • Bay Watcher
    • View Profile
Re: Raw diffing?
« Reply #4 on: January 10, 2010, 05:35:46 pm »

I've got a certain level of success on this so far. I have managed to produce a "patch file" from two reaction raw files.

An example follows:

The "from" reactions file (a very stripped down example of the vanilla version):
Spoiler (click to show/hide)

The "to" reactions file:
Spoiler (click to show/hide)

In plain English the changes are:
  • The BITUMINOUS_COAL_TO_COKE reaction was renamed from "make cake from bituminous coal" to "make coke from bituminous coal"
  • The BRASS_MAKING reaction was added.
  • The LIGNITE TO COKE reaction was removed.

The resulting "patch" file follows:

Spoiler (click to show/hide)

Several more bits of work remain to make this fully useful:
  • Being able to read in the patch file and apply it to a raw file.
  • Being able to parse and write more types of raw file than just reactions.

Any comments on results so far? I'm pondering how readable the patch file format is. Whilst it can be generated automatically, I'd prefer it if it was readable and understandable by modders. The file format isn't fixed at this early stage, so now is the best time to refine it (and no doubt there will be changes, especially when it comes to me writing a parser for it).

Edit: I got my English description of the changes the wrong way around, oops!
« Last Edit: January 10, 2010, 05:38:43 pm by Huin »
Logged

Huin

  • Bay Watcher
    • View Profile
Re: Raw diffing?
« Reply #5 on: January 10, 2010, 05:42:23 pm »

Another example if the whole reactions_standard file was being diffed, but the only change was that BRASS_MAKING now requires FLUX (for whatever reason you might want to do such a thing):

Code: [Select]
[ITEM:RAW_FILE:reaction_standard]
[GROUP:objects:ALTER]
[ITEM:REACTION:BRASS_MAKING]
[GROUP:reagents:ADD]
[REAGENT:1:REACTION_CLASS:FLUX]
Logged