Title: Programming Unreal Tournament
1Programming Unreal Tournament
- Joe Manojlovich (josephm_at_sis.pitt.edu)
- University of Pittsburgh
- School of Information Sciences
2Points of Contact
- Usability Study Lab, 2nd floor, Information
Sciences Building - Meetings every Tuesday, Thursday 3pm to 7pm (all
are welcome) - (Unofficial) Pittsburgh Unreal Research Group
- There is a surprisingly large amount of UT
hacking for research purposes going on in the
Pittsburgh area - University of Pittsburgh (several schools)
- Carnegie Mellon University (several schools)
3What is Unreal Tournament?
- UT is a multiplayer video game
- Produced by Epic games (http//www.epicgames.com)
- Runs on Windows, Linux, Macintosh, PlayStation,
and soon Xbox - http//www.unrealtournament.com
4Old/Current Versions of Unreal
- Unreal I
- The original Unreal game
- Single player
- Obsolete and unsold now (?)
- Unreal Tournament
- Multiplayer Unreal game
- Obsolete and unsold as of a month or 2 ago
5New Versions of Unreal
- Unreal 2
- Single player
- Due 2003
- Unreal Tournament 2003
- Multiplayer
- Due summer 2002 (any day now)
- Unreal Forever
- Xbox
- Due 2003
6Why Program UT?
- By using UT as a basis for other research, you
can avoid needless reinventing while benefiting
from a proven development platform - UT is designed for programming, and many tools
and resources are available to assist you
7Research Being Done with UT
- Gamebots
- This is a modification to UT that allows one to
control UT bots remotely over a standard network
connection (www.gamebots.org) - CaveUT
- This project uses multiple UT clients to create
- el-cheapo 3D visualization (http//www2.sis.pitt.
edu/jacobson/ut/CaveUT.html) - Many others
8How to Program Unreal Tournament
- UnrealScript
- Source code level
- Level Programming
- Graphics level
- Scenes
- People
- Weapons
9UT Source Code
- Since UT is based on a virtual machine model like
Java, most of the game is actually written in
UnrealScript - You can read the source code to most of the game,
except the low level graphics rendering
components and a few other bits - UnrealEd will let you browse and edit the game
source code - Also available online http//usl.sis.pitt.edu/tru
rl/unrealdocs
10Common Terms
- Bots Players in game under human or AI control
- Level self-contained environment containing
bots and their surroundings - Maps a level, without the bots
- Game a level, with active bots, running on a UT
server
11Types of Games
- TeamGame
- Team free for all
- Domination
- Control of
- level points
- Capture the Flag
- Goal of returning
- enemy flag to
- home base
12The Unreal Virtual Machine
- UT is divided up into several components
- Server
- Client
- Rendering engine
- Engine support code
13The Unreal Virtual Machine
Actor(s)
Tournament Male
Level
DM-Tutorial
Game Type
Death Match
Client(s)
Game Code
Engine
Network
OpenGL, DirectX, etc.
Underlying Hardware/Operating System
14Unreal Network Architecture
UT is a client/server based game
Client
Server
- Currently supports 32 players on a server
- This may increase with the new version of UT
15Java/C vs. UT
- If you have some knowledge of any object-oriented
language, then learning UnrealScript itself is
easy - UnrealScript is much simpler than real
object-oriented languages which are burdened with
complex features unnecessary for game development
16Object-Oriented Programming
- Objects
- Function code and data combined in one unit
- Classes
- Templates for production of objects
- Inheritance
- Classes arranged in a hierarchy, where children
classes start with properties of its parents
17Inheritance
- Animal
- Reproduces
- Consumes
- Fish
- Has Fins
- Swims
- Gills to Breath
18Class Structure in UT
- Objects/Actors
- Pawns
- Info
19Object/Actor Classes
- Object is the basic superclass for every Unreal
class - Actor class, subclass of Object, defines basic
game functionality - Players
- Weapons
- AI
- Most of the UT game itself
20Pawn Class
- Subclass of Actor
- Defines the living entities of a level
- PlayerPawn, a subclass of Pawn, is used for all
players in the game - ScriptedPawn, another subclass of Pawn, is used
to drive the built-in game players
21Info Class
- Info classes maintain game data
- GameInfo manages game related information
- ZoneInfo handles the composition of spaces in
levels, such as water, lava, etc. - PlayerReplicationInfo is used for network games,
to minimize network traffic between Unreal
clients and the server
22UnrealScript Syntax
- UnrealScript is a full programming language
solely used for the Unreal series of video games - Most of its syntax is very similar to other
high-level programming languages such as Java or
C
23Variables
- byte A single-byte value ranging from 0 to 255.
- int A 32-bit integer value
- bool A boolean value either "true" or "false"
- float A 32-bit floating point number
- string A string of characters
- name The name of an item in Unreal (such as the
name of a function, state, class, etc)
24Variables (cont.)
- Enumeration A variable that can take on one of
several predefined name values - Object and actor references A variable that
refers to another object or actor in the world - Structs Similar to C structures, UnrealScript
structs let you create new variable types that
contain sub-variables
25Variables (cont.)
- To declare a variable
- var int a
- var byte Table64
- var string32 PlayerName
- var actor Other
26Language Constructs
- UT supports all the standard loops, like those in
Java or C - If
- For
- While
- Do-While
27UnrealScript States
- States are unique to game programming languages
like UnrealScript - Allow one to define functionality based time and
state of a bot - For example, a bot could have a Running state
that will cause the bot to flip while jumping,
but only while running, and not while standing
still or walking
28An Example State
auto state Idle Begin log( "I am idle!"
) sleep( 10 ) goto 'Begin'
29An Example State (cont.)
- All this state does is override a built-in
inherited state that is active when a bot isnt
doing anything, i.e., idle - Every 10 seconds of idle time, this code will
print to the log I am idle!
30Modifications
- Mutators
- Used to make slight changes to the game
- Subclass parts of the game, and redefine game
code - Can be mixed with other mutators at run-time
- Gametypes
- Used to change large parts of the game
- Cannot combine with other gametypes
31Using the Command Line Tools
Start-gtPrograms-gtAccessories-gtCommand Prompt
cd C\UnrealTournament\System
32An Example Mutator
- Remember that mutators simply take some built-in
functionality of UT and modify it slightly - Mutators subclass the UT Mutator class
- For this example, well create a low gravity
mutator. The game already has one built in, but
it makes a good example, as its very simple.
33The Low Grav Mutator
- In the UnrealTournament directory, create a
directory named MyPackage and inside that a
directory named Classes - Create a text file named LowGrav.uc in the
Classes directory - Edit the UnrealTournament.ini file, in the System
directory, and add your package name to the
EditPackages list
34The Low Grav Mutator (cont.)
- class LowGrav expands Mutator
- Each source file will have this class
declaration, and only one class can be in each
source file
35The Low Grav Mutator (cont.)
- function bool CheckReplacement(Actor Other, out
byte bSuperRelevant) - if( Other.IsA('ZoneInfo'))
- ZoneInfo(Other).ZoneGravity
vect(0,0,-200) -
- return true
-
- An inherited function, used to replace or modify
actors in a level
36The Low Grav Mutator (cont.)
- In the command prompt, enter the
UnrealTournament/System directory - Type ucc make all
- Create a text file named MyPackage.int in this
directory, with the contents (one line)
Object(NameMyPackage.LowGrav,ClassClass, - MetaClassEngine.Mutator,DescriptionMy Low
Gravity, My Low Gravity") - This will make your mutator show up in the game
menus
37The Low Grav Mutator (cont.)
- To run your mutator, start UT
- Start a new practice session
- Click on the Mutators button
- Scroll down to My Low Gravity and double click
on it - Close the window, and start the practice session
38UnrealEd
- UT comes with a dedicated 3D level modeling and
source code editing program - Most do actual coding outside of UnrealEd, since
many prefer to use other source code development
tools such as Microsoft Developer Studio - Most source code work done by UnrealEd can also
be done from the command line
39Using UnrealEd
- Start program UnrealEd.exe in the
UnrealTournament/System directory - Most people design maps in more mature 3D
modeling program, such as Maya or 3D Studio Max - UnrealEd is fine for doing pure UT design that is
not too complex
40An Example Level
- I was planning to show an example of creating a
level here, using UnrealEd, but its not
something that lends itself well to a
presentation - This is also a cheap way for me to get out of
admitting that I dont know much about level
programming
41Unreal Graphics
- Meshes
- These are the skeletons that form the bodies of
UT creatures - Have no defined surface
- Textures
- Applied to meshes to provide a surfaces
42Resources
- http//unreal.epicgames.com
- http//www.planetunreal.com
- http//www.unrealscript.com
43Questions
- Questions, concerns, comments, sarcasm, insults?
- Please email or come to the group meetings on
Tuesdays and Thursdays there are just so many
little tips and tricks that are best learned in
person