Dynamic Entity System

From Post-Apocalyptic RPG wiki

Jump to: navigation, search

Implemented code proposal.png This article features an already implemented code proposal.

Implemented Proposals have had code checked in to the SVN repository. The Implemented Proposals should serve as documentation for the actual implementation. Developers should strive to update these as needed.

DYNAMIC ENTITY SYSTEM.png




Contents

Description

Changing the structure of the files describing objects (*_agent.yaml and object_database.yaml)) to make them more dynamic.

Rationale

The changes would allow for customizing objects outside of the code.

Reasoning

The idea with this proposal is that the game decides what the object can do, by the components it has.

Pros and Cons

Pro:

  • Objects can be created without knowledge of python
  • Objects will be more flexible (Possible actions will be deduced by the objects components not the class.)

Con:

  • Old objects need to be adjusted for the new structure. (But this is quite trivial work.)

Changes

The changes to the files are like this:

  • Old:
*_agents.yaml
Yam:
    ViewName: Yam
    ObjectType: "MapItem"
    ItemType: "Rotten yam"
    Map: "Farm"
    Position: [-4.0, 0.0]
    Rotation: 0

object_database.yaml
Rotten yam:
  name: Rotten yam
  image: /gui/inv_images/inv_yam.png
  gfx: rotten_yam
  actions:
    Look:
      text: Yuck! Hard to believe its edible! And how did it get here? Or rather - how old is this?
  • New:
*_agents.yaml
Yam:
    Template: "Rotten yam"                
    Entity:
        description:
            view_name: Yam
    Map: "Farm"
    Position: [-4.0, 0.0]
    Rotation: 0

object_database.yaml
Rotten yam:
  description:
    real_name: Rotten yam
  containable:
    image: /gui/inv_images/inv_yam.png
    bulk: 1
    weight: 1
  fifeagent:
    gfx: rotten_yam
  usable:
    actions:
      Look:
        text: Yuck! Hard to believe its edible! And how did it get here? Or rather - how old is this?

This proposal was accepted 18.09.2011 on an IRC meeting.
This proposal was implemented 30.09.2011 (Last commit: c9fba51214ed6ff747e8c81d6e79bff3c6fa61c5)

Personal tools