Book Image

Unreal Development Kit Game Programming with UnrealScript: Beginner's Guide

By : Rachel Cordone
Book Image

Unreal Development Kit Game Programming with UnrealScript: Beginner's Guide

By: Rachel Cordone

Overview of this book

Unreal Development Kit is the free edition of Unreal Engine—the largest game engine in existence with hundreds of shipped commercial titles. The Unreal Engine is a very powerful tool for game development but with something so complex it's hard to know where to start.This book will teach you how to use the UnrealScript language to create your own games with the Unreal Development Kit by using an example game that you can create and play for yourself. It breaks down the UnrealScript language into easy to follow chapters that will quickly bring you up to speed with UnrealScript game programming.Unreal Development Kit Game Programming with UnrealScript takes you through the UnrealScript language for the Unreal Development Kit. It starts by walking through a project setup and setting up programs to write and browse code. It then takes you through using variables, functions, and custom classes to alter the game's behavior and create our own functionality. The use and creation of Kismet is also covered. Later, using replication to create and test multiplayer games is discussed. The book closes with code optimization and error handling as well as a few of the less common but useful features of UnrealScript.
Table of Contents (18 chapters)
Unreal Development Kit Game Programming with UnrealScript
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Preface

Welcome to Unreal Development Kit Game Programming with UnrealScript! This book teaches you how to program using the UnrealScript language so you can create your own game projects using the UDK. Instead of using dry, hypothetical code you will use the topics learned in each chapter to build an actual working game. By the end of the book, you will be comfortable enough with the language to start working on projects of your own.

What this book covers

Chapter 1, Project Setup and Test Environments, guides you through the installation and setup of the Unreal Development Kit as well as ConTEXT and UnCodeX, two programs that we will use to write our code. We also examine the directory structure of the UDK and take a look at the configuration files.

Chapter 2, Storing and Manipulating Data, covers the different types of variables we can use in the UDK as well as the flow control statements we can use to react to our changing environment.

Chapter 3, Understanding the Class Tree, examines the class tree so we can understand the relationship between objects in the world. We learn about inheritance and function overriding to customize our object's behavior.

Chapter 4, Making Custom Classes, focuses on the creation of classes of our own. The core classes for any UDK project are discussed, and we create our own versions of them for our game. We change how the camera works, what the rules of the game are, and how the player is controlled.

Chapter 5, Using Functions, covers the use of functions to expand our game. Here we learn how to pass information from one object to another, and how to manipulate that data and return it to the original object. Custom functions are created for our objects to create functionality that didn't exist in the original UDK classes.

Chapter 6, Using States to Control Behavior, covers states and how they can be used to organize and control complicated behavior such as enemy classes for our game. Creating states, changing states, and working with functions within states are discussed.

Chapter 7, Working with Kismet, discusses the use of Kismet in UDK games as well as the creation of custom actions and events. These are used to demonstrate the power of Kismet to tailor the gameplay to each individual level's needs.

Chapter 8, Creating Multiplayer Games, covers running a server and a client on a single machine for multiplayer testing. We also cover the fundamentals of networking code and how to design your game with multiplayer in mind.

Chapter 9, Debugging and Optimization, discusses common errors encountered when compiling and running UnrealScript as well as solutions to these problems. Different ways of optimizing code to make your game run faster are also discussed.

Chapter 10, Odds and Ends, covers the use of Components to customize the visual look of objects in our game. The use of DLLBind to communicate with programs outside of the UDK is also discussed.

What you need for this book

A computer capable of running the UDK is required for this book, see http://udn.epicgames.com/Three/DevelopmentKitFAQ.html for the minimum requirements. ConTEXT and UnCodeX are included in the files with the book. See http://www.packtpub.com/ for downloading code files.

Who this book is for

This book is for people who are new to the Unreal Development Kit and who wish to create their own game projects using UnrealScript. The information here is also useful to programmers having experience in another language and who wish to expand their knowledge by learning UnrealScript.

Conventions

In this book, you will find several headings appearing frequently.

To give clear instructions of how to complete a procedure or task, we use:

Time for action – heading

  1. Action 1

  2. Action 2

  3. Action 3

Instructions often need some extra explanation so that they make sense, so they are followed with:

What just happened?

This heading explains the working of tasks or instructions that you have just completed.

You will also find some other learning aids in the book, including:

Pop quiz – heading

These are short multiple choice questions intended to help you test your own understanding.

Have a go hero – heading

These set practical challenges and give you ideas for experimenting with what you have learned.

You will also find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text are shown as follows: "We can play the example game that comes with it to get an idea of what the UDK can do by going into C:\UDK\UDK-AwesomeGame\Binaries\Win32 (or Win64 if we have a 64-bit operating system) and running UDK.exe"

A block of code is set as follows:

Class AwesomeActor extends Actor
   placeable;
defaultproperties
{
   Begin Object Class=SpriteComponent Name=Sprite
      Sprite=Texture2D'EditorResources.S_NavP'
   End Object
   Components.Add(Sprite)
}

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

Begin Object Class=SpriteComponent Name=Sprite
   Sprite=Texture2D'EditorResources.S_NavP'
HiddenGame=True
End Object
Components.Add(Sprite)

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "Let's click on Return to Desktop for now."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to , and mention the book title via the subject of your message.

If there is a book that you need and would like to see us publish, please send us a note in the SUGGEST A TITLE form on www.packtpub.com or e-mail .

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/support, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.