Prev: Your Code Quickstart - Top of tutorial - Next: UnrealScript Basics

Getting your code into UDK: Details

The good news is, editing UnrealScript code can be pretty easy once you get the hang of it.

The biggest thing standing between you, and seeing the results of you code, is knowing how to tell the UDK engine where it is!

As mentioned in the previous section, if you chose to do the "Custom" install, things are already set up for you, and you can probably skip this page unless you really want to learn details.

The GUI way

To see your own Game Type code running in the UDK Editor with just the GUI, Once your game type class is compiled properly, do the following:

In the UnrealEditor, with your target map open, do

View -> WorldInfo
	(Open the "Game Type" section)

	Default Game Type:                   [selector, choose YourGameType]
	Games Types Supported on this map:   [press the +, to add, then choose YourGameType]
	Games Type For PIE:                  [selector, choose YourGameType]
Do note that YourGameType will not show up in this menu, until it has been compiled. More on that below.

Note also, that this will not change what game type runs a map 'normally' (running UDK directly, rather than through the Editor). Give details on symlink hack!

Missing a GameInfo class?

If you chose an install that didn't give you the GameInfo based class (usually named CustomGameInfo.uc), or you have removed it, the contents are simple enough to write yourself. Here is an example for a more personalized version, which you would put in a file such as [UDK-TOP]\Development\src\Classes\CustomGame\YourGameInfo.uc
class YourGameInfo extends GameInfo;

defaultproperties
{
	// Change or remove any of these as desired
	HUDType=class'CustomGame.HUD'
	PlayerControllerClass=class'CustomGame.YourPlayerController'
	DefaultPawnClass=class'CustomGame.YourPawn'
}	

Important tip #1 UDK often organizes things in terms of "GROUP.somename". In the above example, we use "CustomGame.". It is critical that this grouping match the name of the directory you save it to.

Important tip #2 if you don't have the above framework code provided for you, you may have to edit the main .ini file anyway, to tell UDK where to compile program code files. See below for details on the .ini file that needs editing.

The .ini file way

UDK comes with many many .ini files. Happily, you normally only need to know about one or two of them. Do pay close attention to exact names, however, because there are many similarly named files.

The #1 most important file is:

[UDK-TOP]\UDKGame\Config\DefaultEngine.ini

If you took my advice, and did two installs of UDK, then you will be able to compare DefaultEngine.ini from each install type.
While there are lots of things that are the same, there is a very large amount that is quite different between the two files. The UT Sample configs, do all kinds of things, such as having UT-themeed loading screens.

At this point, we don't care so much about that. I'll focus on just two things; How to get your code compiled, and how to set default game type.

Getting your code compiled

After you edit some UnrealScript programming code, it still needs to be 'compiled'. For this to happen, UDK needs to know what directory it lives in. For this to happen, you need to update the UnrealEd.EditorEngine section, to either add, or replace, the existing entries. Shown below is the relevant section of DefaultEngine.ini for the UT style, with the required addition in italics

[UnrealEd.EditorEngine]
+EditPackages=UTGame
+EditPackages=UTGameContent
+EditPackages=CustomGame
This allows someone to experiment with both the UT classes, and their own, in a single combined map.

Please note, however, that you are not allowed to redistribute the UT material yourself.

This one change, will allow your code to automatically be recompiled as needed when you start up the UDK Editor. It will also allow you to select your GameInfo for a map, as mentioned in the previous section. This will only affect maps run in the Editor, however.

Changing default map and game type

As mentioned, changing the game type in WorldInfo,only affects the UDK Editor. To change the default map and gametype for regular UDK, you need to edit change [UDK-TOP]\UDKGame\Config\DefaultEngine.ini again. This time, add/change the following entries in the section indicated below:
[URL]
Map=YourMapName
LocalMap=YourMapName
;; you can possibly leave TransitionMap alone
Alternatively, if you want to support multiple game types, read the next bit carefully

Symlink hacking for fun and profit

You may want to have multiple game types, with nice convenient little icons. Some people may want to write batch files (.bat). However, there is a much, much easier way, that UDK itself uses. That is to leverage the MS-Windows Symlink.

It turns out that the target of a symlink can be more than just an executable name. It can be an executable name With Arguments.

It turns out that there are lots of potential arguments for the UDK executable. However, we'll just concern ourselves with the arguments required to override map and game type for UDK.

Edit the "Target" property of the symlink, and make it look something like the following:

[URL]
C:\UDK\UDK-2013-02\Binaries\Win64\UDK.exe MisaMap?game=Misa500src.M5Game

Warning about UDKLift

Warning: Make sure to use UDK.exe in your symlink, NOT UDKLift. I once was having failures getting a symlink to use a newer map. It seemed like it was caching values from prior installs. Once I changed it to use UDK.exe, it worked better for me.

Prev: Your Code Quickstart - Top of tutorial - Next: UnrealScript Basics
Written by:Philip Brown
Bolthole Top Search Bolthole.com