Tribe Design: Difference between revisions

From PSwiki
Jump to navigation Jump to search
Magodra (talk | contribs)
Magodra (talk | contribs)
Line 13: Line 13:
TribeNeed <|-- TribeNeedDeathRate
TribeNeed <|-- TribeNeedDeathRate
TribeNeed <|-- TribeNeedTimeOfDay
TribeNeed <|-- TribeNeedTimeOfDay
</uml>
== Sequences ==
=== Advance Sequence ===
<uml>
loop For each tribe
  NPCClient -> Tribe : Advance
end
</uml>
</uml>



Revision as of 19:47, 30 April 2011

Classes

Sequences

Advance Sequence

Setting up tribes

There are 2 main database tables that need to be populated.

  • TribesTable
    • Each row represents one tribe, which must have a home position/sector and a radius in which to resurrect dead members.
    • max_size sets the maximum number of members.
    • wealth_resource sets the different types of resource that a tribe can mine in order to grow and/or sustain itself. This needs more work however the most important one is wealth_resource_growth which is the default rate at which a resource will grow without any work per second.
    • reproduction_cost is the amount of resources required to reproduce.
  • tribe_members
    • Each row is an association between a PID (on the server side) and a tribe.
  • tribe_needs
    • Each row is a need associated with a tribe
    • Consists of: type, name, perception, depend, need_start_value,need_growth_value, arguments

Tribe day-to-day life

Behaviour

A tribe has a set of needs, which are nothing, explore, dig, reproduce and walk. These needs are increased by a rate set in the code for now. When a need is activated, it may also trigger a perception for the next npc.

Tribe members are ordinary NPCs, with an additional set of Behavior Operations and perceptions to be used in Reactions. These perceptions are defined by the needs defined in the tribe_needs table and might be:

  • tribe:explore
  • tribe:dig
  • tribe:reproduce (should result in a reproduce op).
  • tribe:resurrect
  • tribe:guard
  • Or anything else

Reproduction

The reproduction need will only increase if the number of tribe members is below the maximum. When reproduction is triggered, the tribe resources are decreased by reproduction_cost and the next NPC receives the tribe:reproduce perception. If the NPC then performs the reproduce op, it causes a server-side clone. Everything is cloned and the new cloned NPC will be a member of the tribe.

Resurrection

When a member dies, it will be resurrected according to the tribe need and will also take a reproduction_cost. However, no cloning will take place.

Resources

A tribe member can be set to use the Transfere Operation to locate the memory of a tribe resource and use the Dig Operation or Harvest Operation to get resources when for example a tribe:harvest perception is triggered. The Transfere Operation needs to be used when the npc is back home to transfer it to the tribe.

Locations

The tribe:resource and tribe:home locations can be used with tribe members. For example in the Locate Operation.

Tribe death

When all the members die, then a member will be resurrected if there are 10*reproduction_cost resources available.