Building Games with UDK
Unreal Development Kit (UDK) started as a tool developed by Epic games to create their most famous game ever, Unreal. Unreal is one of the most award winning games in the history of videogames but the latest versions weren't quite as good despite having one of the best engines ever. Epic Games decided to keep working on the engine instead of working on games developed with it.
UDK was a tool used by programmers to develop Unreal, but in 2009 it was released to the public and many other games were created with it. However this version was still focused on first-person shooters (FPS) and most if not all of the games developed were of this type. It all changed with the release of UE4 that featured a UDK better suited to all kinds of games and not just FPS; now any kind of game could be developed with the tool.
General Features
The main feature of UDK is the exclusive use of the Unreal Engine which is considered by many developers to be the most powerful 3D physics engine. It is so powerful that the latest version called UE4, which is not part of UDK, had to be capped when first released it because next generation consoles were not able to move the most hardware expensive features like voxel cone tracing. UDK was developed so that many games could be launched with it at the cost of capping it a little bit.
Even though initially it was developed as a tool mainly focused on PC games, the latest version also included iOS.
Networking has always been a strong point of UDK. Games developed with UDK can be played on local networks and on the internet with little effort. It has built in features for client server architectures as well as non-dedicated server hosts so that a person can host and play the game at the same time. Implementing a server to download server-based content is pretty easy with UDK so it makes it a good SDK for games where distribution of content is an important feature.
The Landscape system in UDK is very powerful as well. Thanks to the new LOD system and the optimization of the memory use, it is now possible to quickly and easily develop huge maps using the tools provided.
The scripting language included in UDK (UnrealScript) really makes a difference among all the SDKs. It is object oriented and very powerful and easy to use. It is intuitive and can be learned easily in little time. This scripting language saves many hours programming AI, inventories, movements, weapons and many other features. Just a few lines of scripting code can do something that would have taken months worth of programming. If it wasn't for the engine itself being so good, the scripting language would be the best tool available in UDK.
There are a lot of post process effects built in the UDK. Even though many developers would prefer to use other tools to do so, the post processing features of UDK are really good and make the use of 3rd party tools unnecessary.
The source code is open so it is possible to tweak it at will. It may not be necessary for most smaller projects but it is a must for many larger games and is something that is lacking with other SDK's.
Pros and Cons
PROS
- Awesome engine behind it. Unreal Engine is second to no other engine.
- Polishing the game can be done on the fly.
- Source code available.
- Free for most projects. Developers pay only if they are making money with it and even then, the pricing is more than reasonable.
- The scripting language is just awesome.
CONS
- With the release of UE4, it is becoming obsolete.
- The documentation available could be better.
- There UDK community is not the biggest.
- Audio functions are restricted.
Example Program
Hello World is the most basic program to be made in any language or SDK and it is the best example on how to make something that actually works. Notice that it is a bit messy to do in UDK since this SDK is aimed to games and not to show messages.
First thing we need in order to make our first program is to create a project folder for it, to do so open the explorer (file explorer) and go to path "%HomeDrive%\GAMEDIRECTORY\Development\Src\" and once you are in there create a new folder and name it HelloWorld.
Open it and create a new folder and name it Classes.
In the TextEditor copy the following line of code:
class HelloWorldGame extends GameInfo;
This is a class but it is still not useful so, we will have to tell that this class will override the InitGame.
event InitGame( string Options, out string Error )
{
super.InitGame( Options, Error );
`log( "Hello, world!" );
}
The second line of code will call the parent's version of the InitGame and the third line is our piece of master code that will output "Hello, world!"
After this we just have to save this as a class with the name HelloWorld for example and make it .uc in extension.
Of course as with any other program, you must compile it in order to make it executable by the UE. Go to your game directory and PREFIXGame\Config\ and open PREFIXEngine.ini, then go to the section [UnrealEd.EditorEngine] and here we will add our awesome mod adding the line:
ModEditPackages=HelloWorld
Save this .ini file and then open the TextEditor again and copy this:
cd..
cd..
cd..
cd Binaries
GAME.exe make
Save this as Make.bat and execute it so that it will make all the compiling for you.
Now it is time to execute your game! Open your console and execute "ShowLog" and "Open MAPNAME?Game=HelloWorld.HelloWorldGame"
This will print "Hello World!" in the Log window.
Let's see also how to define variables in UDK. The following is just a sample and the program won't do anything and is just used to define and input values to them:
Class Warrior extends Actor;
var string nameCharacter;
var int baseAttackValue;
var bool NPC;
var () string msgEditable;
We define the variables and their types, the class is actually useless but we must define one.
const warriorBonus = 2.5;
This is a constant, so it means it will never change its value.
function float calculatePowerAttack()
{
local float calculatePowerAttack()
powerAttack = baseAttackValue * warriorBouns;
return powerAttack;
}
This is an example of a calculation for a game. It will calculate the Power Attack of the warrior by multiplying his base attack value by the bonus given for being a mighty warrior.
defaultproperties
{
nameCharacter = ”Ulukai”
baseAttackValue = 50
NPC = false
}
And here we initialize the variables with the base values.
Setting up a camera for our games is as simple as this:
simulated function bool CalcCamera(float fDeltaTime, out vector out_CamLoc, out rotator out_CamRot, out float out_FOV)
{
local vector CameraStart;
Initialization.
CameraStart = Location;
So that the camera starts at the player's location.
CameraZOffset =GetPawnLocation().Z;
CameraStart.Z += CameraZOffset;
Set up how low or high the camera is.
CameraStart.X += CameraStart;
We bring the camera out of the player so it will be more visible
out_CamRot.Yaw = -90;
We focus it to the player, who will be down the camera.
out_CamRot.Pitch = 90;
We fix the pitch so the camera will not rotate up and down.
return true;
}
And we are done!
Conclusion
UDK is an excellent tool to develop AAA games and it is used by many important companies for the development of their games. It is being replaced step by step by the newer version, UE4, and soon will become obsolete—but it is still a really good tool for DX9 games.
Recent Stories
Top DiscoverSDK Experts
Compare Products
Select up to three two products to compare by clicking on the compare icon () of each product.
{{compareToolModel.Error}}
{{CommentsModel.TotalCount}} Comments
Your Comment