UnrealScript
Encyclopedia
UnrealScript is the scripting language
Scripting language
A scripting language, script language, or extension language is a programming language that allows control of one or more applications. "Scripts" are distinct from the core code of the application, as they are usually written in a different language and are often created or at least modified by the...

 of the Unreal Engine
Unreal Engine
The Unreal Engine is a game engine developed by Epic Games, first illustrated in the 1998 first-person shooter game Unreal. Although primarily developed for first-person shooters, it has been successfully used in a variety of other genres, including stealth, MMORPGs and RPGs...

 and is used for authoring game code and gameplay
Gameplay
Gameplay is the specific way in which players interact with a game, and in particular with video games. Gameplay is the pattern defined through the game rules, connection between player and the game, challenges and overcoming them, plot and player's connection with it...

 events.

Similar in basic design principles to Java
Java (programming language)
Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities...

, UnrealScript has object-oriented features but does not support multiple inheritance
Multiple inheritance
Multiple inheritance is a feature of some object-oriented computer programming languages in which a class can inherit behaviors and features from more than one superclass....

: classes all inherit from a common Object class and are defined in individual files named after each class. Unlike Java
Java (programming language)
Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities...

, UnrealScript is case-insensitive, and does not have object wrappers for primitive types. Interfaces are only supported in Unreal Engine
Unreal Engine
The Unreal Engine is a game engine developed by Epic Games, first illustrated in the 1998 first-person shooter game Unreal. Although primarily developed for first-person shooters, it has been successfully used in a variety of other genres, including stealth, MMORPGs and RPGs...

 generation 3 and a few Unreal Engine 2 games. UnrealScript supports operator overloading
Operator overloading
In object oriented computer programming, operator overloading—less commonly known as operator ad-hoc polymorphism—is a specific case of polymorphism, where different operators have different implementations depending on their arguments...

, but not method overloading
Method overloading
Function overloading or method overloading is a feature found in various programming languages such as Ada, C#, VB.NET, C++, D and Java that allows the creation of several methods with the same name which differ from each other in terms of the type of the input and the type of the output of the...

, except for optional parameters.

The language was also designed for simple, high-level
High-level programming language
A high-level programming language is a programming language with strong abstraction from the details of the computer. In comparison to low-level programming languages, it may use natural language elements, be easier to use, or be from the specification of the program, making the process of...

 game programming
Game programming
Game programming, a subset of game development, is the programming of computer, console or arcade games. Though often engaged in by professional game programmers, many novices may program games as a hobby...

. The UnrealScript interpreter was programmed by Tim Sweeney
Tim Sweeney (game developer)
Tim Sweeney, born in 1970, is a computer game programmer and the founder of Epic Games, being best known for his work on ZZT and the Unreal Engine....

, who had also created an earlier game scripting language called ZZT-oop
ZZT-oop
ZZT-oop was an early in-game scripting programming language, designed by Tim Sweeney, for his computer game ZZT. The name stands for ZZT Object Oriented Programming language. The name of the language is a play on ZZ Top, an American rock band.-Overview:...

.

By making the process of modifying the game easier, UnrealScript helped enable the growth of a large community of people on the Internet
Internet
The Internet is a global system of interconnected computer networks that use the standard Internet protocol suite to serve billions of users worldwide...

 dedicated to modifying Unreal
Unreal
Unreal is a first-person shooter video game developed by Epic MegaGames and Digital Extremes and published by GT Interactive in May 1998...

. This ability greatly added to the overall longevity of Unreal and provided an incentive for new development.

Code comments

UnrealScript uses two commenting
Comment (computer programming)
In computer programming, a comment is a programming language construct used to embed programmer-readable annotations in the source code of a computer program. Those annotations are potentially significant to programmers but typically ignorable to compilers and interpreters. Comments are usually...

 styles, a single-line comment (beginning with // until the end of the line) and a multi-line comment (delimited by /* and */).


// Single-line comment
class Foo extends Object;

/* Multi-line
comment */
var Object Foo;

Functions

UnrealScript uses functions similar to C/C++. Functions are declared by the keyword: function, the variable type: int, the name: example_function, and finally the function parameters enclosed in parenthesis: (int example_number).

The body is enclosed in brackets { example_number = 5; }.

Before the final bracket, a return function can be called, returning the a value to the original caller.


function int example_function(int example_number) {
example_number = 5;
return example_number;
}


This function takes the integer example_number, changes its value to 5, then returns its value to the caller.

"Hello, world" example

The following is a hello world example using the syntax of UnrealScript.

class HelloWorld extends GameInfo;

event InitGame(string Options, out string Error) {
`log("Hello, world!");
}


The following text will be printed to the output console when HelloWorld is initializing:

Hello, world!

See also

  • WOTgreal
    WOTgreal
    WOTgreal is an integrated development environment for developing scripts in UnrealScript, a scripting language used to create computer games. It is developed and maintained by Dean Harmon. The name WOTgreal refers to The Wheel of Time series of novels and its video-game adaptation, which was...

     - Integrated development environment
    Integrated development environment
    An integrated development environment is a software application that provides comprehensive facilities to computer programmers for software development...

     for UnrealScript
  • nFringe - A Microsoft Visual Studio
    Microsoft Visual Studio
    Microsoft Visual Studio is an integrated development environment from Microsoft. It is used to develop console and graphical user interface applications along with Windows Forms applications, web sites, web applications, and web services in both native code together with managed code for all...

     plug-in for UnrealScript
  • UnCodeX - An application to browse source code of UnrealScript
  • Unreal Writer - A basic UnrealScript editor for Mac OS X

External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK