Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 2 [3] 4 5 ... 22

Author Topic: Proposal: a standard format for mods in a diff/patch Mod Starter Pack  (Read 42377 times)

King Mir

  • Bay Watcher
    • View Profile
Re: Proposal: a standard format for mods in a diff/patch Mod Starter Pack
« Reply #30 on: August 15, 2014, 01:47:18 pm »

We don't need a mod managing tool if all we have are mini-mods that can be unzipped on top of a vanilla install.
I do. I want to be able to easily add and remove mini-mods without having to manually reapply each mod to vanilla on each remove or to work out how to remove a mini-mod while leaving others intact.
« Last Edit: August 15, 2014, 04:32:28 pm by King Mir »
Logged

Pidgeot

  • Bay Watcher
    • View Profile
Re: Proposal: a standard format for mods in a diff/patch Mod Starter Pack
« Reply #31 on: August 15, 2014, 01:50:08 pm »

The minute you go beyond vanilla diffs, you're creating a custom patch format. This means you need to re-implement patching yourself; existing libraries cannot be reused.
I think some kind of custom format is unavoidable; it just needs to be open.

We don't need a mod managing tool if all we have are mini-mods that can be unzipped on top of a vanilla install.  We also don't get much bang for the buck if we don't store things as diffs of some type (a graphics pack can make tiny changes to lots of large files).

It's unavoidable in the long-term, definitely, but for the short-term, Peridexis is proposing to use a completely standard diff (with the pitfalls that brings along), to provide a more easily attainable starting point.

If you're making a custom format, then you'd prefer to make sure it is as complete (or extensible) as we would ever need, and that's when it takes more time - and you would likely end up with something like (but not necessarily identical to) ModBase.

Dirst

  • Bay Watcher
  • [EASILY_DISTRA
    • View Profile
Re: Proposal: a standard format for mods in a diff/patch Mod Starter Pack
« Reply #32 on: August 15, 2014, 02:18:07 pm »

King Muir, I was being a little too flippant... forgetting about the removal part.  That said, if you assume away file collisions then it could be a simple script.  (For the ultimate in simplicity, back in VMS you could accomplish this kind of rollback with a single command.)

Pidgeot, something like ModBase would be a bit too raw-aware.  I like that idea of being able to do math in the script, and I noted above that positioning should be done at the tag level, but otherwise it should be processing more-or-less arbitrary text.  Otherwise we dive down a rabbit-hole of trying to parse increasingly complex tag structures with a never-ending parade of special cases.  A couple *nix standards, slightly buffed, gets you just about everything that modders do except re-ordering things.

But I do agree, the simple diffs that can't handle collisions is a good starting point.
Logged
Just got back, updating:
(0.42 & 0.43) The Earth Strikes Back! v2.15 - Pay attention...  It's a mine!  It's-a not yours!
(0.42 & 0.43) Appearance Tweaks v1.03 - Tease those hippies about their pointy ears.
(0.42 & 0.43) Accessibility Utility v1.04 - Console tools to navigate the map

thistleknot

  • Bay Watcher
  • Escaped Normalized Spreadsheet Berserker
    • View Profile
Re: Proposal: a standard format for mods in a diff/patch Mod Starter Pack
« Reply #33 on: August 15, 2014, 03:36:18 pm »

I did all that... with simple strings... I could reference certain values of certain tags of certain objects, like creating a sword with a damage value dependent on that of an existing sword.

Quote from: Magic Weapons submod of Martial Arts+
[ITEM_WEAPON:ITEM_WEAPON_SSWORD_CRUEL]
[NAME:shortsword:shortswords]
[ADJECTIVE:Cruel]
[DAMAGE@:%ITEM_WEAPON_SWORD_SHORT+10:GORE]
[WEIGHT:35]
[SKILL:SWORD]
[CRIT_BOOST:1]
[TWO_HANDED:4]
[MINIMUM_SIZE:4]
[MATERIAL_SIZE:6]
[STICK_CHANCE:30]

It's context-sensitive in this case (pulling the damage value from the same spot of the same tag of a different item of the same type), but was intended to work just as well for different-type objects and different tags.

I think your tool needs to be updated to include castes then. However, I think a simple collection of "patches" that players could load on vanilla would be the next step. I do know ur tool required vanilla as a base but the steps seedseem a bit cumbersome. I would think a simple batch file should all that would be needed to apply some patches to vanilla
« Last Edit: August 16, 2014, 03:44:24 pm by thistleknot »
Logged

milo christiansen

  • Bay Watcher
  • Something generic here
    • View Profile
Re: Proposal: a standard format for mods in a diff/patch Mod Starter Pack
« Reply #34 on: August 15, 2014, 05:12:16 pm »

One word: Rubble.

The only real lack is a cross platform GUI, but that is just the front end, the actual tool works on all OS's.
Logged
Rubble 8 - The most powerful modding suite in existence!
After all, coke is for furnaces, not for snorting.
You're not true dwarven royalty unless you own the complete 'Signature Collection' baby-bone bedroom set from NOKEAS

PeridexisErrant

  • Bay Watcher
  • Dai stihó, Hrasht.
    • View Profile
Re: Proposal: a standard format for mods in a diff/patch Mod Starter Pack
« Reply #35 on: August 15, 2014, 06:32:10 pm »

The minute you go beyond vanilla diffs, you're creating a custom patch format. This means you need to re-implement patching yourself; existing libraries cannot be reused.
I think some kind of custom format is unavoidable; it just needs to be open.

We don't need a mod managing tool if all we have are mini-mods that can be unzipped on top of a vanilla install.  We also don't get much bang for the buck if we don't store things as diffs of some type (a graphics pack can make tiny changes to lots of large files).
I do. I want to be able to easily add and remove mini-mods without having to manually reapply each mod to vanilla on each remove or to work out how to remove a mini-mod while leaving others intact.
It's unavoidable in the long-term, definitely, but for the short-term, Peridexis is proposing to use a completely standard diff (with the pitfalls that brings along), to provide a more easily attainable starting point.

If you're making a custom format, then you'd prefer to make sure it is as complete (or extensible) as we would ever need, and that's when it takes more time - and you would likely end up with something like (but not necessarily identical to) ModBase.

One word: Rubble. 

Custom formats are a lot of work, have been done, and have been done well.  ModBase is great, Rubble is simply brilliant, but they're solving a different problem.  The goal here is *not* to merge overlapping mods well, it's to make using mods easy for new players. 

Maybe a custom format is unavoidable in the long term, I suspect not, but until something has wide adoption any new format will lead to nothing but fragmentation and stagnation as it becomes too much trouble to use these tools.  In any event, if a special format was used at all I would need to hear some pretty good reasons to do anything but include Rubble and give users the option of the simple and advanced mod loaders.  In response to all the ideas about flattening raw structures, maths in scripts, etc:  different goals.  The point of using standard diffs here is ease of use, and eye to future size reduction in the format, and *not* advanced merging.  Making two unrelated changes to a file is enough!

The advantage of a diff over simple file overwrites is simply that it handles bloated small mods more elegantly, and it's fairly easy to implement with standard libraries.  If not, file overwrites will do.  I'm hoping we'll also see a slightly different mod philosophy where instead of including all the favourite tweaks, we get just the changes that are a core part of the mod, equivalent to graphics packs leaving the population cap at vanilla levels. 

Other scripts, fancy tools, etc should be just as compatible with the output of this process as any other mod; so scripts which (eg) edit aquifer tags will work just fine. 
Logged
I maintain the DF Starter Pack - over a million downloads and still counting!
 Donations here.

milo christiansen

  • Bay Watcher
  • Something generic here
    • View Profile
Re: Proposal: a standard format for mods in a diff/patch Mod Starter Pack
« Reply #36 on: August 15, 2014, 06:53:35 pm »

I still think that Rubble is just a good GUI away from solving the problem, and for those who are stuck on diffs Rubble can (as of 4.4) apply standard format patches.

It is easy to look at Rubble as a modding tool, but I designed it as a general purpose mod installer first and a modding tool second. The only drawback is that mods need to be prepared to work with it, you cannot just drop any old mod in and expect it to work.

If someone comes up with a general purpose mini-mod format that does not depend on a specific scripting system or other host I would be happy to add Rubble support for it, just post in the Rubble thread when finalized.
Logged
Rubble 8 - The most powerful modding suite in existence!
After all, coke is for furnaces, not for snorting.
You're not true dwarven royalty unless you own the complete 'Signature Collection' baby-bone bedroom set from NOKEAS

King Mir

  • Bay Watcher
    • View Profile
Re: Proposal: a standard format for mods in a diff/patch Mod Starter Pack
« Reply #37 on: August 15, 2014, 07:15:12 pm »

In response to all the ideas about flattening raw structures, maths in scripts, etc:  different goals.  The point of using standard diffs here is ease of use, and eye to future size reduction in the format, and *not* advanced merging.  Making two unrelated changes to a file is enough!
I see your point with maths in scripts, but flattening out raws is a simple way to allow more mods to be merged with very little cost. You'd still be using a standard diff, and standard input, but comments, the lack of newlines should not prevent mod merging.

PeridexisErrant

  • Bay Watcher
  • Dai stihó, Hrasht.
    • View Profile
Re: Proposal: a standard format for mods in a diff/patch Mod Starter Pack
« Reply #38 on: August 15, 2014, 07:59:52 pm »

In response to all the ideas about flattening raw structures, maths in scripts, etc:  different goals.  The point of using standard diffs here is ease of use, and eye to future size reduction in the format, and *not* advanced merging.  Making two unrelated changes to a file is enough!
I see your point with maths in scripts, but flattening out raws is a simple way to allow more mods to be merged with very little cost. You'd still be using a standard diff, and standard input, but comments, the lack of newlines should not prevent mod merging.

For clarity, I'm opposed to requiring this in the input format but think it's a good idea in the logic. 

It should be easy enough to flatten all the raws in memory or create temporary copies processed in whatever way we like, which are then handled however.  "merge(flatten(mod1), flatten(mod2))" rather than "merge(flat_mod1, flat_mod2)".  Same effect, easy enough to code, more consistent, easier and more flexible for modders. 
Logged
I maintain the DF Starter Pack - over a million downloads and still counting!
 Donations here.

thistleknot

  • Bay Watcher
  • Escaped Normalized Spreadsheet Berserker
    • View Profile
Re: Proposal: a standard format for mods in a diff/patch Mod Starter Pack
« Reply #39 on: August 15, 2014, 08:13:04 pm »

I'm thinking instead... of xml files.

The raws should be loaded into xml's, comments and all.  The goal is to preserve original file structure (comments and their contextual positions) and token information.

Then some custom patch files are based on the differences based on the xml token's.

Then you have a standardized format that is based on something that works with xml encapsulation vs some other arbitrary patch algorithm.  Only catch is, someone would have to make xml structure to read the raw files (I'm reading up on TinyXML, but not necessarily volunteering). 

Then another program to measure differences between the two xml's of each compared file.

Of course then another overall utility to implement those changes in a way similar to rubble, mod manager, or mod base.

PeridexisErrant

  • Bay Watcher
  • Dai stihó, Hrasht.
    • View Profile
Re: Proposal: a standard format for mods in a diff/patch Mod Starter Pack
« Reply #40 on: August 15, 2014, 08:24:28 pm »

So long as there's a rigidly defined way to translate raws into xml format, I guess that could work well.  I'm still not touching that kind of thing until after we have a mod loader 1.0 out and working. 
Logged
I maintain the DF Starter Pack - over a million downloads and still counting!
 Donations here.

thistleknot

  • Bay Watcher
  • Escaped Normalized Spreadsheet Berserker
    • View Profile
Re: Proposal: a standard format for mods in a diff/patch Mod Starter Pack
« Reply #41 on: August 15, 2014, 09:25:31 pm »

look at this from some rawexplorer link I was viewing

http://dftokens.gumpstudio.com:8080/ViewToken.aspx?Token=PHILOSOPHER

King Mir

  • Bay Watcher
    • View Profile
Re: Proposal: a standard format for mods in a diff/patch Mod Starter Pack
« Reply #42 on: August 15, 2014, 10:45:21 pm »

In response to all the ideas about flattening raw structures, maths in scripts, etc:  different goals.  The point of using standard diffs here is ease of use, and eye to future size reduction in the format, and *not* advanced merging.  Making two unrelated changes to a file is enough!
I see your point with maths in scripts, but flattening out raws is a simple way to allow more mods to be merged with very little cost. You'd still be using a standard diff, and standard input, but comments, the lack of newlines should not prevent mod merging.

For clarity, I'm opposed to requiring this in the input format but think it's a good idea in the logic. 

It should be easy enough to flatten all the raws in memory or create temporary copies processed in whatever way we like, which are then handled however.  "merge(flatten(mod1), flatten(mod2))" rather than "merge(flat_mod1, flat_mod2)".  Same effect, easy enough to code, more consistent, easier and more flexible for modders.
Yeah that's what I meant. Flatten the mods in the tool. 

I'm mostly sold on this proposal now. My biggest concern is if it'll be good enough to handle graphic packs, but worst case you could use that as the baseline instead of vanilla. Maybe I'll have other concerns after I sleep on it more.

thistleknot

  • Bay Watcher
  • Escaped Normalized Spreadsheet Berserker
    • View Profile
Re: Proposal: a standard format for mods in a diff/patch Mod Starter Pack
« Reply #43 on: August 15, 2014, 11:15:30 pm »

I did some searching for a powershell script that could be modified to accomplish that for a set of raws.

http://stackoverflow.com/questions/15283931/powershell-find-replace-string-with-carriage-return-and-line-feed

Spoiler (click to show/hide)

Spoiler (click to show/hide)

Okay, here's the powershell script that will process your entire subdirectory and flatten all the files as you described.

Code: [Select]
$files = @(get-childitem -include *.txt -recurse -path $path -filter $filter)
Write-Host "files loaded";
foreach ($file in $files) {
        $outfile = "$file" + ".out"

        Get-Content $file | Foreach-object {
            $_ -replace '\[',"[`r`n" `
-replace '\]',"`r`n]"
        } | Set-Content $outfile
    }

You know what's funny, is how would one reverse that?  Say you didn't want to leave the raws looking like that after you merged them.  How would one reverse this formula?  I can't merely swap the  '\['   with   "[`r`n"

Update

by doing this [conversion] to new lines, contextual differences might have to be extended to 4 or 5 or maybe even more lines when deriving diff's.

Carrying further on this idea.

http://www.thinkplexx.com/learn/howto/scm/svn/how-to-create-and-use-local-svn-subversion-repository-on-windows-or-linux-simple-and-fast-step-by-step

One could use a local svn repository system to apply these mods.  Possibly even create little git batch scripts with a front end menu to load configurations of mods using a cherry picking system.

Update
I tried it out on github to see what a 34.11 to 40_08 accelerated modest mod conversion would look like and it has less conflicts, but, breaking up the token's has chaotic affects, especially with conflicting tokens.  Two token's are kind of wanted to be merged together.

http://imgur.com/yLFixQO

It would also tremendously help by first parsing all tokens from non tokens, and just working with tokens so as to avoid any merging errors with comments and flattened tokens.
« Last Edit: August 16, 2014, 01:29:15 am by thistleknot »
Logged

thistleknot

  • Bay Watcher
  • Escaped Normalized Spreadsheet Berserker
    • View Profile
Re: Proposal: a standard format for mods in a diff/patch Mod Starter Pack
« Reply #44 on: August 16, 2014, 08:54:24 am »

I fixed that script a little more (was putting the [ and ]'sin the wrong place)...

Code: [Select]
$files = @(get-childitem -include *.txt -recurse -path $path -filter $filter)
Write-Host "files loaded";
foreach ($file in $files) {
        $outfile = "$file" + ".out"

        Get-Content $file | Foreach-object {
            $_ -replace '\[',"`r`n[" `
-replace '\]',"]`r`n"
        } | Set-Content $outfile
    }

sample output

Code: [Select]
c_variation_default


[OBJECT:CREATURE_VARIATION]



[CREATURE_VARIATION:ANIMAL_PERSON]


[CV_REMOVE_TAG:NAME]


[CV_REMOVE_TAG:GENERAL_CHILD_NAME]


[CV_REMOVE_TAG:GENERAL_BABY_NAME]


[CV_REMOVE_TAG:CASTE_NAME]


[CV_REMOVE_TAG:CHILDNAME]


[CV_REMOVE_TAG:BABYNAME]


[CV_REMOVE_TAG:SMALL_REMAINS]


[CV_REMOVE_TAG:DESCRIPTION]


[CV_REMOVE_TAG:CREATURE_TILE]


[CV_REMOVE_TAG:COLOR]


[CV_REMOVE_TAG:MAXAGE]


[CV_REMOVE_TAG:SOUND]

I'm thinking I can modify this to remove all blank lines


I may... Don't hold me to it, be able to indent object type using a regular expression

Then use a batch file to derive diff's between two folders to generate a unified diff patch
« Last Edit: August 16, 2014, 11:10:32 am by thistleknot »
Logged
Pages: 1 2 [3] 4 5 ... 22