Content Architecture - MyEyes/Igorr GitHub Wiki
Content
This article is ment to describe how content is managed in the engine. The game is supposed to be fully mod-able so the engine itself provides a flexible interface to add or override content from the game.
##General
The engine itself can be split into three large parts. Server, Client and Content.
The server is the highest authority in the game. The client merely serves as a means to disply the current state of the server. You could say that the server handles the games logic while the client handles its presentation.
Tools are used to generate content or assets for the game.
The server and client are both very light weight at their core implementing mainly the mechanisms needed to synchronize the server and client state and to minimize the amount of data needed to be send. Both the server and client have their objects logic defined in a separate library. These logic libraries are what you want to use if you want to create content with distinct behaviour for the game.
##Modules
Since the server and client both only implement a bare minimum and no content at all for the game, there is an interface to handle that.
Both the server and client load all avaiable modules from their Content directory on startup and use them to spawn objects in the game.
To create a module you need to reference the IGORR.Module library.
Parts of IGORR.Module
Name | Description |
---|---|
Object Module | This is the anchor point for the server and client. When creating a new module you need to inherit from this once, but not make any changes. |
Object Template | Anchor point for ingame objects. Each Object Template needs to define a unique ID as well as a way to load for the server and client each. |
Effect Template | Anchor point for visual effects. These templates are used client side only and ment to enhance visuals |
Attack Template | Anchor point for attacks. This allows you to create unique attack animations and behaviours in the game |
Object Control | An object control can be defined by an Object Template. This control is used in the map editor if additional information about the object needs to be stored in the map data. |
Templates
Important: Templates are only the hooks. They do not hold the actual implementation of the new object/effect/attack and should just define how the object is created from map or packet data.
The Object Template, Effect Template and Attack Template all describe how new objects will be spawned in the game. Every template within a module needs to have a unique ID per category. (Note: This does not apply to multiple modules so you can override certain objects from older modules by creating a template in a new one with the same ID.) So you can have an Attack Template with ID 7 and an Object Template with ID 7 in the same module, but not two Object Templates with ID 7.
A template is either only used on just the client side (Effects, Attacks) or both the server and client side. In either way it needs to define some things.
Template Type | Server side | Client side | ID |
---|---|---|---|
Object | CreateServer | CreateClient | TypeID |
Attack | - | CreateClient | TypeID |
Effect | - | DoEffect | EffectID |
The reason Effects do not need a server side implementation should be obvious. The reason Attacks do not need a server side hook probably less so. The reason is that attacks will be created by server side objects anyway. So no hook is needed since the objects defined in the module "know" about the new custom attack and can create it themselves without needing a hook.
##The Lua interface
Besides the module system there is a lua interface to allow for basic scripting capabilities. This is mainly ment to create ingame dialog as well as dynamic events and to manipulate global and player specific triggers.
There is a detailed description here.
Content Folder Structure
The game engine (ab)-uses the XNA content system to handle its content on both the client and server side. All folders in this listing are required to exist. Even if they are empty.
Folder | Description |
---|---|
chars | Holds character files. Those define the dimensions of an ingame character as well as their animation frames and basic animations |
effects | Holds effect files. Those define particle effects. (Might be deprecated now that the effect interface exists) |
fonts | Contains definitions for sprite fonts |
gfx | Contains all of the games graphics. Can be organized with subfolders |
map | Contains map data. |
modules | Contains the module dlls to be loaded on startup |
shaders | Contains custom shaders |
sound | Contains sound assets |
scripts | Contains the lua script files that control LuaNPC behaviour |