Jump to content
Sign in to follow this  
Thygrrr

[TOOL] CarrierTools (modding tool inside)

Recommended Posts

IMPORTANT:

Don't use this or any other tools in any way to breach the EULA. Bohemia Interactive is very permissive when it comes to modders, let's give them good reason to keep it this way.

Thanks to Dram and Foxhound for giving feedback before I posted this.

CarrierTools

A work in progress, and its initial version it's really just some random script snippets, but it's all you need to start modding the game!

Where can I get it? Can I help? Can I share this?

Contributions and forks are welcome, my code is public domain!

:icon_arrow:Download latest revision as ZIP

:icon_arrow:View the repository on Bitbucket

pac1.py - data file unpacker

What does it do?

Carrier Command: Gaea Mission ships with three large data files (data00.cc, data01.cc, and data02.cc), later referred to as PAC1 files, that are mounted as a virtual file system. Like many games, it also supports real files - it's even configured to do so by default, making modding very easy. I took a look at these big files and while I have no access to an Enforce3 SDK, the format is straightforward enough to write a simple reader that can convert it into individual files, which is kind of the prerequisite to modding. This first version of my CarrierTools is just this simple reader!

Who can use it?

Everyone, if you a) adhere to the EULA, and b) have a rough idea about how install Python and how to run a Python script.

How does it work?

You need Python 2.7 properly installed. Simply drag the .cc files onto the batch (extract.bat) file, or manually run the python script like so:

python pac1.py extract data02.cc [destination]

If everything is sufficiently nearby (i.e. you are in the right directory, and your python.exe can be found in your system's PATH), you should end up with a screen full of spam and a directory called data02.cc.unpacked that contains all the files from the package. Browse to your heart's content!

New: I have also added a repackaging functionality, that works like this:

python pac1.py package mydirectory [destination]

How do I make a mod for Carrier Command: Gaea Mission?

I am still trying to figure the details out. Maybe the CarrierTools need some extra features first. I have been able to make very basic mods, but they are little more than tests, so I won't share them. Instead, you should experiment and take any content you wish to add / override and place it in the directory where the original data0?.cc files are located. For instance, if you wanted to change the intro video, create a folder video and place an appropriate video named intro.wmv in it. The game should, upon launch, display the new intro video instead of the original one.

Is there a way to distribute mods as a package?

Yes, but it's a little tricky to install them - and it works differently for steam and non-steam versions. I am still working on improving this process.

Put all your mod components into a directory named like you want your mod to be named, and then pack that directory using pac1.py or by dragging that directory onto the package.bat that I conveniently include with the CarrierTools. Put the resulting .pak into your Carrier Command directory. Depending on the version of the game, you need to do different things.

(steam)Open the ccsettings.xml that belongs to your player's profile - this is NOT the one in the Carrier Command directory, it's the one where your save games are.

Add the line <path directory="mymodname.pak" /> to the top of the filesystems list, replacing mymodname with the name of your mod, obviously.

(sprocket/retail) Name your mod patch01.pak (or maybe later) and place that in the Carrier Command Directory. Alternative: on version 1.2, unpack patch00.pak and put the mod into it as well (overwriting the originals), then re-pack.

Edited by Thygrrr

Share this post


Link to post
Share on other sites

Excellent work, thank you very much for making this. Now lets see what we can make for this game :)

I wrote a news item about this on my new fan site Carriercommandaholic.com.

You can find our mirror here: CarrierTools

Note:

I still need some good pics for mirrors and news items, so excuse the crappy text above :)

Edited by Foxhound
mirror updated

Share this post


Link to post
Share on other sites

your unknown1 is:

byte - filetype of the toplevel folder (always 0)

byte - namelength of the toplevel folder (always 0)

4 bytes - number of files/folders in the current folder

unknown2:

4 bytes - number of files/folders in the current folder

unknown3:

4 bytes - original size of the file

unknown4/unknown5/compression:

8 bytes - unknown, didn't need them in my script

if the compressed filesize == original filesize just copy it else it's zlib

here's my QuickBMS script: http://pastebin.com/MYiUE7wr

Share this post


Link to post
Share on other sites

Awesome, thanks Master85!

Edit: Updated the tool, it now expands the directory tree. Ahhh, that makes so much more sense!

Edited by Thygrrr

Share this post


Link to post
Share on other sites

In data02 there are some .h files, mp_capturecc and mp_deathmatch...

// File: mp_capturecc.h

//

// Desc: Carrier Command: MultiPlayer Mode - Capture the CommandCenter

//

// Author: raist

//

// Copyright © 2000-2010 Black Element Software. All rights reserved

//-----------------------------------------------------------------------------

// File: mp_deathmatch.h

//

// Desc: Carrier Command: MultiPlayer Mode - DeathMatch

//

// Author: raist

//

// Copyright © 2000-2010 Black Element Software. All rights reserved

//-----------------------------------------------------------------------------

Looks like multiplayer to me, also all the stuff including AI in c++, very tasty indeed, were talking full on modding.

Edited by ToxLaximus

Share this post


Link to post
Share on other sites

Updated the tool, it now expands the directory tree. Ahhh, that makes so much more sense!

ToxLaximus: You should check out the new version and run it again. That'll give you a much tidier directory structure (and correct, as well).

IMPORTANT:

I can now confirm extended moddability, also for scripts (if you use the newest version of the tool, so you get the directory structure right).

This is a screen from my strategic mode island generator mod test. Figure out what's different...

http://i47.tinypic.com/3494e2g.jpg (186 kB)

Edited by Thygrrr

Share this post


Link to post
Share on other sites

Sweet, so all that is needed is a tool to unpack the .cc files -> mod -> repack and good to go?

Just like the old q3engine mods, endless possibilities. :yay:

Share this post


Link to post
Share on other sites

You don't even need to repack (for development purposes).

You just need to recreate the directories, as you see them in the *.cc.unpacked folders, in the main game folder. You could create a custom scripts\campaign\islandgenerator.h and observe the modded effects instantly in the game when you launch it.

This is extremely modder friendly.

(a little downer: a lot of the script code seems to (of course) rely on native functions that are off limits / undocumented, which was to be expected. you can't mod everything.)

Edited by Thygrrr

Share this post


Link to post
Share on other sites

Thanks Thygrrr, the source looks seriously cool and I have to agree that it's very easy to modify.

I've already managed to mod it so each side in the skirmish game begins with only 3 islands (instead of the current situation where both sides added together had 26 of the 33 islands). I'm unsure about how Bohemia want to deal with mods, so I'm not going to post it unless it's ok, but if anyone wants to know what code to change (it's trivially easy) then feel free to ask.

Also the sheer amount of exposed code makes this very exciting for the future of CC

---------- Post added at 00:30 ---------- Previous post was at 00:27 ----------

One quick thing that is useful for people poking around in code; add #define DEVELOPER to ccgame.h (in data02.cc) and add to /scripts in the game directory. This (amongst other things) creates the campaigns.log file wherever you're saving the game data to - which is basically a nice log file of the last run through of the game. You can add lines to it using CampaignLog("STRING TO ENTER",1); in the code.

I hope that helps someone!

Share this post


Link to post
Share on other sites
You don't even need to repack (for development purposes).

You just need to recreate the directories, as you see them in the *.cc.unpacked folders, in the main game folder. You could create a custom scripts\campaign\islandgenerator.h and observe the modded effects instantly in the game when you launch it.

This is extremely modder friendly.

(a little downer: a lot of the script code seems to (of course) rely on native functions that are off limits / undocumented, which was to be expected. you can't mod everything.)

So like with pk3 files, eventually you can mod your files, pack them into one .cc file that takes president over the originals, so installing a mod you just copy the file to the game folder?

Share this post


Link to post
Share on other sites

No. This would require mounting the new *.cc file in the ccsettings.xml of the game. I'm sure this will be a future feature at a later time.

Currently though, that file is by default set up so you can easily shadow content of the stock *.cc files by creating normal files with the same internal name and subdirectory in the game directory.

This is not optimal for mod distribution. It's close to optimal for mod creation and experimentation, though.

Share this post


Link to post
Share on other sites
Have you found the pathing AI to be mod-able?

Partially for sure, there's navigation spaces, heightmaps, and pretty much of the decision making happens in the scripts.

*sigh* However... the sheer mass of that game content is a bit disheartening.

Maybe I shouldn't try to understand a project that has several dozen man years of work in it in a single night, at 3:20 am.

Mood: env_mountains01.ogg ...

Edited by Thygrrr

Share this post


Link to post
Share on other sites

Yeah, needle in a haystack, I'm looking for the walrus turning circle, if the walrus turns on a dime it might not get stuck, also making them 10x faster would be fun.

Share this post


Link to post
Share on other sites

Not everything is scriptable. I hit a snag modding my own campaign button for the UI - I can create a layout, but it's dumb; the button clicky magic must happen in carrier.exe.

Edit: But I can see some potential bugs in the AI combat behaviors.

Edited by Thygrrr

Share this post


Link to post
Share on other sites

It has been mentioned that an island editor might be released. Sorry for asking without having checked myself (can't at the moment), but does it look easy enough to add islands to the 'skirmish mode'.

Share this post


Link to post
Share on other sites
It has been mentioned that an island editor might be released. Sorry for asking without having checked myself (can't at the moment), but does it look easy enough to add islands to the 'skirmish mode'.

The island editor will allow you to to adjust and create new islands. You can essentially "paint" terrain, vegetation etc, and you can also add triggers, keypoints etc etc etc. Essentially everything you need to make a mission (including an inbuilt script editor).

Share this post


Link to post
Share on other sites
The island editor will allow you to to adjust and create new islands. You can essentially "paint" terrain, vegetation etc, and you can also add triggers, keypoints etc etc etc. Essentially everything you need to make a mission (including an inbuilt script editor).

This sounds absolutely terrific!

Add the ability to save/export islands and for other users to easily import them into their Strategy mode. This could really increase replay value!

I would love to cruise in a ocean of new challenging islands every time! :D

Share this post


Link to post
Share on other sites

I think the islands are one of the more complex assets of the game. That's why there are 33, not 64, but 33 is a pretty impressive number given the wonderful detail of those islands. Also, the smaller number gives the game a much-needed focus that the original from '88 lacked.

Before we can think about adding more islands, I believe what we'll need is some kind of "clean" from scratch campaign that doesn't get bogged down by the endless amounts of dialog event code as it is (and where it needs dialogs, I'd encapsulate this in a dialog module). Then, alleviate some of the hardcodedness of the islands and their objectives along the way... and then rebuild a "clean" ccgame around it, maybe. Otherwise we modders are going to make everything worse instead of better... and nobody wants that!

Share this post


Link to post
Share on other sites

What'll probably be useful is for someone (or a group) to create a function list across each file, which will then help in locating the things to change. I also took a look for AI moving code, but couldn't find it. Combat AI, that's pretty easy to find though.

It does look like the menus possibly aren't scriptable which is a little disappointing, but hopefully that might be opened up later (or just hiding in a file I haven't checked).

Thinking about the movement AI, I may have found where the trees and rocks are added, and they look easily removable. If so, that could be something to try until the pathfinding is improved so the Walrus' at least don't get stuck so often.

Share this post


Link to post
Share on other sites

IMHO the best start are the remains of the old beta campaign, or the preview campaign. Why? Because that builds a fixed simple network of islands. Meaning one can start with a small 3 island test campaign, and slowly refactor this until it's really scalable.

I have yet to find out what in the game runs the actual scripts, i.e. how they are "linked" into the game at run time. This is the key magic thing the engine does. And maybe there's even an event hook in proto.h or somewhere else for UI events, or maybe it'll be added later.

Share this post


Link to post
Share on other sites

I was imagining a pool of islands to which player created islands can be added. (Islands being downloaded from internet and saved locally)

When starting a new strategy session:

- Player sets total amount of islands.

- Player sets how many should be player-owned and enemy-owned (rest is neutral).

- Computer randomly selects islands from "the pool" and creates the island network.

But this is pretty much work or even undoable as it sounds? (or not close to how it is set up today)

Edit: I believe 33 islands are too few from a replay point of view, that's why I start thinking along these lines. It's not so fun seeing the same islands all the time and go "Aaah, it's this one well let's do the same thing as last time that worked well.". Besides, I love the idea of making my own islands... :)

Edited by Scepticer

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×