Presentation is loading. Please wait.

Presentation is loading. Please wait.

Programming Unreal Tournament Joe Manojlovich University of Pittsburgh School of Information Sciences.

Similar presentations


Presentation on theme: "Programming Unreal Tournament Joe Manojlovich University of Pittsburgh School of Information Sciences."— Presentation transcript:

1 Programming Unreal Tournament Joe Manojlovich (josephm@sis.pitt.edu) University of Pittsburgh School of Information Sciences

2 Points of Contact Usability Study Lab, 2 nd 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)

3 What 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

4 Old/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

5 New Versions of Unreal Unreal 2 –Single player –Due 2003 Unreal Tournament 2003 –Multiplayer –Due summer 2002 (any day now…) Unreal Forever –Xbox –Due 2003

6 Why 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

7 Research 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…

8 How to Program Unreal Tournament UnrealScript –Source code level Level Programming –Graphics level Scenes People Weapons

9 UT 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/trurl/unrealdocs

10 Common 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

11 Types of Games DeathMatch Free for all TeamGame Team free for all Domination Control of level points Assault Task-oriented Capture the Flag Goal of returning enemy flag to home base

12 The Unreal Virtual Machine UT is divided up into several components: –Server –Client –Rendering engine –Engine support code

13 The Unreal Virtual Machine Game Type Game Code OpenGL, DirectX, etc. Level Actor(s) EngineNetwork Client(s) Death Match DM-Tutorial Tournament Male Underlying Hardware/Operating System

14 Unreal Network Architecture Client UT is a client/server based game Server Client Currently supports 32 players on a server This may increase with the new version of UT

15 Java/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

16 Object-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

17 Inheritance Animal Reproduces Consumes Bird Has Wings Flies Fish Has Fins Swims Gills to Breath Robin Small Red Chest Ostrich Large Doesn’t Fly Great White Large Goldfish Small

18 Class Structure in UT Objects/Actors Pawns Info

19 Object/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

20 Pawn 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

21 Info 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

22 UnrealScript 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++

23 Variables 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)

24 Variables (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

25 Variables (cont.) To declare a variable: var int a; var byte Table[64]; var string[32] PlayerName; var actor Other;

26 Language Constructs UT supports all the standard loops, like those in Java or C++ –If –For –While –Do-While

27 UnrealScript 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

28 An Example State auto state Idle { Begin: log( "I am idle!" ); sleep( 10 ); goto 'Begin'; }

29 An Example State (cont.) All this state does is override a built-in inherited state that is active when a bot isn’t doing anything, i.e., idle Every 10 seconds of idle time, this code will print to the log “I am idle!”

30 Modifications 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

31 Using the Command Line Tools Start->Programs->Accessories->Command Prompt cd C:\UnrealTournament\System

32 An 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, we’ll create a low gravity mutator. The game already has one built in, but it makes a good example, as it’s very simple.

33 The 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

34 The 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

35 The 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

36 The 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=(Name=MyPackage.LowGrav,Class=Class, MetaClass=Engine.Mutator,Description=“My Low Gravity, My Low Gravity") This will make your mutator show up in the game menus

37 The 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

38 UnrealEd 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

39 Using 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

40 An Example Level I was planning to show an example of creating a level here, using UnrealEd, but it’s not something that lends itself well to a presentation This is also a cheap way for me to get out of admitting that I don’t know much about level programming

41 Unreal 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

42 Resources http://unreal.epicgames.com http://www.planetunreal.com http://www.unrealscript.com

43 Questions 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


Download ppt "Programming Unreal Tournament Joe Manojlovich University of Pittsburgh School of Information Sciences."

Similar presentations


Ads by Google