Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - thistleknot

Pages: 1 ... 14 15 [16] 17 18 ... 140
226
So... I think I may have a solution with how to apply older mods to newer versions of the game.

http://cyberelk.net/tim/patchutils/man/rn01re02.html

http://en.wikipedia.org/wiki/Quilt_%28software%29

Basicaly, merge patch files.

Vs trying to apply a 34_11 mod to 40_08 as a patch of changes that we based on 34_11 vs 40_08...

One could take a diff patch of 34_11 to 40_08,
  call this 34-11To40-08.patch
And a 34_11 to Accelerated,
  call this 34_11ToAccelerated.patch

Then, using the tool combinediff (I guess any conflicts would have to be addressed on the patch file level)

something like combinediff 34-11To40-08.patch 34_11ToAccelerated.patch > 34_11To40_08_Accelerated.patch

and apply this patch to a 34_11 version of the game to achieve a v40_08 mod of the game, then do a diff comparison from 40_08 to this mod of v40_08

In light of what that script is doing, I recommend this one now

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

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

I was reading on what it does, and it rewrites the replacement operations.  I'm gonna push a better script in the next day or two if I don't learn a better way to write a script.

227
I plan on using mod managers merge for my own personal project BTW.

It is entirely possible to do the same thing that mod manager does using regular patch files and merely checking the states of objects before and after merges (python anyone?)

My idea of merging 3411 mods into 40_08 was just an example of PORTING mods over and HOW it can be done, but expect to resolve some minor diff conflicts then derive a final 40_08 diff for your project

228
I figured out what causes the merge conflicts...

It's when I derive a patch from:

34_11 to accelerated

then...

I try to apply it to

40_08

the conflicts arise because my patch file is confused when it expects a 34_11 line and see's a 40_08 line.  Only way to fix that is to incorporate into the patch the 34_11 to 40_08 changes as well as the accelerated patch

so...

to alleviate this...  it's almost like we need to apply a diff patch of 34_11 to 40_08 + the accelerated patch in the same patch file somehow.

229
even better script guys.

Thanks to briantist on stackexchange

http://stackoverflow.com/questions/25345739/powershell-regexp-to-replace-any-character-left-bracket-and-replace-wit

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

        Get-Content $file | Foreach-object {
            $_ -replace '(?m)^\s*','' `
-replace '(\[.+?\][^\[\r\n]*)(?=\[)' , "`$1`r`n"
        } | Set-Content $outFile
    }
   
Spoiler: what it does (click to show/hide)


input: *.txt
Spoiler (click to show/hide)

output: *.txt2
Spoiler (click to show/hide)

this method should hopefully address comments onto their own lines as well.

Update

so... to test these changes out yourself, install a git client (I use github, it's all I know).

and you can derive your own patch files after parsing your raws and replacing the old ones with generated ones

how?
install a git client
create a commit based on vanilla raws
run the above script on your copy of [vanilla] raws
replace yours raws with the "flattened" raws
recommit
Create a branch based on your old client (can be done using the filter menu by typing in a new branch if using github)
open a git console, and run this to derive a patch file

git diff a e > mynewpatch.patch

a being the hex commit # of pre changes
and
b being the hex commit # of post changes

ex.

a = vanilla hex commit
b = civforge hex commit

that should give you a contextual diff file

then you can use tortoisegitmerge to merge the diff file to a mod folder.

I would imagine that if there are no conflicts, that you could use diff command line to do all the merging

Update 2
I just made some merges using this parsing method, and it still requires manual intervention.  Maybe about 5 minutes worth of work to apply a mod, then derive a patch.

With this system.  Whoever implements the mod options, has to do all the manual merge conflicts themself, then derive a patch that will be ran over vanilla.

Which means version tracking for the mod creator to fine tweak the commits/new branches and base patch files off those branches.

Here's my patch files:

http://dffd.wimbli.com/file.php?id=9418

...

In all honesty, it would almost be better to use a github repository to host all the mod options from...


Otherwise, you have to basically ship out a git offline client to the end user to be able to fire up and have all the local repositories available.

Or... one could make an elaborate setup of patch files to apply, but ultimately, someone somewhere has to keep track of it using a git version tracking.

Update again
Reuploaded a new set of patches, missed the 40_08 patch accelerated (appliied)...

http://dffd.wimbli.com/file.php?id=9418

230
Utilities and 3rd Party Applications / Re: UI Improvement Plugins
« on: August 16, 2014, 10:33:22 pm »
good to see your plugins in 40_08

not sure if I'm in an oldie moldie thread or not...


but


I noticed I accidentally hit like ctrl-s or something and brought up a "custom reactions" menu... however... I can't seem to bring it up again.

Can you please confirm or deny this great feature's existence or not and how I may access it again?

231
Utilities and 3rd Party Applications / Re: Mod Tool Merger
« on: August 16, 2014, 04:24:42 pm »
Flattening the file (with or without indents for readability) only really helps collisions if you are going to position diffs based on tags (literal, parameterized, regular expression, etc.) rather than lines.  The reason is that mod A might add or delete lines, which would make mod B place its changes in the wrong place.

The specific use-case I keep coming back to is two different mods that create custom workshops and reactions... both need to insert stuff into entity_default.txt.  A more complicated case is ensuring that a tag lands inside the correct caste after someone has inserted half a dozen PREFSTRINGs, and that is also handled by using tags as location hints.

I'll answer this one first:

Quote
A more complicated case is ensuring that a tag lands inside the correct caste after someone has inserted half a dozen PREFSTRINGs, and that is also handled by using tags as location hints.

I think a back-updated object verification [based on reading a patch file] could resolve this.  Read, the file tag.  Identify the object...  Then... idk.  Try to keep track of old data object and new data object being edited.

second issue

Quote
is two different mods that create custom workshops and reactions... both need to insert stuff into entity_default.txt

I think that can be resolved by back measuring differences inbetween objects.  Take before and after state, and compare the object based on the files being edited.

Is it new?  If so, create a new object.

232
okay, final udpate.

I worked really hard to ensure when I split token's that it didn't create [empty] newlines.

basically, tabs are removed first, then a carriage return "`r" and new line "`n" is created inbetween ]['s

works in powershell

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

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




output is .txt2

sample before and after output

Spoiler: before (click to show/hide)


Spoiler: after (click to show/hide)

Update
I did some tests with trying a 3 way merge.  The merging process is a lot smoother with the flattened raws, but I could still see a need for still checking if the token's in conflicts are being duplicated.  That would resolve most conflicts I think.

Update 2
I took a walk and thought about why I was having [merge] conflicts.  I was wondering if, using this parse method, it was due to not setting all tokens on their own line by themself when they were next to a commented out line... 

however, the merge conflicts I had were not due to token's being next to a comment (I think I might have to update the parse method to consider if a token is adjacent to a comment).

I think it might be because I applied two mods (patch of 34_11 to accelerated, and a patch of accelerated to modest...as one patch over a 3rd mod (40_08)), which I think may have cause some [merge] conflicts with [duplicate] grazer tags.

In other words, I'm thinking if raws are parsed using this method, and applied one at a time to a 3rd mod.

For ex.

diff of 34_11 vs 34_11 accelerated: as a patch
  applied to 40_08
diff 34_11 accelerated vs 34_11 accelerated modest: as a patch
  applied to 40_08 accelerated

one might avoid conflicts?  I certainly believe raw parsing the files in this manner before merging reduces the # of contextual conflicts.

Here's what a diff between 34_11 and 34_11 accelerate modest looks like with this parse.

http://pastebin.com/curfNcMH

Update 3:
I think if one back-update's some in house object tracking variables (using these patch files); such as file_name, and the first [object: name] token, using a scripting language like python, one should be able to fill in the blanks when it comes to patching location (even without col, row information) ;)

Then one could parse the diff files and derive the object id, and be able to ensure the diff file is being applied to the correct object/token id (such as: creature or item or entity, or whatever) by keeping track of duplicate[ token]s!

That would resolve the grazer issue.  If castes come into play...  I guess a simple check if the current caste is having a token duplicated, then figure out what token is the master token to be used.

233
Here's a sed (*nix utility) command that will do it:
Code: [Select]
sed -e "s/^[^[]*//" -e "s/][^\[]*$/]/" -e "s/][^[]*\[/]\n\[/g"It removes comments and splits tokens to one per line. To just split up tokens you can do this:
Code: [Select]
sed -e "s/][^[]*\[/]\n\[/g"
You can also use those regular expressions with any regular expression library.

EDIT: But instead of doing this all in shell scripts, it would be better and more portable to use Python.

thx, linux cl works in powershell apparently
nm

234
I was thinking about some more complex version of extended diff format.
For example:
Code: [Select]
raw>object>entity_default.txt
?[ENTITY:MOUNTAIN]
+[NOPAIN]
-[PERMITTED_REACTION:SMELT_IRON] # just sample.
@[ENTITY:DWARVES]

Where

Code: [Select]
     ? find line
     + mean insert line
     -  remove line
     @ replace line
     # comment

This can be easily connected with each other.
For example if you want replace tag ITEM_WEAPON:Sword with ITEM_WEAPON:Big Sword
You need to just write it like that
Code: [Select]
raw>object>item_weapon.txt
?[ITEM_WEAPON:Sword]
@[ITEM_WEAPON:Big Sword]

It should be much easier that regexp.

while I agree with you logging the token id with the patch file.  Peredexis was concerned with the drama involved with modifying the patch format.

I believe by flattening the raw file, it allows for contextual block matching to take over.  So, in theory, creatures should line up and token differences should be noticed more.  It might not really be the ideal solution and may require additional parsing (such as token comparisons between the same object between two mods).

235
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

236
I was reading through your program.

It sounds cool.  I know how I can make some mods of mine in rubble.

Then I was thinking how i'm trying to auto-merge mods and how you deal with basically cherry picked "patch files" inbetween mods more or less; however, a modder has to cherry pick, and (I'm assuming cuz I haven't seen an example yet, but) when he does, he has to expand on just the patch differences?

So I was thinking (I haven't read all the documentation... yet).

Is you seem to be very aware of the entire raw structure, it seems like if you allow a player to modify aspects of reactions (kind of like a diff change) using your rubble system, that you yourself on the backend must wipe out and recreate the object id they are editing.  I haven't gotten up to that point in the documentation.  It would seem like a pain to make a modder have to rewrite an entire object by hand if he only made a single change to an object.  Like I said though, I'm not 100% on how you have your's setup.

While your rubble system seems great.  It seems like A HUGE LEARNING CURVE to apply mods, and it asks a lot of a mod creator.  Although... I can see if someone wanted to LEARN HOW TO MOD using rubble.  That's one thing.  But to be a modder and want to convert a mod to using rubble...  idk.  There's a lot to learn I would say.  Some of the things seem like modding shortcuts, but some of the other things seem like a lot of 3rd party language learning.  The basic templates seem easy enough.  However, when I mod (generally limited to merging), usually notepad++ and tortoisegitmerge is all I need and at most I need to google a regular expression every now and then.  I'm not 100% sure if porting diff patches to rubble format would be more or less work than trying to manually merge conflicts.  Have you considered parsing diff files?  Or have you had similar issues with having to review conflicts?  With what Peredexis just pointed out, a way to flatten diff files is to replace [ and ] with newlines followed by their respective [ and ].  I put a powershell script up that does it.  I think it has the potential for knocking out diff merge conflicts.

I have to admit though, your tool seems pretty all encompassing from this vantage point.

237
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.

238
Utilities and 3rd Party Applications / Re: Mod Tool Merger
« on: August 15, 2014, 10:47:09 pm »
that's a pretty great idea.

Broken token's wouldn't be too obvious though.

I would think a newline should be around every [ and ].

That way broken tokens would stand out?  Probably not worried about broken tokens?  Well idk if it would have an affect.

I say broken because I've seen mods that comment out a bracket of a token to null it out from being loaded.

Unless you autoprune all broken tokens/comments beforehand...

Update:

That is a great idea.  However, that's not the route I'm taking atm.  I was honestly thinking of a way to do what you just described using a batch file however.  I'm wondering if a batch file can use a regular expression to perform such a feat.

239
Utilities and 3rd Party Applications / Re: Mod Tool Merger
« on: August 15, 2014, 10:15:18 pm »
I could play around with tag-wise diffs some when I get home, maybe I can come up with a nice algorithm and plain text representation :)

Maybe I can come up with something that gives you some nice ideas, I guess we'll see.

It seems that there is a lot of interest in a DF-centric diff format lately...

that is my goal as it was the biggest issue I had with deriving manual merges and is why I started this thread.  However, it is my own little brain excercise.  I think a token based patch file would help merge mods better than standard diffs due to conflicts in lines.

Pages: 1 ... 14 15 [16] 17 18 ... 140