Tribe Design

From PSwiki
Jump to navigation Jump to search

Setting up tribes

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

  • tribes
    • 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:

  • tribe:explore
  • tribe:dig
  • tribe:reproduce (should result in a reproduce op).
  • tribe:resurrect
  • tribe:path1 or tribe:path2 randomly selected (triggered by walk need)

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 locate and use the dig op to get resources when the tribe:dig perception is triggered. The transfer op 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.

Tribe death

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