There is no spoon

Difference between revisions of "Legacy:Compiling With UCC"

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search
(Added a batch file example.)
m (Mentioned MonkeyBuild)
(One intermediate revision by one other user not shown)
Line 1: Line 1:
'''UCC''' is the [[Legacy:UnrealScript|UnrealScript]] compiler. This page explains how to compile with the '''ucc make''' command. As an alternative, you may want to consider using [[Legacy:UMake|UMake]], which makes the whole thing much simpler.  If you are a cygwin geek, you might like use [[Legacy:GnuMake|GnuMake]]
+
'''UCC''' is the [[Legacy:UnrealScript|UnrealScript]] compiler. This page explains how to compile with the '''ucc make''' command. As an alternative, you may want to consider using tools like [[Legacy:UMake|UMake]] or [[MonkeyBuild]], which makes the whole thing much simpler.  If you are a cygwin geek, you might like use [[Legacy:GnuMake|GnuMake]].
  
 
==Compiling==
 
==Compiling==
Line 140: Line 140:
 
* [[Legacy:Compiler Errors|Compiler Errors]]
 
* [[Legacy:Compiler Errors|Compiler Errors]]
 
* [[Legacy:UMake|UMake]] – convenient "ucc make" wrapper tool.
 
* [[Legacy:UMake|UMake]] – convenient "ucc make" wrapper tool.
 +
* [[MonkeyBuild]] – another tool for easier script compiling
 
* [[Legacy:Set Up Package Folders|Set Up Package Folders]]
 
* [[Legacy:Set Up Package Folders|Set Up Package Folders]]
 
* [[Legacy:UT2k4 Default.Ini|UT2k4 Default.ini]] – Using Default.ini to Compile with mod Support.
 
* [[Legacy:UT2k4 Default.Ini|UT2k4 Default.ini]] – Using Default.ini to Compile with mod Support.
Line 215: Line 216:
 
pause
 
pause
 
</uscript>
 
</uscript>
 +
 +
[[:Category:Legacy Tutorial]]
 +
 +
[[Legacy:Caetgory Toolchain|Caetgory Toolchain]]
 +
[[Category:Legacy Tutorial|{{PAGENAME}}]]

Revision as of 11:59, 17 October 2008

UCC is the UnrealScript compiler. This page explains how to compile with the ucc make command. As an alternative, you may want to consider using tools like UMake or MonkeyBuild, which makes the whole thing much simpler. If you are a cygwin geek, you might like use GnuMake.

Compiling

So, you've spent some time lovingly crafting your mod using well laid out, commented, and maintainable Unreal Script. You have done the decent thing and placed your .uc class files in /UnrealTournament/YourModPackage/Classes. The big moment approaches - will it compile first time?

Well, there's only one way to find out, and that's to do it. At the very least you need to edit your Game Ini File and add your package name to the list of editable packages. Search the ini file for a list of lines starting with EditPackages. Add your package to the bottom of the list like so:

 EditPackages=YourModPackage

Save the changes. You will now be able to compile your mod using the following command:

 ucc make

By default this command examines all of the EditPackages lines searching for packages which have no corresponding .u (a compiled package file) files and attempts to compile them. If you have previously built YourModPackage and you have updated the code the build command will not recompile your package unless your first delete it. It's well worth creating a small batch file to do this for you, e.g.

 cd C:\UnrealTournament\System
 del YourModPackage.u
 ucc make

One of the things that's really easy to forget is the INT file associated with your new package. This file defines the public classes in the package. Look in any of the INT files for examples of this. Remember to include the [Public] directive at the top of the file though or your mod won't be visible in the UT front end. It's worth keeping a copy of your INT file in the /UnrealTournament/YourModPackage directory so you don't lose it and always have an up to date version.

Tips

To reduce compile time, create the following:

  • An ini file, named for example MyProject.ini. Copy UnrealTournament.ini or UT2003.ini and only include those EditPackages entries that your classes depend on.
  • Make a batch file that reads:
    ucc make ini=MyProject.ini

Note that to see output you'll still have to run it from the command prompt. (UMake does all that automatically for you and stores an .ini file called make.ini in your project directory.)

Batch File

When I still used UCC Make I made a batch file that looked like this:

 COPY MyMod.U *.U_Backup
 DEL MyMod.U
 UCC MAKE
 PAUSE

This backs up your U file, deletes it, recompiles it, and then PAUSE, "press any key to continue". This combined with the INI said above here could make a very nice way to compile.

Mod System Batch File for ut2k4

Last Updated: 15 January 2006

Easy to adjust to any mod just input the unreal tournament 2004 directory, the mod name and the package and your off.

If you want to add extra packages just copy the lines containing %package1% or package1 and replace them with %package2% or package2.

:init
@echo Off
set utk4dir="Your Unreal 2k4 Dir"
set utk4sysdir=%utk4dir%system\
 
set modname="Your Mod Name"
set moddir=%utk4dir%%modname%
set modbakdir=%moddir%SysBak\
set modlogdir=%moddir%System\logs\
 
set package1="Your Package Here"
goto bak
 
:bak
md %modbakdir%
md %modlogdir%
copy %moddir%*.ucl %modbakdir%*.ucl
copy %moddir%*.int %modbakdir%*.int
copy %moddir%*.u %modbakdir%*.u
echo //-----------------------Old Files Backed Up!------------------------
goto del
 
:del
del /q %utk4sysdir%%Package1%.* > nul
del /q %moddir%%Package1%.* > nul
echo //-----------------------Echo Old Files Deleted!----------------------
goto make
 
:make
%utk4dir%UCC.exe make -mod=%modname%
copy %utk4dir%ucc.log %modlogdir%%modname%_ucc.log
echo //---------------------------*.u Complete!----------------------------
goto make&int
 
:make&int 
%utk4Dir%UCC.exe dumpint -mod=%modname% %moddir%%package1%.u
copy %utk4sysdir%ucc.log %modlogdir%%modname%_int.log
copy %utk4sysdir%%package1%.int %moddir%%package1%.int
del %utk4sysdir%%package1%.int
del %utk4sysdir%ucc.log
echo //--------------------------*.int Complete!---------------------------
goto make&ucl
 
:make&ucl
%utk4Dir%UCC.exe exportcache -v -mod=%modname% %moddir%%Package1%.u 
copy %utk4sysdir%ucc.log %modlogdir%%modname%_ucl.log
del %utk4sysdir%ucc.log
echo //--------------------------*.ucl Complete!---------------------------
goto end
 
:end
echo //--------------------------Make Complete!---------------------------

Another ucc batch file

Displays time and result of last compilation, updates window title, restarts with single key press.

@echo off
:start
title COMPILING :: MyProject
CLS
 
Copy UCC_MyProject.log UCC_MyProject_OLD.log
 
del MyProject.u
 
ucc make -INI=MyProject.ini -LOG=UCC_MyProject.log
if errorlevel 1 goto end
 
title OK :: MyProject
findstr /c:"Log file closed" UCC_MyProject.log
 
echo.
pause
goto start
 
:end
title ERROR :: MyProject 
findstr /c:"Log file closed" UCC_MyProject.log
 
echo.
pause
goto start

Related Topics

Discussion

Xaklse: Very useful, thanks! But I had many problems with your first batch example. In case anyone has problems with it, here goes my batch file. Mine includes a custom key binding and exports cache to a single file.

:init
@echo Off
set utk4dir=C:\UT2004\
set utk4sysdir=%utk4dir%System\
 
set modname=AshuraDarkReign
set moddir=%utk4dir%%modname%\
set modsysdir=%moddir%System\
set modbakdir=%moddir%SYSBAK\
 
set package1=AshuraDarkReign
set package2=ADRGame
set package3=ADRMonsters
goto bak
 
:bak
md %modbakdir%
copy %modsysdir%*.ucl %modbakdir%*.ucl
copy %modsysdir%*.int %modbakdir%*.int
copy %modsysdir%*.u %modbakdir%*.u
echo //------------------------Old Files Backed Up!------------------------
goto del
 
:del
del /q %modsysdir%%package1%.* > nul
del /q %modsysdir%%package2%.* > nul
del /q %modsysdir%%package3%.* > nul
echo //-------------------------Old Files Deleted!-------------------------
goto make
 
:make
%utk4sysdir%UCC.exe make -mod=%modname%
copy %utk4sysdir%ucc.log %modbakdir%%modname%_ucc.log
echo //---------------------------*.u Complete!----------------------------
goto make&int
 
:make&int
%utk4sysdir%UCC.exe dumpint -mod=%modname% %modsysdir%%package1%.u
%utk4sysdir%UCC.exe dumpint -mod=%modname% %modsysdir%%package2%.u
%utk4sysdir%UCC.exe dumpint -mod=%modname% %modsysdir%%package3%.u
copy %utk4sysdir%ucc.log %modbakdir%%modname%_int.log
copy %utk4sysdir%%package1%.int %modsysdir%%package1%.int
copy %utk4sysdir%%package2%.int %modsysdir%%package2%.int
copy %utk4sysdir%%package3%.int %modsysdir%%package3%.int
del %utk4sysdir%%package1%.int
del %utk4sysdir%%package2%.int
del %utk4sysdir%%package3%.int
del %utk4sysdir%ucc.log
echo [Public]>>%modsysdir%%package1%.int
echo Object=(Class=Class,MetaClass=XInterface.GUIUserKeyBinding,Name=AshuraDarkReign.ADRKeyBindings)>>%modsysdir%%package1%.int
echo //--------------------------*.int Complete!---------------------------
goto make&ucl
 
:make&ucl
%utk4sysdir%UCC.exe exportcache -a -mod=%modname% %package1%.u %package1%.ucl
%utk4sysdir%UCC.exe exportcache -a -mod=%modname% %package2%.u %package1%.ucl
%utk4sysdir%UCC.exe exportcache -a -mod=%modname% %package3%.u %package1%.ucl
echo //--------------------------*.ucl Complete!---------------------------
goto end
 
:end
copy %utk4sysdir%ucc.log %modbakdir%%modname%_ucl.log
del %utk4sysdir%ucc.log
echo //-----------------------COMPILATION COMPLETED!-----------------------
pause

Category:Legacy Tutorial

Caetgory Toolchain