←  C&C 3: Tiberium Wars Editing

Fallout Studios Forums

»

The ultimate build configuration

CodeCat's Photo CodeCat 01 Sep 2007

I've been messing with the files a bit, and I have a very flexible and useful system now. The BuildMod.bat file has been adapted with several useful features:

- It can take the mod version and game version as second and third parameters. It assumes mod version 1.0 and game version 1.8 if nothing is specified.
- It just tells you whenever you forget to enter a mod name by accident rather than trying to run the mod builder anyway.
- It automatically compiles mod_l.xml so that mods will work in low detail.
- If the build process fails for some reason due to a critical error, it now stops and lets you know it failed rather than carrying on like nothing happened.
- It checks for a data/ini folder and copies it if found, so you no longer have to put your ini files straight in BuiltMods.
- It writes .SkuDef files automatically.
- It adds the mod version to the name of the .big file, making it easy to create 'incremented' mods.
- It allows you to set/change the default search directories for XML assets, so that you no longer have to stuff everything together into a single Art/Audio folder.

Remember to set the correct location of My Documents. Replace 'whereveryourmydocumentsfolderis' with the location of your my documents folder (Such as C:\Documents and Settings\CodeCat\My Documents) as it is in the original BuildMod.bat, or it won't work! Run it as:

BuildMod modname version gameversion

Thanks go to Slye_Fox and Daz for helping me with some of the features.

@echo off

if "%1" == "" goto NoModError

set modname=%1
set version=1.0
set gamever=1.7

if not "%2" == "" set version=%2
if not "%3" == "" set gamever=%3

echo Mod Name: %modname% version %version%, for game version %gamever%

set mydocs=whereveryourmydocumentsfolderis

set artpaths=".\Mods\%modname%\art;.\Art"
set audiopaths=".\Mods\%modname%\audio;.\Audio"
set datapaths=".\Mods\%modname%\data;.;.\Mods;.\Cnc3Xml"

echo.
echo *** Building Mod Data... ***
echo.
tools\binaryAssetBuilder.exe "%cd%\Mods\%modname%\data\mod.xml" /od:"%cd%\BuiltMods" /iod:"%cd%\BuiltMods" /DefaultDataPaths:%datapaths% /DefaultArtPaths:%artpaths% /DefaultAudioPaths:%audiopaths% /ls:true /gui:false /UsePrecompiled:true /vf:true
if not errorlevel 0 goto CriticalErrorBuildingMod

echo.
echo *** Building Low LOD... ***
echo.
tools\binaryAssetBuilder.exe "%cd%\Mods\%modname%\data\mod.xml" /od:"%cd%\BuiltMods" /iod:"%cd%\BuiltMods" /DefaultDataPaths:%datapaths% /DefaultArtPaths:%artpaths% /DefaultAudioPaths:%audiopaths% /ls:true /gui:false /UsePrecompiled:true /vf:true /bcn:LowLOD /bps:"%cd%\BuiltMods\mods\%modname%\data\mod.manifest"
if not errorlevel 0 goto CriticalErrorBuildingModL
del "%cd%\BuiltMods\mods\%modname%\data\mod_l.version"

echo.
echo *** Copying ini files... ***
echo.
if exist "%cd%\BuiltMods\mods\%modname%\data\ini" rd /s /q "%cd%\BuiltMods\mods\%modname%\data\ini"
if exist "%cd%\Mods\%modname%\data\ini" xcopy /s /i "%cd%\Mods\%modname%\data\ini\*.ini" "%cd%\BuiltMods\mods\%modname%\data\ini"

echo.
echo *** Copying scripts... ***
echo.
if exist "%cd%\BuiltMods\mods\%modname%\data\scripts" rd /s /q "%cd%\BuiltMods\mods\%modname%\data\scripts"
if exist "%cd%\Mods\%modname%\data\scripts" xcopy /s /i "%cd%\Mods\%modname%\data\scripts" "%cd%\BuiltMods\mods\%modname%\data\scripts"

echo.
echo *** Copying str file if it exists... ***
echo.
if exist "%cd%\BuiltMods\mods\%modname%\data\mod.str" del /q "%cd%\BuiltMods\mods\%modname%\data\mod.str"
if exist "%cd%\Mods\%modname%\data\mod.str" copy "%cd%\Mods\%modname%\data\mod.str" "%cd%\BuiltMods\mods\%modname%\data"

echo.
echo *** Copying Shaders... ***
echo.
if not exist "%cd%\BuiltMods\mods\%modname%\Shaders" md "%cd%\BuiltMods\mods\%modname%\Shaders"
copy "%cd%\Shaders\*.fx" "%cd%\BuiltMods\mods\%modname%\Shaders"

echo.
echo *** Creating Mod Big File... ***
echo.
tools\MakeBig.exe -f "%cd%\BuiltMods\mods\%modname%" -x:*.asset -o:"%cd%\BuiltMods\mods\%modname%_%version%.big"
if not errorlevel 0 goto CriticalErrorMakingBig

echo.
echo *** Copying built mod... ***
echo.
if not exist "%mydocs%\Command & Conquer 3 Tiberium Wars\mods" md "%mydocs%\Command & Conquer 3 Tiberium Wars\mods"
if not exist "%mydocs%\Command & Conquer 3 Tiberium Wars\mods\%modname%" md "%mydocs%\Command & Conquer 3 Tiberium Wars\mods\%modname%"
copy "builtmods\mods\%modname%_%version%.big" "%mydocs%\Command & Conquer 3 Tiberium Wars\mods\%modname%"


echo.
echo *** Creating SkuDef file... ***
echo.
echo mod-game %gamever% > "builtmods\mods\%modname%_%version%.SkuDef"
echo add-big %modname%_%version%.big >> "builtmods\mods\%modname%_%version%.SkuDef"
copy "builtmods\mods\%modname%_%version%.SkuDef" "%mydocs%\Command & Conquer 3 Tiberium Wars\mods\%modname%"

echo.
echo *** Build process completed successfully. ***
goto End

:NoModError
echo *** ERROR: No mod name specified. ***
goto end

:CriticalErrorBuildingMod
echo.
echo *** ERROR: Compilation of 'mod.xml' failed, aborting build process. ***
goto End

:CriticalErrorBuildingModL
echo.
echo *** ERROR: Compilation of 'mod_l.xml' failed, aborting build process. ***
goto End

:CriticalErrorMakingBig
echo.
echo *** ERROR: Creation of BIG file failed, aborting build process. ***
goto End

:End

echo.
pause


And as an extra, here is an extra batch script that automatically builds a specific mod. This way you don't have to open a command prompt to enter the mod name, and you don't need to enter it each time you build your mod either (that can get repetitive). Of course, you'll need to adapt this file for your own use, but you can just copy it and have one script for each mod you have. Put the file in Mods\YourModName, like how mine is in Mods\CnCClassic. So NOT in the data folder!

@echo off

set modname=CnCClassic
set version=0.1
set gamever=1.8

cd ..\..
call BuildMod.bat %modname% %version% %gamever%

Edited by CodeCat, 23 August 2008 - 12:00.
Quote

CodeCat's Photo CodeCat 01 Sep 2007

Edited the code some so it also copies ini files to be included in the .big, and fixed a few more things. :P
Quote

CodeCat's Photo CodeCat 01 Sep 2007

Another update, now it will stop the build process if it encounters an error. It's funny that EA mentioned that 'due to how the build process works' this wasn't possible. But I did it quite easily. :P
Quote

Vengence's Photo Vengence 01 Sep 2007

What kind of error? Critical or minor errors?
Quote

CodeCat's Photo CodeCat 01 Sep 2007

Critical errors, so only errors that will cause the compilation process itself to fail. Usually because of syntax errors or something.
Quote

Mighty BOB!'s Photo Mighty BOB! 01 Sep 2007

Cool. This should come in handy.
Quote

Prophet of the Pimps's Photo Prophet of the Pimps 02 Sep 2007

Pinned because this is really useful. Good job guys.
Quote

CodeCat's Photo CodeCat 02 Sep 2007

I'm currently trying to work out a way to make it possible for you to specify the directories of the ART: AUDIO: and DATA: identifiers. It's possible to override them, but I'm not sure how they work...
Quote

CodeCat's Photo CodeCat 10 Sep 2007

Updated again to reflect the changes made in the new SDK. Also added the ability to easily change the default search paths for DATA:, ART: and AUDIO: references.
Quote

Daz's Photo Daz 16 Sep 2007

You need to add this so it includes the Scripts folder.

echo.
echo *** Copying scripts file data... ***
echo.
if exist "%cd%\BuiltMods\mods\%modname%\data\scripts" rd /s /q "%cd%\BuiltMods\mods\%modname%\data\scripts"
if exist "%cd%\Mods\%modname%\data\scripts" xcopy /s /i "%cd%\Mods\%modname%\data\scripts" "%cd%\BuiltMods\mods\%modname%\data\scripts"
Quote

CodeCat's Photo CodeCat 17 Sep 2007

Added!
Quote

KiLLer's Photo KiLLer 18 Oct 2007

CodeCat I Would Just like to thank you for your great batch file

so i could base my Modbuilder on that

modbuilder can be found here

http://forum.cncreneclips.com/index.php?showtopic=18700
Quote

Hostile's Photo Hostile 18 Oct 2007

I've had alot of issues trying to build the mod. At least this program has gotten a created folder and the sku-def but the only file it didn't write was the BIG file. The BIG I am using is proven valid so it's not that. I've used other methods to build the mod. They work. This one doesn't build the BIG for some reson. Nice work so far though.

This is in reference to killers program not codecates batch file.
Edited by Hostile, 18 October 2007 - 17:04.
Quote

KiLLer's Photo KiLLer 19 Oct 2007

i know the issue it fixed now try downloading newest version

right Here
Quote

Daz's Photo Daz 02 Nov 2007

Is there something I can add to the batch file to have it save a text log of all its output?
Google wasn't much help.
Quote

CodeCat's Photo CodeCat 04 Nov 2007

When calling the file, use BuildMod.bat (some parameters) > filename.txt
Quote

Daz's Photo Daz 04 Nov 2007

Cheers.
Unfortunately that seems to be killing the real time text display so I've no idea when my build has finished.
Quote

zante's Photo zante 30 Jan 2008

Is this still available? There doesn't seem to be any kind of download link...
Quote

Slye_Fox's Photo Slye_Fox 30 Jan 2008

there never was one.

just copy the code one the front page and paste it into notepad, then save as the filenames it says in the post.
Quote

zante's Photo zante 30 Jan 2008

View PostSlye_Fox, on 30 Jan 2008, 12:20, said:

there never was one.

just copy the code one the front page and paste it into notepad, then save as the filenames it says in the post.


Right, sorry. It was late when I first saw this.
Quote

PurpleScrin's Photo PurpleScrin 18 Mar 2008

1. CodeCat, where are you? We need a new version of buildmod.bat since it cannot compile and define 'assets' folder and the globaldefines.xml file but it does handle the 'includes' folder. This was better than the modbuilder.exe but some stuff here really needs some more fixing. When patch 1.10 is released, I demand an update for this.

2. The modbuilder.exe is outdated and it cannot override any ini files depending on where you put the folder. It simply won't work. Even with the music files, it almost didn't work. When patch 1.10 is released, I demand an update for this as well.

3. Is there any other mod builder program other than the ones I mentioned?
Quote