IRIS/IRIS++ | Game Development Programming Language


Top Top | Previous Prev | Next Next


Overview


IRIS Game Demo 1 IRIS Game Demo 2 IRIS Game Demo 3


IRIS/IRIS++ (IRIS Real-time Interpreting Script) is a scripting language developed for programming interactive applications, such as games. To design a simple, non-redundant, yet robust application, a good system architecture is required - A system that can handle design change requests with ease. A good architecture can reduce development cost, simplify the designing process and deliver the product on time. To fulfill the goals, IRIS provides:



Simple Instruction Sets

IRIS is made up of simple instruction sets that looks similar to the assembler language (Inspired from the old PDP-8). There are 256 registers (Think of it as a variable storage for now) provided for programmers to work with, and instructions to manipulate with those data. The simplicity of the instruction sets allows programmers to learn the language in a short time. Take a look at the following sample script:


// Use register 0
REG $0
// Add 5 to register 0
ATR 5
// Add 7 to register 1
REG $1
ATR 7
// Sum up the register values together and store it in register 2
REG $2
ATR $0
SUM $1
// Add the results into the output buffer
ATB $2
// Print out the value of the output buffer on screen (12)
PTB

As you can see, the instruction and parameters are separated by spaces. Registers are represented by the $ sign followed by the register number. For the list of instruction sets, see Instruction Sets in the Language Specifications.

Also, the IRIS compiler can be set to replace the instructions with your own instruction sets during compilation, which allows you to come up with a completely new programming language. See IRIS++ for more information.


Fast Interpretation and Minimum Memory Usage

IRIS is designed to utilize a small amount of memory space. The script as shown above, will be compiled to a byte-code (binary code made up of single bytes) by the IRIS compiler. Then, the binary code is interpreted by the Virtual Machine, which is more than approximately 100 times faster than interpreting a plain text. This is especially effective for application that uses slow CPU and limited amount of memory (i.e. mobile devices).


High Portability

Once the script is written, it can be executed on many platforms (PC, mobile devices, etc) without modifying the script. The only thing that needs to be modified is the underlaying application engine that executes the script. This is same as other programming languages that uses virtual machines (i.e. JAVA). Therefore, the flow and UI of the application does not need to be re-written for each target platform every time. For a portability example, see Virtual Machine On PHP.


High Extensibility

IRIS provides instruction sets to manipulate with data, but has limited usage by it self. For instance, the PTX instruction prints out text to the console, but you cannot specify positions or change the font appearances. What you need to do is extend IRIS with instruction sets that cover these limitations. Since IRIS is designed in an object-oriented way, this can be implemented easily by making a child class of IRIS. Take a look at the following example:


// Add string "Hello, World!" to register 0
REG $0
ATR "Hello, World!\n"
// Print text in register 0 on screen with position coordinates x=100, y=200
_gameEngine._screen._blit._x.set 100
_gameEngine._screen._blit._y.set 200
_gameEngine._screen.print $0

_gameEngine is an object representing the instance of the game engine's class. Objects are normally represented by user-defined instruction sets (or commands) that inherits IRIS. print is a command of the gameEngine's screen object that prints a text on screen with the coordinates specified in the screen's blit object. As you can see, IRIS provides basic instruction sets to control the program (or event) flow. To make use of it, programmers can simply extend the language to implement the remaining functionality of the application. See Extended Features for IRIS/IRIS++ extensions.


Easy Implementation

Coding the virtual machine (that executes the script) is very easy too. Since IRIS only has few instruction sets, there needs to be few coding done. As the original program is coded in C++, it can be ported to other OOP languages easily. This means, IRIS can be ported to many other different operating systems with ease. For an implementation example, see Virtual Machine On PHP.


Application Layer Abstraction

Provides a layer between the application engine and data. Defining literal data inside the program it self is not regarded as a good practice in programming. Consider the following example:


// Example 1
void main() {
  // Set application title
  setAppTitle("MyApplication");
}

// Example 2
void main() {
  // Read application title data from external file
  String appTitle = readData();
  // Set application title
  setAppTitle(appTitle);
}

The latter is a bit more complicated, but is more flexible to changes. For instance, say you wanted to change the application title to something like "MyApp2". In example 1, you will need to make modifications in the actual method to the desired string and then go though the trouble of compiling the whole application. However, in example 2, you will only need to change the string in the external file without compiling any program. This will not only save time for compilation, but will reduce the probability of creating bugs in your application.

In case of IRIS, if you want any of the logic or appearances to be modified, you only need to modify the script.