Game developer - Level Designer - Environment Artist - Author - Tutor - 15 Years of experience with Unreal Engine 1, 2, 3, 4
Log In | Cart        


Introduction


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.

 


Folders


There are four main folders.

  • Binaries – This contains the game exe, the UnrealFrontEnd, and any additional programs. You are not suppose to modify this folder for your game (small exceptions here and there aside).
  • Development – This contains the source code for your Unrealscript files. Very important directory. The game will take the source code (uc files) found in this directory and compile the U files (compiled code libraries) from these.
  • Engine – These are files required by the engine. These files should not be touched unless you got a very good reason!
  • UDKGame – These are all the files for your game. You will do most of the work in this directory.

Within UDKGame you have the following important folders.

  • Config – Holds ini files. These ini files determine a great deal and are of vital importance.
  • Content – These are the actual levels, models, sounds, and so on for the game. Also of vital importance.
  • Localization – This holds files with all the dialog text, menu text, and so on. Basically all text.
  • Movies – These are intro movies, and loading screen movies. These are Bink movies.
  • Script – This is where compiled Unrealscript code ends up in.
  • Splash – This is the location of the splash image.

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.

  • UDKGame\Content\ExampleGame\Levels
  • UDKGame\Content\ExampleGame\UPK

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.

 


UnrealScript


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 folders 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.

    +EditPackages=UTGame
    +EditPackages=UTEditor
    +EditPackages=UTGameContent
    +ModEditPackages=MyGame

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).


If all is right, it will mention MyGame in the output log at the bottom, and in UDKGame\Script\ you should now have "MyGame.u" when the compile is finished.

 


Ini files


Next up, we are going to make sure the game uses our new gametype and pawn as the default ones.

Open up UDKGame\Config\DefaultGame.ini. Remove read-only on it. And go to the section “[Engine.GameInfo]“.

  • Replace “DefaultGame=UDKBase.SimpleGame” with “DefaultGame=MyGame.MyGameInfo”.
  • Replace “PlayerControllerClassName=UDKBase.SimplePC” with “PlayerControllerClassName=MyGame.MyPlayerController”
  • add “+DefaultMapPrefixes= (Prefix=”MG”,bUsesCommonPackage=FALSE,GameType=”MyGame.MyGameInfo”)”

Save. Delete UDKGame.ini so it will create a new one based on your modified DefaultGame.ini.

 


Level


Go to Binaries\Win32 and create a shortcut to UDK.exe. Add the command line “Editor -log” behind it. For example – “G:\UDK\UDKExampleGame\Binaries\Win32\UDK.exe editor -log”. Start it.

Use one of the template levels, or make yourself a super basic level. Right click the BSP Cube button and you will get a pop up to enter the size. Enter 1024 for X, Y, Z, and enable “Hollow?”. Next up click “Add” in the left toolbar.

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!

 


Menu


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.

 


Ini Files – More Fun


Lets go back to the ini files and fix up some more. Close the editor. You cannot change ini files while having the editor run!

Open up DefaultEngine.ini – section [URL]

  • MapExt=udk – You don’t have to change this, but if you would want to change the extension of your levels, it is this easy really.
  • Map=UDKFrontEnd.udkChange this into your level name instead. This will make it load your level by default.
  • LocalMap=UDKFrontEnd.udkLikewise

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.

 


Cooking


Then, cooking. Kind of a funny name for a very important process. Cooking is basically like a final compile. It makes the content consumer ready.
Cooking will also combine all your content packages into just a few files, a process that will also protect your content. It is impossible, or at least difficult, to extract things out of a cooked and combined package.

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”.


Next up, simply click Cook on the top toolbar.

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.

 


Packaging



In the UnrealFrontEnd.exe, click “Package Game”
in the top toolbar. After a few minutes look in the main directory, and you will find your consumer ready packaged game with installer. You are done!

 


Troubleshooting


  • Verify that you did not make any typos.
  • You cannot modify ini files while the game or the editor are running. If you did this, it will have likely ignored your changes.
  • Verify that you have the compiled U file in UDKGame\Script\
  • Understand that Unreal needs unique and simple file names. Spaces in names, non standard characters, and duplicate file names should be avoided at all costs. Unreal cannot see the difference between the level “Doghouse.udk” and the content package “Doghouse.upk”. It does not see file extensions! All names must be unique!
  • Run the game with “-log” or check UDKGame\Logs\Launch.log and read through it. If the game hangs on loading screen, try to find the section where it started loading and look for clues.
  • If during compiling your uc files you get “Superclass errors” you placed the line “+ModEditPackages=MyGame” in the wrong place. The order is important, it must at the bottom of the EditPackages list in the ini file. See the relevant section in the tutorial.

Copyright 2006-2014 Hourences.com - UDK, Unreal, Unreal Engine are trademarks or registered trademarks of Epic Games, Inc. All other trademarks are the property of their respective owners

Website Design by 1clickwebdesigns.co.uk
Powered by Wordpress