-
Notifications
You must be signed in to change notification settings - Fork 17
Game Objects
Every object in the game is a so-called "game object". This includes characters, room, items, etc.. Here is an overview of all the game objects that are currently defined.
Character (derives from StatsItem)
Characters are in-game characters. There are two major types of characters: players and non-playing characters (NPCs). The former are controlled by human players, the latter aren't.
Class (derives from GameObject)
A Class defines the class of a character. For example, "knight", "soldier", "mage".
Container (derives from Item)
Containers are items that may contain other items.
Event (derives from GameObject)
Event is a template object from which visual, sound, or other game events may be generated.
Exit (derives from GameObject)
Exits provide a way for characters to move from one room to another. Exits are not created in their own right. Instead, the are generated from the definitions of portals between rooms.
GameObject
GameObject is the basic type that all game objects adhere to. It defines many useful properties and methods applicable to all other objects. GameObject is not an independent type, so you cannot instantiate objects of it.
Group (derives from GameObject)
A group is not a physical or tangible entity. Instead, it simply defines which characters form a group or party together.
Item (derives from GameObject)
Every item you may see or collect (weapons, potions, decorative items in rooms, etc..) is an Item. When talking about items we typically don't include characters even though technically, characters are also items. This make them share common properties and methods with items.
Player (derives from Character)
Players are player-controlled characters.
Portals (derives from GameObject)
Portals are connections between two rooms. They may be used by characters to move between rooms, though not all portals allow this. Portals can also be created so that they only allow sounds or visuals to travel between rooms.
Race (derives from GameObject)
A Race defines the race of a character. For example, "human", "animal", "elf".
Realm (derives from GameObject)
The Realm encompasses the entire game world. There is only one Realm, and it used for tracking things that affect the entire game world, no, realm.
Room (derives from GameObject)
Rooms are locations where characters can be. They may be actual physical rooms, but really any place where you can go to counts.
Shield (derives from StatsItem)
Shield are items that can be used for defensive purposes.
StatsItem (derives from Item)
Stats items are items which have associated character stats. They may have modifiers attached that modify the current effective stats. StatsItem is not an independent type, so you cannot instantiate objects of it.
Weapon (derives from StatsItem)
Weapons are items that can be used for attacking characters.
Get an overview of all methods defined on a game object:
list-methods #<object-id>
Get an overview of all properties defined on a game object:
list-props #<object-id>
You may wish to extend game objects by adding properties or methods to them, or you may wish to create a new type of GameObject altogether.
Creating new types of game objects is currently only possible using C++. To do this, you will have to create a class that derives from GameObject. You may want to take the source of one of the existing types as template to create your own type. The Item class makes a good candidate as it's rather simple and easily stripped of its existing methods and properties.
Once you've created your own class, you have to add it to the GameObjectType enum defined in gameobject.h, and add the necessary utility functions in gameobject.h and gameobject.cpp.
You will have to recompile PlainText after adding your own game object type.
Read how you can create triggers, or how you can implement your own commands.
You may want to take a look at the Frequently Asked Questions.