Jump to content


The ultimate build configuration


20 replies to this topic

#1 CodeCat

    It's a trap!

  • Gold Member
  • 6111 posts

Posted 01 September 2007 - 11:45

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.

CodeCat

Posted Image
Posted Image

Go dtiomsaítear do chód gan earráidí, is go gcríochnaítear do chláir go réidh. -Old Irish proverb

#2 CodeCat

    It's a trap!

  • Gold Member
  • 6111 posts

Posted 01 September 2007 - 13:09

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

Posted Image
Posted Image

Go dtiomsaítear do chód gan earráidí, is go gcríochnaítear do chláir go réidh. -Old Irish proverb

#3 CodeCat

    It's a trap!

  • Gold Member
  • 6111 posts

Posted 01 September 2007 - 16:59

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
CodeCat

Posted Image
Posted Image

Go dtiomsaítear do chód gan earráidí, is go gcríochnaítear do chláir go réidh. -Old Irish proverb

#4 Vengence

    Professional

  • Project Team
  • 341 posts
  • Projects: Silent Dawn VI: The Dark Return, Sigma Invasion

Posted 01 September 2007 - 17:22

What kind of error? Critical or minor errors?
Posted Image
Posted Image
Posted Image
Friends look out for one another

#5 CodeCat

    It's a trap!

  • Gold Member
  • 6111 posts

Posted 01 September 2007 - 17:31

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

Posted Image
Posted Image

Go dtiomsaítear do chód gan earráidí, is go gcríochnaítear do chláir go réidh. -Old Irish proverb

#6 Mighty BOB!

    Semi-Pro

  • Member
  • 244 posts

Posted 01 September 2007 - 20:25

Cool. This should come in handy.
WOL nick: migtybob

Wesforce said:

We are living in a post-common sense society.

#7 Prophet of the Pimps

    Masters of Booty Strike Force

  • Gold Member
  • 11369 posts
  • Projects: ShockWave

Posted 02 September 2007 - 05:25

Pinned because this is really useful. Good job guys.
Never underestimate a Resourceful Idiot
Posted Image

#8 CodeCat

    It's a trap!

  • Gold Member
  • 6111 posts

Posted 02 September 2007 - 10:14

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

Posted Image
Posted Image

Go dtiomsaítear do chód gan earráidí, is go gcríochnaítear do chláir go réidh. -Old Irish proverb

#9 CodeCat

    It's a trap!

  • Gold Member
  • 6111 posts

Posted 10 September 2007 - 20:10

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

Posted Image
Posted Image

Go dtiomsaítear do chód gan earráidí, is go gcríochnaítear do chláir go réidh. -Old Irish proverb

#10 Daz

    Visitor

  • Member
  • 21 posts
  • Projects: It Came From Red Alert!

Posted 16 September 2007 - 20:05

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"


#11 CodeCat

    It's a trap!

  • Gold Member
  • 6111 posts

Posted 17 September 2007 - 23:59

Added!
CodeCat

Posted Image
Posted Image

Go dtiomsaítear do chód gan earráidí, is go gcríochnaítear do chláir go réidh. -Old Irish proverb

#12 KiLLer

    Amateur

  • Member
  • 110 posts

Posted 18 October 2007 - 12:42

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
████████
████████
████████

-------------------------------------------

KiLГeя Was Here

Me gots me 3 australian forum cookies from jermies


Posted Image


-------------------------------------------

#13 Hostile

    Visitor

  • Member
  • 28 posts

Posted 18 October 2007 - 17:03

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.


#14 KiLLer

    Amateur

  • Member
  • 110 posts

Posted 19 October 2007 - 06:45

i know the issue it fixed now try downloading newest version

right Here
████████
████████
████████

-------------------------------------------

KiLГeя Was Here

Me gots me 3 australian forum cookies from jermies


Posted Image


-------------------------------------------

#15 Daz

    Visitor

  • Member
  • 21 posts
  • Projects: It Came From Red Alert!

Posted 02 November 2007 - 09:45

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.

#16 CodeCat

    It's a trap!

  • Gold Member
  • 6111 posts

Posted 04 November 2007 - 12:28

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

Posted Image
Posted Image

Go dtiomsaítear do chód gan earráidí, is go gcríochnaítear do chláir go réidh. -Old Irish proverb

#17 Daz

    Visitor

  • Member
  • 21 posts
  • Projects: It Came From Red Alert!

Posted 04 November 2007 - 16:14

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

#18 zante

    Newbie

  • Member
  • 3 posts

Posted 30 January 2008 - 11:59

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

#19 Slye_Fox

    FOXTec Leader

  • Project Leader
  • 2351 posts
  • Projects: CnC: Condition Red, Sigma Invasion, Armoured Sky: Ethereal Dawn

Posted 30 January 2008 - 12:20

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.
Posted Image

#20 zante

    Newbie

  • Member
  • 3 posts

Posted 30 January 2008 - 22:52

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.

#21 PurpleScrin

    Amateur

  • Member
  • 107 posts

Posted 18 March 2008 - 17:57

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?



6 user(s) are reading this topic

0 members, 6 guests, 0 anonymous users