Drudge
Drudge is the first Ruleset I'm designing, to give an idea of how things will evolve. From the include file:
<?php
/**
* Drudge -- Drupal RPG Universal DIY Gaming Engine
* This ruleset borrows liberally from F.U.D.G.E.
* which is an open source generic RPG ruleset.
* Read more at wikipedia[1]
*/
?>[1] http://en.wikipedia.org/wiki/Fudge_die
From the types.inc in the drudge folder:
<tangible>
<name>Tangible Object</name>
<parents></parents>
<shortdesc>This is a thing that can be seen, touched, etc.</shortdesc>
<longdesc>Everything in the game is a tangible object.</longdesc>
<attributes>
<location>
<name>Location</name>
<class>number</class>
<shortdesc>Every object needs to live somewhere.</shortdesc>
<longdesc></longdesc>
<default>0</default>
</location>
<takeable>
<name>Takeable</name>
<class>boolean</class>
<shortdesc>May this object be taken by a PC under normal circumstances?</shortdesc>
<longdesc>Objects may normally be taken by a PC, as long as in reach and not possessed by another. If 'Takeable' is set to false, then the object may not be taken.</longdesc>
<default>1</default>
</takeable>
</attributes>
</tangible>Aaron Winborn
Drupal RPG, home of the RPG module for Drupal.
Spindowners, an upcoming RPG using the module.
(Cross-posted at Drupal RPG.)
Groups:
Login to post comments

Here's its state right now.
Here's its state right now. Most of the code is already in place -- just have to write the parser for these scripts.
<?php
<types>
<tangible>
<name>Tangible Object</name>
<parents></parents>
<shortdesc>This is a thing that can be touched.</shortdesc>
<longdesc>Everything in the game is a tangible object.</longdesc>
<attributes>
<name>
<name>Name</name>
<class>text</class>
<shortdesc>This is the basic name of an object, usually used to derive an object's title.</shortdesc>
</name>
<location>
<name>Location</name>
<class>number</class>
<verify>
return !rpg_get($value, 'is_in', $object);
</verify>
<set>
rpg_remove_from($current, 'contents', $object);
rpg_add_to($value, 'contents', $object);
</set>
<shortdesc>Every object needs to live somewhere.</shortdesc>
<longdesc></longdesc>
<default>0</default>
</location>
<contents>
<name>Contents</name>
<class>array</class>
<shortdesc>What does this object contain?</shortdesc>
<longdesc>This is an array of the objects contained within this object.</longdesc>
</contents>
<moveable>
<name>Moveable</name>
<class>boolean</class>
<shortdesc>Is the object moveable?</shortdesc>
<longdesc>Some objects may not be moved.</longdesc>
<default>0</default>
</moveable>
<is_in>
<name>Is in</name>
<class>figured</class>
<args>$location</args>
<get>
if (rpg_get($object, 'location') == $location) {
return true;
}
foreach(rpg_get($location, 'contents') as $content) {
if (rpg_get($object, 'is_in', $content)) {
return true;
}
}
return false;
</get>
</is_in>
<may_take>
<name>May Take</name>
<class>figured</class>
<args>$who</args>
<get>
return rpg_get($object, 'moveable') && !(rpg_get($object, 'location') == $who) && (rpg_get($object, 'is_in', rpg_get($who, 'location)));
</get>
<shortdesc>May this object be taken by a PC under normal circumstances?</shortdesc>
<longdesc>Objects may normally be taken by a PC, as long as in reach and not possessed by another. If 'Takeable' is set to false, then the object may not be taken.</longdesc>
<default>1</default>
</may_take>
<visible>
<name>Visible</name>
<class>boolean</class>
<shortdesc>Is an object visible under normal conditions?</shortdesc>
<default>1</default>
</visible>
<may_see>
<name>May see</name>
<class>figured</class>
<shortdesc>May a player see this specific object?</shortdesc>
<longdesc>A player may see an object if it is visible, in the same room, and there is enough lighting.</longdesc>
<args>$who</args>
<get>
// TODO: add lighting
return rpg_get($object, 'visible') && rpg_get($object, 'is_in', rpg_get($who, 'location'));
</get>
</may_see>
<description>
<name>Description</name>
<class>text</class>
<shortdesc>This is what players see when they examine an object.</shortdesc>
</description>
<sprite>
<name>Sprite</name>
<class>sprite</class>
<shortdesc>If present, this sprite will be displayed when an object is examined.</shortdesc>
</sprite>
</attributes>
<actions>
<drop>
<name>Examine</name>
<link_title>examine !object</link_title>
<shortdesc>Examine @object.</shortdesc>
<longdesc>If a player is able to see an object, then display its description.</longdesc>
<action>
if (rpg_get($object, 'may_see', $player)) {
rpg_set_message(rpg_get($object, 'sprite'));
rpg_set_message(rpg_get($object, 'description'));
}
</action>
</drop>
<take>
<name>Take</name>
<shortdesc>Take @object.</shortdesc>
<longdesc>If an object is in the player's location and may be taken, then transfer the object to the player's inventory.</longdesc>
<link_title>take !object</link_title>
<action>
if (rpg_get($object, 'may_take')) {
rpg_set($object, 'location', $player);
}
</action>
</take>
<drop>
<name>Drop</name>
<link_title>drop !object</link_title>
<shortdesc>Drop @object.</shortdesc>
<longdesc>If an object is in the player's location and may be removed, then transfer the object to the player's location.</longdesc>
<longdesc></longdesc>
<action>
if (rpg_get($object, 'moveable') && rpg_get($object, 'is_in', $player)) {
rpg_set($object, 'location', $player);
}
</action>
</drop>
</actions>
</tangible>
<actor>
<name>Actor</name>
<parents>
<parent>tangible</parent>
</parents>
<shortdesc></shortdesc>
</actor>
</types>
<objects>
<tangible>
</tangible>
</objects>
?>
Aaron Winborn
Advomatic, Web Design for Progressive Advocacy, Grassroots Movements, and Really Cool Causes
Drupal RPG, home of the RPG module
Spindowners, an upcoming sci-fi RPG
Explanation
rpg_get($object, 'attribute') -- this will return the value of the object's attribute. ($object is the unique id of the object).
rpg_set($object, 'attribute', $value) -- if the verify clause passes, then set the value of the object's attribute to $value.
Attributes may be of a class defined by a module (most by the rpg_attributes module). All attributes will have the following properties, and some classes may add their own:
name -- the name of the attribute.
class -- the class of the attribute, such as number, text, or sprite.
shortdesc -- the short description (showing up in admin attribute lists).
longdesc -- the long description (showing up in admin attribute edit pages).
args -- if set, then call rpg_get like: rpg_get($object, 'attribute', $arg1, $arg2, etc). otherwise, it's just rpg_get($object, 'attribute').
get -- if set, then return the value from this php code rather than the value stored in the table. normally used only for figured attributes.
verify -- if set, then before setting an attribute, this must return true.
set -- if set, then call this php code before setting the value. this is ignored with figured attributes, as they have no table for values.
default -- if set, then any new objects will have this attribute set to the default value. this is ignored with figured attributes.
classes:
text -- this is a text string.
number -- this is an integer.
boolean -- true or false.
figured -- the value of figured attributes will always be determined from the get php code of the attribute defition.
sprite -- this is a file to be displayed (usually an image or gif animation).
array -- this is an array. rpg_add_to and rpg_remove_from may be used with these attributes in addition to rpg_set.
actions:
name -- name of the action to perform.
link_title -- what will be displayed for the link for a player to perform an allowed action.
shortdesc & longdesc -- as above.
action -- the php code to be performed when invoking an action. it will generally perform its own verification, to ensure the game state hasn't changed since clicking a link.
Aaron Winborn
Advomatic, Web Design for Progressive Advocacy, Grassroots Movements, and Really Cool Causes
Drupal RPG, home of the RPG module
Spindowners, an upcoming sci-fi RPG