Modding tools

Started by gibbed, September 11, 2011, 05:00:42 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

gibbed

This is a copy of my post on SA.

Guests are not allowed to view images in posts, please Register or Login


After seeing a bunch of discussion about Far Cry 2 in the Steam thread it kicked my interest in trying to mod the game again and I finally got somewhere with making some tools!

At this point, we can now modify properties of basically any object in the game, providing you find its definition.

Tools

Binaries from revision 52 (Requires .NET 4.0).

(You should probably use the Bootstrap package available from the Basics tutorial)

Source code is available for my tools on my Dunia repository.

  • Gibbed.Dunia.ArchiveViewer.exe - Allows viewing & extracting of content in fat/dat archives, fairly user-friendly.
  • Gibbed.Dunia.ConvertBinary.exe - Used to convert *.fcb files to and from *.xml dumps. These files contain object definitions.
  • Gibbed.Dunia.ConvertXml.exe - Used to convert *.rml (and some have *.xml extension) to and from *.xml.
  • Gibbed.Dunia.Pack.exe - Creates archives from a directory.
  • Gibbed.Dunia.Unpack.exe - Extracts archives, less user-friendly but batch-friendly extraction option.


[admin]I edited the FC2 logo as it was a little too big and broke the board's layout. /Art[/admin]

gibbed

Bootstrap

To make things easy for everyone, I created a little bootstrap package which will set things up so you can easily create patch packages.

Bootstrap, revision 60 (requires .NET 4.0)

Extract this, preferably to X:\Path\To\Far Cry 2\modding

You'll want to run bootstrap.bat which will set everything up automatically.

You can then edit the contents of the XML files in mymod directory and run build_patch.bat to build a patch.fat/dat you can copy to Data_Win32 (or edit build_patch.bat to overwrite them automatically).

Basics

Most of what you'll want to modify are in what are called Binary Resource Files (*.fcb), the main ones are found in patch.fat and worlds\worlds.fat, notably:

patch.fat\generated\entitylibrarypatchoverride.fcb
worlds.fat\world1\generated\entitylibrary_full.fcb (and entitylibrary.fcb)
worlds.fat\world2\generated\entitylibrary_full.fcb (and entitylibrary.fcb)


entitylibrarypatchoverride.fcb was added in a patch to allow as an easy way for developers to override entities in all other *.fcb files without having to update the originals (because they're huge as f@#k). This is our entrance into overriding new stuff.

If you used the bootstrap package, you'll find a copies of the converted entity library files in the modding\libraries directory.

As an easy way to test this is to modify some player properties.

Unfortunately the patch entity library doesn't have any player data in it yet, so we'll want to add it.

  • Copy modding\libraries\world1\30_player.xml to modding\mymod\patch\player.xml.
  • Open modding\mymod\patch.xml and
    after
<object external="17_pile_archetypes.xml" />add<object external="player.xml" />Save the file.
  • Now open modding\mymod\patch\player.xml, it's a large file (10MB), be warned.
  • Do a search and replace for:
    <value name="fJumpHeight" type="Float">1</value>to <value name="fJumpHeight" type="Float">100</value>
    and
    <value name="fJumpHeightExhausted" type="Float">0.4</value> to <value name="fJumpHeightExhausted" type="Float">100</value>

      Save the file.
    • Run build_patch.bat.
    • Copy patch.fat and patch.dat to Data_Win32 (don't forget to back the originals up!)
    • Run game, jump a whole bunch of times and you should eventually leap into the sky. (this value is cached in save files, by jumping a bunch you become exhausted and this causes the value to get reset)

    You'll probably notice that there are lots of classes and values that don't have names, but hashes, or are BinHex types. This is because the binary resource file format isn't very self describing, and I have to manually go and describe these classes to get a nice editable file out of them.

gibbed

If you have a retail copy (non-Steam) copy of Far Cry 2, your patch 1.03 is slightly different and bootstrap will not function with it.

Here is Steam's 1.03 patch content that will mostly w@&k (minor niggling issues) with the retail copy:

http://mod.gib.me/farcry2/steam_patch_data_1.03.zip

gibbed

If you have any questions directly to me about modding FC2, feel free to ask them in this thread.

PZ

gibbed, thanks for posting - we never thought it possible to mod FC2, and several of us have now started on the path to creating the perfect environment for us.  Is it possible to change the duration and/or scope of fire?  The fires in the game are beautiful, and they seem to me to burn out a bit too quickly, especially in the dry areas.

gibbed

From what I remember hearing, there are explicitly set 'burn regions' in maps, I would imagine these are buried in the sector FCBs somewhere and are probably not trivial to modify. I will see if I can drum anything about them up when I have a moment.

PZ

Thanks for the info - fire is one of the weapons I like to use during certain instances.  I also tried placing the Bowa buddies into Leboa, and they properly appear, but obviously their script is not matched - there is no conversation that takes place when meeting the buddy in the safe house even though the missions appear to execute properly - and of course, the buddy missions do not w@&k.

But my $64k question - do you know if there is there a hidden "mission" called BlackMamba that is referenced in the .xml?

Binnatics

Quote from: PZ on September 11, 2011, 05:40:39 PM
gibbed, thanks for posting - we never thought it possible to mod FC2, and several of us have now started on the path to creating the perfect environment for us.  Is it possible to change the duration and/or scope of fire?  The fires in the game are beautiful, and they seem to me to burn out a bit too quickly, especially in the dry areas.
^+-+ :-X :-X

Great idea to be able to just burn an entire area and check out what the mercs will do >:D

By the way: good to have you on board Gibbed!!
You seem like an expert in modding! :-X
I haven't modded myself yet, but once I get done with my first and second playthrough I might give it a shot. The only game I ever modded was Dune 2 (C&C), back in 1993 or something? I could add info or change info to some files when I opened them in the notepad. Doing so I could adjust the amount of starting money and, even better, the amount of tanks available from the start. Even the building speed was to be adjusted.
I remember having modded so much of these parameters I forgot what the originals were, and had to find a clear copy of the files involved :)
"Responsibility is not a matter of giving or taking, responsibility is something you share" -Binnatics

PZ

Quote from: Binnatics on September 12, 2011, 10:12:56 AM
... I could add info or change info to some files when I opened them in the notepad. Doing so I could adjust the amount of starting money and, even better, the amount of tanks available from the start. Even the building speed was to be adjusted...
That's basically the same thing we're able to do with gibbed's tools - changing the settings using notepad, then running a tool that builds the patch file.  :-X

Binnatics

...building a patch file... so that is basically the trick? It all sounds a lot more understandable. Do you also have a patchfile saved that changes everything back to normal again? In case you screw things up? Or do you just have to run the latest 'real' patch like the V1.03 one?

Edit: Urhmm, I think I shouldn't spawn all these questions about the basic modding here. I guess it can be found in the tutorial Thestranger made :-D
"Responsibility is not a matter of giving or taking, responsibility is something you share" -Binnatics

PZ

No worries - the questions you have are ones that I'm sure others will have as well.  Yes, I copied my original patch.fat and patch.dat into a safe location just in case i want to revert to the original.

Art Blade

Thank you a lot for posting that here, gibbed :) :-X
[titlebar]Vision without action is a daydream. Action without vision is a nightmare.[/titlebar]What doesn't kill us, makes us weirder.

nexor

welcome gibbed     :-X :-X

you wouldn't perhaps know where I can lay my grubby paws onto the "modding tool" PZ and ART is talking about?

PZ

Gibbed posted all the tools you need - like Art mentioned in another topic, the bootstrap is the easiest way to get started.  Either go to gibbed's topic or find his tool in our Downloads section here.

nexor

Ok thanks PZ, you guys just have to be patient, this is all new stuff to me, either I'll ask a lot of questions or I'll get to a point where I'll shut up and call it a day       :-D       

nexor

I got as far as attempting to run bootstrap.bat, then I received this error
Spoiler
[smg id=3702]
:D

PZ

hmmm... are you running bootstrap using an administrator account?  The problem looks almost like a permissions error.

nexor

I am the administrator, I tried to run it as administrator then got a different error
Spoiler
[smg id=3703]

PZ

I can't see the path to the .bat file you're trying to run, but it sounds like the bootstrap might not be in the proper place.  I put up a detailed set of screenies indicating how to install the tools here

Here is what you must see in your Far Cry 2 folder:

[smg id=3695]

Far Cry2\bin
Far Cry2\Data_Win32


are the "vanilla" folders that should have been there from the initial game installation, but the modding folder is the one that you unzipped to this location.

...and then once you go into the modded folder, this is what you should see:

[smg id=3696]

Note: you should never change any folder or file name.  It is at this point you run the bootstrap.bat file.

gibbed

The issue is that his copy of Far Cry 2 is in Program Files (x86) and 7 typically denies writing to there. If you can edit the permissions of the Far Cry 2 directory so that your normal non-administrator user has write access that should fix it.

The second bit about the publisher not being verified isn't an error, it's a warning.

nexor

I got that part fixed, and got to the point where I must run build_patch.bat, then I get an error, i'm busy loading a screenshot to show the error

nexor

This is the error I get
Spoiler
[smg id=3704]

nexor

But then I get a different error when I double click on build_patch.bat, I get the Microsoft Windows error, as soon as I close that window then the bottom window appears, but when I run the game the jump has not changed from the normal
Spoiler
[smg id=3705]

gibbed

Quote from: nexor63 on September 14, 2011, 12:03:01 PM
But then I get a different error when I double click on build_patch.bat, I get the Microsoft Windows error, as soon as I close that window then the bottom window appears, but when I run the game the jump has not changed from the normal
Spoiler
[smg id=3705]
Seems like you made an error when editing one of the XMLs, can you detail what changes you made?

nexor

I only changed the values what you put in your posting
I changed this....... 

  <value name="fJumpHeight" type="Float">1</value>
            <value name="fJumpHeightExhausted" type="Float">0.4</value>
to this.... 

    <value name="fJumpHeight" type="Float">100</value>
            <value name="fJumpHeightExhausted" type="Float">100</value>

Tags:
🡱 🡳

Similar topics (5)