I love the smell of UnrealEd crashing in the morning. – tarquin

Legacy:Hunted Lesson 1

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search

Hunted2003 tutorial, Lesson 1: The Custom GameType.

Folders and files[edit]

First of all, let's Set Up Package Folders with the base name "hunted". Inside the classes folder, create 4 text files:

  • HuntedGame.uc
  • HuntPawn.uc
  • HuntController.uc
  • HUDhunted.uc

Let me explain these further:

this is the gametype such as Capture the Flag, DeathMatch, etc.
this is a pawn. A pawn is what you control, such as a Player a Vehicle, etc.
a controller is what you use to control movement etc. I like to think of it as your soul, in the way that it "posseses" different pawns. When you enter a vehicle, the controller stops controlling the player pawn, and posseses the vehicle pawn. When you get out of the vehicle, it posseses the player pawn. A GUI controller takes over when you are accessing a menu. This is probably not a thourough definition, but it works for me. ( link to an overview page for these?)
this is the Heads Up Display HUD, right now we are going to just add a symbol or something to the TeamDeathMatch Hud so we can tell that our custom gametype works.

Now lets edit the HuntedGame.uc file (my code is riddled with comments, so you can understand what I am doing.) :

/// Hunted Game
/// I chose to extend xTeamGame (Team Deathmatch)
/// because in essence The Hunted is a Team Deathmatch that ends
///  if the Hunted Dies, I may have to change and extend from another 
///// gametype later , but for now ill try this
class HuntedGame extends xTeamGame;
     //gametype name, will appear in in-game list
     GameName="The Hunted"
     //we will use the regular pawn till we make some changes in our pawn  
     // and will use the regular controller till we make some changes in ours 
     // I will leave this DM for now
     //here is our new HUD

hmm... not sure why everything in quotations shows up as comments, I need to learn how to fix that.

Daid303: It doesn't, the default sysntax highlight color for stuff in quotes is green, just as comments. If you open up a script in UnrealEd it also does that (I even set up Editplus to use the same colors as unrealed, I like those colors :) )

If you want to know where I got these default properties, look in the default properties of the source code for DeathMatch. We essentially extended off of it as follows: DeathMatch >> TeamGame >> xTeamGame >> HuntedGame

Step 2[edit]

Now we are going to make changes in our HuntPawn and HuntController in another lesson. Right now, if we load up our custom game we wouldnt see any changes, so I am going to add something to the HUD to verify that our game works. So lets edit HUDhunted.uc:

/// HUDhunted
//// just going to add a symbol 
/// to make it unique to our gametype
class HUDhunted extends HudBTeamDeathMatch;
//a variable to hold our logo
var texture logotex;
function DrawHud(Canvas c)
	local color tempColor;
	local byte tempstyle;
	tempColor = c.DrawColor;
	tempstyle = c.Style;
    c.DrawColor = tempColor;//restore values
   	c.Style = tempstyle;
//a function to draw it
function DrawLogo(Canvas c)
	c.SetPos(193,44);   //193 pix to the right, and 44 downwards from the upperleft corner.
	c.DrawIcon(logotex,0.5);  //scale is 1
// reference to the texture we want to draw on the hud

now some explaining:

  • first I made a logo in photoshop. I saved it as a 24bit targa file entitled "huntlogo.tga".
    1. I opened up UnrealEd, went to the texture browser and hit import
    2. I selected my targa and saved it in a package called HuntedTex
    3. I unchecked mipmaps and checked Alpha
    4. I saved the package as HuntedTex.utx in the folder /UT2003/Textures

for more on importing textures, please check out


here is the logo if you need it. It is in gif format here, you may be able to import it without converting it to targa I dunno.

huntlogo in .gif format

In the code we simply set a variable to hold the texture, then the function DrawLogodraws it on the specified position and at the set scale. In the default properties we point it to our logo. I learned this thru the powerpoint tutorials of J. Giles at SEGA500 Unreal scripting. If you want to learn how to make further changes to the HUD here is a link:


BTW, The super.DrawHud(c) command calls on the function DrawHud as it was written in the HudBTeamDeathMatch class, so we are just adding to it. If you leave out this line it will only draw the logo we added. I suggest you try this just to get an idea of how the super command works.

GameType int file "Hunted.int"[edit]

So now we want to see it in action. But first, we have to make an int file to reference our gametype. Without this, it will not show up in the list of gametypes and we wont get to play it.

  • make a text file called Hunted.int

it should read like so:

Object=(Class=Class,MetaClass=Engine.GameInfo,Name=Hunted.HuntedGame,Description="DM|The Hunted|xinterface.Tab_IADeathMatch|xinterface.MapListDeathMatch|false")
GameName="The Hunted"

This should be pretty self explanitory. Now save it and put it in the /UT2003/system directory

Now our gametype should show up in the gametype list.

But first we have to do a couple of things

We need to add some headers to our HuntPawn and HuntController classes, even though we wont get to them in this lesson. They won't compile the way they are.

class HuntPawn extends xPawn;
class HuntController extends xPlayer;


You now need to compile the mod. There are two ways to compile:

Make sure you added your mod name in UT2004.ini under edit packages or the compiler will not look for you mod to compile.

After compiling[edit]

If all goes well, the file "hunted.u" will appear in your system folder. If it doesn't open up UCC.LOG and search for errors, there are always a few like "package hunted.u couldn't be found" but that's good, because if UCC MAKE doesn't find it, it will try to compile it.


Now run the game and go to Instant Action. The Hunted should be in your list of gametypes. Start a map and there is our logo. Its not much, but it verifies that our gametype works, and now we can bend it to our will, make it do our bidding.

Things to do[edit]

    1. get the logo centered and alpha working


Archnemesis: I had made an error in the HuntedGame.uc file. A default property was listed as


when it should have been


Archnemesis: If you have already done this tutorial, I have made some changes to the Hud

    1. The background of the logo needs to be black, not white, I will repost the image.
    2. The render style should be Additive, not Alpha, this way the black part will be transparent.
    3. I have moved changed the x coordinate to 193 so the logo will be better centered

These changes are noted in the HUD code.

I am going to plan my next lesson more carefully before I post it, I wrote this one while I was doing the actual coding, so it had these errors. I will post the next couple of lessons in a week or so. Paitience!

Daid303: I've added some text by the compiling, maybe there is a wiki page about compiling you could link to? I also changed the comment in the logo HUD because it isn't centerd. If you want to center you'll have to so something like this: (Canvas.ClipX - Tex.Width)/2, (Canvas.ClipY-Tex.Height)/2

Archnemesis: Thanks, I was thinking that on a different resolution, it probably wouldn't be centered, but I forgot to look into it. I am going to work on the back linking before I post any other lessons. I have been reading some of the wiki stuff and am going to revise this page to make it more wiki-friendly when I get a chance. But first I'm off to Unreal University this weekend.