Marauroa Core API: Difference between revisions
Jump to navigation
Jump to search
Content deleted Content added
No edit summary |
imported>StephenIerodiaconou No edit summary |
||
| Line 82: | Line 82: | ||
* ''void isA(RPClass parent)'' |
* ''void isA(RPClass parent)'' |
||
These methods add attributes to the RPClass and set their type and visibility. You can also set the parent of this class. Of course a class can have no parent. |
These methods add attributes to the RPClass and set their type and visibility. You can also set the parent of this class. Of course, however, a class can have no parent (be parentless). |
||
Once the class has been filled, you can query the data using these methods. These methods alow you to get the class name of the class, the the type of an attribute, determine if an attribute exists and to know if that RPClass is a subclass of another.<br> |
Once the class has been filled, you can query the data using these methods. These methods alow you to get the class name of the class, the the type of an attribute, determine if an attribute exists and to know if that RPClass is a subclass of another.<br> |
||
| Line 117: | Line 117: | ||
</pre> |
</pre> |
||
Each time you create a new RPClass |
Each time you create a new RPClass, as long as you give it a name ( ie: player, position, ... ), it will be added to the system list of classes.<br> |
||
Notice |
Notice in the example that the HIDDEN attribute must be specified if you want the RPClass to have this property otherwise by default an attribute is visible.<br> |
||
You can choose not to use RPClasses |
Note: You can choose not to use RPClasses in your application BUT the performance penalty will be big on bandwidth and CPU usage. |
||
= RPAction = |
= RPAction = |
||
RPAction is an object used to represent actions that a player wants to do. |
|||
It is up to your game |
It is up to you to create these when you design your game as they are specific to each game ( you should also define a RPClass for these ). |
||
= RPObject and RPSlot = |
= RPObject and RPSlot = |
||
RPObjects are the containters of data in Arianne. An RPObject is an (''isa'' function) Attributes element with a list of RPSlots attached. <br> |
|||
RPSlots are slots on objects that items can be placed on/in, such as backpacks, pockets, boxes, ...<br> |
|||
The new methods are: |
|||
The methods of the RPObject to modify slots are: |
|||
* void addSlot(RPSlot slot) |
* ''void addSlot(RPSlot slot)'' |
||
| ⚫ | |||
* |
* ''RPSlot getSlot(String name)'' |
||
* |
* ''void removeSlot(String name)'' |
||
| ⚫ | |||
* Iterator slotIterator() |
* ''Iterator slotIterator()'' |
||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
* void add(RPObject object) |
* void add(RPObject object) |
||
* RPObject get(RPObject.ID id) |
* RPObject get(RPObject.ID id) |
||
| Line 145: | Line 145: | ||
* RPObject remove(RPObject.ID id) |
* RPObject remove(RPObject.ID id) |
||
* void clear() |
* void clear() |
||
These methods modify objects in the RPSlot. |
|||
The clear removes all the |
The clear() method removes all the objects in the slot. |
||
* Iterator iterator() |
* Iterator iterator() |
||
| Line 164: | Line 164: | ||
</pre> |
</pre> |
||
Now the complex part |
Now for the complex part. Where it all becomes a little nuts!: IRPZone and IRPRuleProcessor interfaces |
||
=RPWorld= |
=RPWorld= |
||
TODO |
TODO |
||
=IRPZone= |
=IRPZone= |
||
IRPZone is the class that handles the world content and the perceptions. It would be wise to forget about it, or extend MarauroaRPZone instead as it's a complex and error prone class. <br> |
|||
The methods are: |
The methods are: |
||
<pre> |
<pre> |
||
/** This method is called when the zone is created to |
/** This method is called when the zone is created to populate it */ |
||
public void onInit() throws Exception; |
public void onInit() throws Exception; |
||
/** This method is called when the server finish to save the content of the zone */ |
/** This method is called when the server finish to save the content of the zone */ |
||
| Line 204: | Line 205: | ||
</pre> |
</pre> |
||
In most of the cases all you will |
In most of the cases all you will wish to modify are: |
||
* onInit |
* onInit |
||
* onFinish |
* onFinish |
||
| Line 211: | Line 212: | ||
=IRPRuleProcessor= |
=IRPRuleProcessor= |
||
This class *MUST* be implemented fully, but it is a |
This class *MUST* be implemented fully, but it is a childs toy compared to IRPZone :). This is where you code all your games rules.<br> |
||
The API is as: |
The API is as follows: |
||
<pre> |
<pre> |
||
/** Set the context where the actions are executed. |
/** Set the context where the actions are executed. |
||