Introduction to objects

From Open Surge Engine Wiki
Revision as of 20:29, 1 September 2010 by 143.107.161.170 (Talk)

Jump to: navigation, search

Overview

Objects are elements that allow users to greatly extend the original Open Surge Engine. They are entities that can be put in levels and that can interact with the player in a way that is specified by the user. This interaction is specified in a text file containing commands. This text file is said to be an object script.

Fact
Object scripts are .obj files stored in the objects/ folder.

Usually, objects are composed by a script (.obj), a sprite (.spr), an image and optionally by sound effects. Objects can be made by you or by other people. You can download extra objects at the community forums. They usually come in a package (like a .zip file), and installing them is as simple as placing the files in the right folders (example: move the .obj file to the objects folder, the .spr file to the sprites folder, and so on).

If you develop your own objects, you can contribute to the Open Surge community by sharing them at the community forums.

Introduction to object scripts

This page focuses on the basics of developing object scripts. We assume the reader already knows how to script sprites (i.e., .spr files located in the sprites/ folder).

The Decorated State Machine Method

Definition
A decorated state machine is a mathematical abstraction that can be used to describe the behavior of objects. It is composed by a finite number of states and by transitions between these states. Each state can be decorated with decorators, which are small actions that the object must perform.