This tutorial will explain you
This is a large and extensive tutorial on how to create a very basic little game in UDK. The focus is largely on how to quickly set everything up for your own game and give you a basic introduction to all the elements involved in making a UDK game.
Within UDKGame you have the following important folders.
Within UDKGame\Content you can find a great deal of demonstration UT3 and Citadel content. It is best to keep most of this content in since there are some references to these assets. When you package the game later on, it will automatically strip most (though not all…) demo content out so there is not much need to manually go delete file by file from the content directory and it overly complicates things, especially for this already very long tutorial. My usual approach is to simply create a folder within Content, with my game's content.
Two directories, one for levels, and one for UPK files (content packages). You do not require a billion content folders like the UT3 setup. Most games do not have nearly enough files to warrant so many different folders. As example, our game The Ball, with 1.5 GB of data has just 20 UPK files.
Thanks to James Tan for the UnrealScript example files, and Markus Arvidsson for additional help.
Go to the Development\Src\ folder, and create a new folder. For example "MyGame". The name of the folder will become the name of the U file. So if your game is called "Bobby" you would be best to name this folder "Bobby". All unrealscript files within this folder will be compiled into a single U file for the game to use.
In the folder "
MyGame
" you create a folder "
Classes
", and in that folder add the three files from
this zip: MyGameInfo.uc, MyPawn.uc, MyPlayerController.uc
This is not an Unrealscript tutorial, so we will go through this process pretty fast. The basic idea of Unrealscript is that every actor has a parent actor. A child takes over all functionality and properties of the parent. For example "class MyPawn extends UDKPawn;" – Here our new MyPawn uses the UDKPawn as a base.
At the bottom is always a section "DefaultProperties". These are the properties that will also be visible within the editor, and their default values. Again, the real list of properties is much longer than those in the UC files you just made, but you are only required to add those properties that are different from the parent classes. If you do not specify it in the UC file, it will take over the value of the parent. If the parent does not has it specified, it will take it from the parent from the parent. And so on. It is a tree/pyramid.
Next up, compiling. We first have to make sure the game knows of the existence of what we just added, by adding it to the list of U files to check for. To do so go to UDKGame\Config\ and open up DefaultEngine.ini . Find the section " [UnrealEd.EditorEngine] " and add the following line " +ModEditPackages=MyGame " below the other ones.
The order is very important because it determines in what order it will load and compile. Some classes are dependent on others. Those would not compile correctly if you used the wrong order.
This line will make the U file MyGame a file to always load when starting the editor. Turn off read only protection on the file, save and close . It would also be a good idea to delete UDKEngine.ini . Doing this will force the engine to create a new UDKEngine.ini based on DefaultEngine.ini. Since you just modified the default ini, this will create a modified UDKEngine.ini with your changes in it.
Next up go to Binaries and start UnrealFrontEnd.exe. The Frontend is a very important tool that allows you to do a whole number of things. In this case we will use it to compile our code. In the top toolbar, click on the Script button (that is the second button, right of the Green Start button).
Open up UDKGame\Config\DefaultGame.ini . Remove read-only on it. And go to the section "[Engine.GameInfo]".
Save. Delete UDKGame.ini so it will create a new one based on your modified DefaultGame.ini.
Fly into the cube using WASD/arrow keys + the mouse, or alternatively drag around while holding the left/right/both mouse buttons to move the camera. Right click the floor – Add Actor – Add Playerstart .
Do this again, but now add a Light , and move the light to the middle of the room.
Save the level . I named mine "MG-ExampleGameLevel", using the prefix specified in the DefaultGame.ini file.
Then, rebuild the level. Top menu – Build – Build All .
Go to the top menu again. View – World Properties . Expand "Game Type" in the pop up window and find Game Type For PIE and Default Game Type . Change both of these to MyGame . PIE stands for Play-In-Editor, so this determines what gametype it will use when playing in the editor.
And now right click somewhere in the viewport – Play From Here and observe your wonderful level and game!
Section removed due to new engine upgrades. Check out
one of my other tutorials
for information on how to set up simple Kismet based menus.
Open up DefaultEngine.ini – section [URL]
Optionally, check out the section [FullScreenMovie], this is where start up movies and loading screen movies are specified.
You are done. Remove UDKEngine.ini again to make it reset to your changed DefaultEngine.ini instead.
Start up the game, and verify that it loads your level.
To kick off the process, open up the UnrealFrontEnd.exe again (Binaries Folder), and notice the field "Maps to cook". Clear out this list, and then add your level here, "MG-ExampleGameLevel" .
When it is done, it will have created a folder UDKGame\CookedPC. The content in this folder is what will be distributed to the consumer.