Sniper's Paradise!


Working with *.uc's

Tired of UnrealED, or never liked it in the first place? For whatever reason you should consider editing straight *.uc files, its easy, you can use your own editor (TextPad, NotePad, MS Visual Studio, etc.), and it avoids some of the issues that arise when working with UnrealED.

What is a *.uc?

All a *.uc file is simply a text file that contains all the code for your Unrealscript class, and is used by the engine to compile a package. When you want to make you new class all you have to do is create a new text file in your Classes directory, change the extension to .uc from .txt, and start coding.

Editing *.uc's

You can use any text editor to edit .uc files, and the syntax for the code is the same as it would be in UnrealED. The easiest way to make a new class is to make a text file and just change the name of the file to MyNewClass.uc, then open it up and start coding. Note: It is necessary that the class name defined inside a .uc match the filename; MyClass.uc would have to be defined as class MyClass.

Exporting Unreal Tournament's *.uc's

Most likely your classes will be subclasses of existing Unreal Tournament classes, and so at some point you are probably going to be able to look at the code in those classes. There are two easy ways to export classes, the first being is to load up UnrealED 2.0, switch to View->Actor Class Browser, and then hit File->Export All Scripts. That should create a bunch of directories in your UnrealTournament directory, including Core, Engine, Editor, UWindow, and so on.

Another way to export classes is using the UCC utility. Using the batchexport commandline you can export individual packages one at a time, using the following commandline:

ucc batchexport botpack.u class uc c:\temp\botpack

UCC will then load up the botpack.u package and export all the *.uc's to the c:\temp\botpack directory. You can export most of the major packages, but some Unrealscript classes have the noexport tag and will cause UCC to exit. Just don't try to export those classes and you will do alright. Note that you can also use batchexport to export sounds and textures, check out the Unreal Tech page for more information.

Compiling with UCC

In order to compile your package with UCC you need to set a few things up so that UCC knows what to compile and can find everything it needs.

Project Directories

First off, you need to make sure you have all yours file in the proper place. Let's say you were working on a project named ProBob, most likely you'll want your package to be named ProBob.u, so your directory structure would look something like this:

x:\UnrealTournament
    -> \ProBob
        -> \Classes
        -> \Textures
        -> \Models
        -> \Sounds

You'll want to put all your classes (*.uc) in the Classes directory, any images (*.bmp/*.pcx) in the Textures directory, any models (*.3ds/*_a.3d/*_d.3d) in the Models directory and so on. Only the Classes directory must retain that name, the rest of them you can change around to whatever you want, but as a general rule of thumb keep them as they are.

Editing the EditPackages List

Next you'll need to add your package name to an .ini somewhere so that UCC knows that it is supposed to try and compile it. The easiest way to do this is to open up UnrealTournament.ini and look for a series of lines that should look like this:

EditPackages=Core
EditPackages=Engine
EditPackages=Editor

EditPackages=UWindow

Just go to the bottom of that list and add an EditPackages=ProBob, obviously changing the name to whatever your package is. It is important that you use the same name as you used in your directory structure, otherwise UCC won't be able to find you code and whatnot.

Executing UCC

Now that everything is in order, and assuming that you have already written some classes and placed them in the Classes directory, you should be ready to compile. You'll need to do this from a commandline or make a batch file to run the following:

x:\UnrealTournament\System\> ucc make

UCC should start compiling, processing the EditPackages list incrementally and compiling if it can't find an already compiled version of the package. Note: You must delete any compiled versions of the package (ProBob.u in this example) from the UT\System directory to recompile the package. If UCC finds an existing package it won't bother compiling a new one, so make sure you delete it.

If any errors pop up UCC will abort and give a description of the error, otherwise it will save all newly compiled packages and exit. Check your System directory, if you find ProBob.u (or whatever your package is) then everything worked, otherwise check UCC.log and look for any errors, etc.

Using Custom .ini's

When you are working on multiple projects, it is sometimes useful to use custom .ini files to setup the EditPackages list for each package. A good reason to use seperate lists is that not all packages are going have the same dependencies, and you can save yourself some compile time by removing those packages from the list. For example, if I were working on a UWindow package I would most likely only need something like this for my EditPackages list:

EditPackages=Core
EditPackages=Engine
EditPackages=UWindow

EditPackages=ProBobUI

Now if I were working on a project that subclassed the UT weapons, but didn't have anything to do with UWindow I might have a list that looked like this:

EditPackages=Core
EditPackages=Engine
EditPackages=Botpack

EditPackages=ProBobWeaps

By eliminating all unnecessary packages you can get the most efficient compile times. Now to store these lists in your own .ini's is very easy, simply make a new text file, name it whatever you like (ProBob.ini) and then edit it to look something like this:

[Engine.Engine]
EditorEngine=Editor.EditorEngine
[Core.System]
Paths=../System/*.u
Paths=../Textures/*.utx
Paths=../Sounds/*.uax
Paths=../Maps/*.unr
Paths=../Musics/*.umx
[Editor.EditorEngine]
EditPackages=Core
EditPackages=Engine

EditPackages=ProBob

Just edit the EditPackages list to whatever is appropriate for compiling this package and then save the file. Now to get UCC to use your new .ini file all you have to do is:

x:\UnrealTournament\System\> ucc make INI=ProBob.ini

Make sure you change ProBob.ini to whatever you named your new .ini file obviously, and you should be good to go.

Conclusion

And that's pretty much all there is to it, just make sure you have your directories all in order, and that you edited an .ini somewhere to point to your package. As far as suggested editors, I'd check out TextPad, Multi-Edit, and even the good ol' DOS edit program.



Spam Killer

Back To Top
2005 Sniper's Paradise
All logos and trademarks are properties of their respective owners.
Unreal™ is a registered trademark of Epic Games Inc.
Privacy Policy
Website by Softly
Powered by RUSH