|
=RPManager=
The goal of the RP Manager is to handle the whole RP of the game. This means mainly:
* run RPActions from clients
* manage RPWorld
* control AI
As you see thisThis is a HUGE takstask that is very complex. So the idea isHence towe split this behavior into smaller subclasses.
RPManager providesexposes a simple interface to the GameManager for using it:
* <i>addRPAction</i> <br> ItThis simplyfunction queues an action for thata particular player to be executed on the next turn.
* <i>getRPObject</i> <br> ItThis is an interface to manage RPWorld to ease the adquisitionaquisition of the RPObject when exiting the game.
* <i>onInit Player</i>
* <i>onExit Player</i><br> TheyThese are callback functions that are used by GameManager to notify that a player has entered the game or that a player has exitexited the game.
* <i>transferContent</i><br> It is a callback function too that is called by RPRuleProcessor to stream content to players.
The main outlineflow of RPManager could beis:
<pre>
forever
RPRuleProcessor is a wrapper class for actions code and initialization and exit code. <br>
All the actions code MUST be here.<br>
By implementing RPRuleProcessor you personalize Marauroa to be the kind of game you want to codemake. ButHowever, keep in mind that you are ''limited'' to a realtime likestyle game.
=Objects and Actions=
The whole Marauroa system is managed by two main entities, RPAction and RPObject. andThere are also several helper classes like Attributes, RPSlot and RPClass
==Atributtes==
Attributes is a collection of pairs of values in the form name-value.
We can store almost any basic type in a Attribute object:
* strings
* boolean
We can't store collectionsstructures in the attribute, but you can convert itgroups of data to a string and store it as a string. Marauroa provides helper methods for itthis.
==Objects==
The containers ofAll information ofin the whole Marauroa server areis contained in RPObjects. An object is composed of several attributes, (an attribute is similar to a variable in that it has a name and contains a value) and also it is composed of Slots. A Slot is a container or array of containers thatbelonging theto an object, hasand are used to host (store) other objects inside itthem.
Mandatory Object Attributes: id, type and zoneid
id is an unique identification for the Object and, zoneid is the identification for the zone where the object resides and type is the type of the object aka class, so that you can share attributes for all the instances of the class.
An id is only unique inside the zone which contains that object.
AlsoNOTE: The engine giveprovided two special treatment to two types of attributes:
- Attributes that begin with ! are completely hidden forfrom all theother users butexcept the owner of the object.
- Attributes that begin with # are completely hidden for all the users.
===Classes of Objects Explained===
Classes of Objects are the basic way of structuring Marauroa data structures.
YouThe musttype useof typean attribute to make use of classesa sogiven value of typeobject must be equal to a RPClass name of the type class you wish to use.
AThe class defines typesthe type of the attributes andattribute, its visibility and givesassigns it an internal code that is used to speed up searchs and save bandwidth. You can base a class on another, this feature is known as inheritance (a new class is create from a class that already exists and takes all the original classes methods and data and extends it).
The data types available are:
* Flag ( it is a binary attribute )
Attributes can also be visible ifwhich means clients see them when they change, or invisible if clients can't see them.
===Slots===
As you know Objects can containreside inside anotherother objectobjects much like you have the keys inside your pocket. The goal of Slots is to provide a richer game play while reducing the number of object in the zone.
To have these objects inside, we need our hoster object to have slots to place them in. One slot can only handle one single object.
For example aan avatar can have:
- left hand
- right hand
- right pocket
and we can store objects onin each of these slots.
Once thean object ishas been stored inside thean avatarobjects or another objectslot, the only way of accessing itthe stored object is through the object that contains our stored object.
As attributes, slots has alsohave two special types:
* Slots names that start with ! are only sent to owner player. (Hence only seen by the owner)
* Slots names that start with # are not sent to players. (Invisible to all)
==Actions==
To express the willingwillingness of a client to do something it must send the server a MessageC2SAction message.
An action is composed of several attributes,. (an attributedattribute is similar to a variable in that it has a name and contains a value).
There are optional and mandatory attributes. If a mandatory attribute is not found, the message is skipped by the RPServerManager.
|