Engine Overview

From Legends of Aria Admin and Modding Wiki
Jump to: navigation, search

Dynamic Game Objects (GameObj)

Shards Online is a true world simulation in the sense that there are very little arbitrary rules on the dynamic game objects in the world. Dynamic game objects (GameObjs) can be placed anywhere and are defined by their properties. GameObjs that contain a mobile component can move smoothly throughout the world using the pathing algorithm.

NOTE: In Lua, the reference type for dynamic game objects is GameObj and we will refer to them as such in this handbook.

All GameObjs are created from templates. The template is the definition for the initial state of an object at creation. It defines things like: What does it look like (Client Id)? What is its name? What sorts of behaviors does this object have? etc. Once the GameObj is created, the template is never referenced again and every property about that object can be changed by scripts or god powers.

Properties

If you understand all of the different types of properties and behaviors that can be assigned to GameObjs then you essentially understand how Shards Online works at its core.

Base Properties

These properties exist on every GameObj in the game. If a property is not defined in the template, it will fall back to its default value (assuming it’s not required). Each entry is optional unless otherwise noted.

  • ClientId (required) – This is the art asset id the client uses to display this object. It also determines which Shared Object Properties (See section under Lua Script Engine) this object has and their default values.
  • Name - String for what name to give the object.
  • ScaleModifier – Modifies the size of the object by multiplying the default scale of the object by this value.
  • Color – This is a hexadecimal color code in the format 0xARGB. Example: Red is 0xFFFF0000

Mobile Component

This must exist on any object that can move smoothly across the map using the pathing algorithm. Currently, this is limited to players, NPCs and creatures, however, later this could be expanded to vehicles such as carts and boats.

  • BaseRunSpeed – Default is currently 6 (units/sec)
  • MobileType – This is used to group mobs together for player targeting purposes. For example, if a mobile is "Friendly" then players will need to force an attack on them. This value is also accessible in the Lua script engine.

Object Variable Component

Object Variables are for storage of persistent information about the object. This means it is maintained across server restarts. Object variables are attached to the GameObj itself and are accessible to any Module, even Modules attached to other GameObjs. If you wish to share real-time information between Modules use SendMessage.

Object Variables can be manipulated with SetObjVar and DelObjVar you can also check for their existance with HasObjVar or retrieve the value with GetObjVar

Tip: Many modules expect certain object variables to be set on an object. For example, the "weapon_base" module expects the "WeaponType" object variable to be set.

Script Engine Component

This will attach a Module to the GameObj in the same way AddModule will.

Pre-Alpha Note: Even if your object does not have any Object Variables or Behaviors at creation, it should still have an empty ObjectVariableComponent and ScriptEngineComponent node in its Template file. This is because the engine does not yet automatically create these for you when they are needed at runtime. If you are using the template editor tool, this is automatically done for you.

Seed Objects

The engine creates a set of initial game objects when the map is loaded for the first time. We call these objects "Seed Objects" and they define the dynamic nature of the map.

Many of these "Seed Objects" are invisible to mortal players and are used as a source for controller scripts. The simplest and most common example of a controller script is a spawner, a behavior that spawns other GameObjs like monsters or animals on the map.

Permanent Objects (PermanentObj)

In order to allow the user to interact with the thousands of rocks and trees on the map without killing server performance, we also have a second, simpler, type of object for them called "Permanent Objects". These are map objects that never move and have no base properties or behaviors. The only information that is stored for each is a single visual state (Example: a tree could have full, stump and hidden).

Client Only Objects

These are objects that are built into the map and the server has no access to. This means players and other objects cannot interact with them. A simple example of this is grass or a bridge. Collision for client only objects is also built into the map and can only be changed by modifying client files.