Compiling Tips

In this tutorial I will give some tips for optimal UT coding comfort. If you have any additions to this, just mail me, and I’ll add them!

Assumptions

I assume that you know how to open a DOS-box and navigate through directories. Also you should have UnrealEd up & running before continuing to read this tutorial.

The Tutorial

There are two ways of coding & compiling your UScripts. One is using UnrealEd, the other is with a text-editor (the coding part) and ucc (for compiling). I’ll cover both of them.

Using UnrealEd

This is the easiest way to code if you’re new to the world of UScript. Use the “Browser” window on the right of the screen, and set the top listbox to “Classes”. Now you will see all the child classes of the Actor class. Those are the ones you’ll use most of the time.

You can click the minus to expand the tree and see even more classes. To view the code of a class, double-click on its name. To create a new child of a class, click on its name, and then click the ‘New’ button at the bottom of the screen. This will show a box where you can type the name of the new class, and the package it will be stored in.

To compile your newly created code, hit F7. If there is any error, UnrealEd will tell you, and jump to the appropriate line of code. Remember you have to save your packages (the ‘Save’ button at the bottom of the ‘Browser’ window) before you can use it! You have to compile and save each time you’ve changed a class and want to test it out.

UnrealEd has a nice syntax highlighting. Unfortunately, the right colors will show up after you’ve compiled your code, and not while typing it. Another plus for UnrealEd is the ability to easily browse the classes tree.

UnrealEd also has some negative things. It is really slow, and often interprets a single-click as being a double-click. When working on two classes simultaniously, you often have to scroll the browser window a lot, which will become quite annoying after a while. It is impossible to add textures, meshes and sound to your package from UnrealEd. Of course, you can use separate texture and sound packages, but your class is much easier to distribute and install if everything is in one file.

Using UCC

This is the method I prefer. You can use any text editor you want, which is usually MUCH faster than UnrealEd. I use Emacs for Windows, which also has a nice syntax highlighting.

To prepare your computer for coding and compiling without UnrealEd, you have to export all the .u files to their textual representations. To do this, fire up UnrealEd, and click the “Export All” button in the classes browser. This will create a subdirectory for every package in your UT directory, with all the classes in the ‘Classes’ subdirectory. An example:

The package ExternSniper contains the following classes:

  • ExternSniper
  • ExternSniperClientWindow
  • ExternSniperConfigWindow
  • ExternSniperMenuItem
  • SniperHUD
  • SniperNotify

Exporting this package will create the following files and directories:

UnrealTournament
    +--- ExternSniper
            +---- Classes
                +----- ExternSniper.uc
            +----- ExternSniperClientWindow.uc
            +----- ExternSniperConfigWindow.uc
            +----- ExternSniperMenuItem.uc
            +----- SniperHUD.uc
            +----- SniperNotify.uc

Those files can then be edited by any text editor you want.

To compile your code, you have to follow these steps:

  1. Add your package to the EditPackages list in UnrealTournament.ini. Open UnrealTournament.ini and locate the lines starting with EditPackages=. Add EditPackages=MyPackage to the end of the list.
  2. If it exists, remove the file UT\System\MyPackage.u. UCC will only compile packages which are in the EditPackages list which don’t exist yet.
  3. Open a dos prompt, CD to the System directory of UT, and type: ucc make. This will start the compiler. If there are any error messages, edit your code and go back to step 2. If everything is clean, fire up UT to test your newly created class!

Replace every instance of “MyPackage” above with the name of the package you want to compile.

Those steps might seem like a wase of your time and your brains. But beleve me, once you get used to it, it’s a much nicer way to code.

Sometimes you are forced to use the UCC method. For instance, if you’ve created a new mesh for a weapon, you HAVE to create the package with UCC, otherwise the mesh won’t be included in it!

Unfortunately, this method doesn’t allow you to quickly see which classes are decendants of, for instance, the HUD class. I’m working on a program which will do just that!

That’s it!

I hope I gave you a nice overview of the two methods. As with all my tutorials, if anything is left out or unclear, just mail me!