DSB/Archetypes
Overview
An Archetype is a general category of item, such as "Axe", "Iron Keyhole", "Screamer" or "Wooden Door".
Here's a very basic example of a simple archetype, an apple, as defined in DSBs base code:
obj.apple = { name="APPLE", type="THING", shortdesc="CONSUMABLE", class="FOOD", mass=4, icon=gfx.icons[168], dungeon=gfx.apple, foodval=500, fit_pouch = true, on_consume=eatdrink }
The base code defines hundreds of different archetypes that fall into broad categories. Every archetype has a number of properties that define its type, graphics, sounds and behaviour.
Properties
All archetypes share a few basic properties such as Type and Class, but there are a lot of properties only used by certain types of Archetype. Customisations can be made to any existing dungeon object by altering or adding to the properties of its archetype. Completely new archetypes can also be created, either from scratch or by cloning an existing archetype and modifying some its properties.
Types
An archetype's TYPE defines its core behaviour. For example, type "DOOR" automatically sets the item to behave as a door, while type "THING" is anything that can be picked up by the party.
Here's the full list of types, and a brief explanation of how they are used. Each of these types also links to an example that shows all the properties you can use with that type.
- UNDEFINED
- Special types used by core engine system functions
- FLOORFLAT
- A dungeon object that sits on a tile, such as a drain, pit, trigger, movable wall, etc. Floorflats include decorative items as well as dungeon mechanics. By default, foorflats occupy an entire tile and are placed in the centre of a tile when using the ESB editor. You can also move floorflats to the corners of a tile, but this may invoke odd behaviour.
- FLOORUPRIGHT
- Flooruprights are items that sit within the centre of a tile and may block or otherwise affect party progress. The default items of this type are stairs and doorframes, but you can create new types such as tables, pillars and statues.
- DOOR
- Doors are self-explanatory. These will block party progress when closed. Doors can be opened and closed using dungeon mechanics and can also be destroyed using weapons or magic handled by strong characters.
- HAZE
- Hazes are full-tile items that show some kind of magical effect, such as the animated teleporter and fluxcage. Hazes are rendered in such a way as to appear to completely fill one tile, even though the bitmaps used may simply be a very small pattern.
- CLOUD
- A cloud is normally created when a magic spell explodes on a tile, or a creature is killed. Some clouds expire very quickly (fireball) while others expire after a duration, getting smaller as they dissipate.
- WALLITEM
- Wallitems are used to decorate the walls of the dungeon and can be used simply as static eye-candy, or as triggers. Every wallitem can be made into a trigger using the editor. Typical triggers are keyholes and levers, but you can make anything respond to player input if you choose. Some wallitems already have default behaviours. For example, fountains will allow a champion to fill a flask or waterskin.
- THING
- Things are the items in the dungeon that the champions can pick up and manipulate. A key, a torch, a dagger or a pair of boots are classed as Things. Things can be very simple and have no special functions, or more complex such as a torch that affects the light level of the dungeon. Different properties allow Things to be worn, consumed or used as weapons.
- MONSTER
- The Monster archetype is used to define anything that you want to behave as a creature. Monsters have the largest group of properties and can be customised very heavily to change their behaviour.
Classes
Classes are used to arrange archetypes into sensible groups for easy identification in the editor, ESB. Classes do not define any behaviour, graphics or sounds and are simply labels collecting together similar archetypes. For example, the DECO class is used to identify archetypes that are certain style of decorative dungeon object.
Classes can be used to sub-group items based on their type. For example, both the FLOORFLAT type and the WALLITEM type contain a DECO class. This is useful for quickly finding the archetype you need while building your dungeon in the editor.