Cogito, ergo sum

Legacy:Mod Authoring/Introduction To GameTypes

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

Where to start, where to start? This is the meat. The big bone. Now we start getting into the hard stuff. Mutators can do some cool stuff. They are pretty easy to understand and they can do a lot of things by interacting with the game. They can be mixed and matched to get even cooler effects... but they are not very powerful. If you want to make a new type of game (say a Jailbreak style mod) you can't do it with mutators. You need to have complete control over the game rules. That's where the GameInfo (UT) series of classes come into play.

GameInfo is a class located in Engine. It is created by the game engine and is the core of the game play rules. Unreal Tournament makes use of a series of GameInfo subclasses located in the Botpack package. TournamentGameInfo contains code that is universal to all of Unreal Tournament's game types. DeathMatchPlus contains the code for running a normal death match. TeamGamePlus contains code for team deathmatch as well as general team management code. Domination and Assault, which are subclasses of TeamGamePlus, implement those particular game types.

The first step in writing your new game type is to determine which class to subclass. If you are writing a team game, you'll want to subclass TeamGamePlus. If you are writing a game without teams, use DeathMatchPlus. If you are writing a game that departs significantly from any previously styled game type, use TournamentGameInfo. Subclassing is very beneficial... you immediately inherit all of the code in your parent classes.

Lets look at a very simple GameType mod:

class MyGame extends DeathMatchPlus;
   GameName="My Game"

The above code, when saved in a file called MyGame.uc will build a new game type. The only difference here is that we've changed the name to "My Game." This new name will be reflected in many places: the Practice Session selection window, the scoreboard header, and so forth. If you play this game, it'll play just like DeathMatchPlus... we haven't actually added any new behavior.

Like Mutators, we need to do a little .int file hacking in order to get the new game type to show up in the menus. Edit your package's .int file and add the following lines to the [Public] section:

 Preferences=(Caption="My Game",Parent="Game Types",Class=MyPackage.MyGame,Immediate=True)

The practice session and start server menus look in all .int files for declared objects that have a MetaClass of Botpack.TournamentGameInfo. If you add these line to your package's .int file, you'll get an entry called "My Game" in the list of games. The name is taken from the GameName variable of your GameInfo class. The Preferences line gives your game a configuration entry in the Advanced Options menu. You probably don't need to worry about that right now.

So now we have a simple game to start messing with. What do we do? Well lets look at a few of the methods available in GameInfo. Remember, you'll need to do a lot of research on your own. You'll only become a strong UnrealScript hacker if you spend time to acquaint yourself with the code at your fingertips.

Prev Page: Legacy:Mod Authoring/The Anatomy Of MutatorSection 9 of 12 – Next Page: Legacy:Mod Authoring/A First Look At GameInfo