Game Development Reference
In-Depth Information
UnrealScript
UnrealScript is a strictly object-oriented language designed by Epic for the Un-
real Engine. Unlike many scripting languages, UnrealScript is compiled. Because
it's compiled, it has better performance than an interpreted language, but it does
mean that reloading a script at runtime is not supported. Games powered by Un-
real typically use UnrealScript for almost all of their gameplay. For games using
the full engine (and not just the free UDK), native bindings allow for UnrealScript
functions to be implemented in C++. An example of this is shown in Figure 11.1 .
Figure 11.1 UnrealScript native bindings of a Ship class.
Syntactically, UnrealScript looks very much like C++ or Java. Because it's strictly
object oriented, every class derives from Object in one way or another, and
nearly every class representing a character on the screen is derived from Actor .
One very unique feature of UnrealScript is built-in support for states. It is possible
to have different function overloads depending on the state, which makes it very
easy to set up state machines for AI behavior, for example. In the code snippet that
follows, a different Tick function (Unreal's object update function) is called de-
pending on the current state of the class:
Click here to view code image
// Auto means this state is entered by default
auto state Idle
{
function Tick( float DeltaTime)
{
Search WWH ::




Custom Search