Tribes expansion

From PSwiki
Jump to navigation Jump to search

(Go back to the main GSoC 2011 page)

Disclaimer

This idea has been already selected by some people. You are welcome to pick it up anyway, but in this case we suggest you to also submit another proposal for a second PlaneShift idea. You can submit as many proposals as you want for one organization.

Current status

Please read the main Tribes concept document. This document outlines the concept behind tribes implementation in PlaneShift.

Now consider that the following elements are already completed:

  • The concept of "Home", where the tribe spawns and where the tribes member return for bringing food/resources
  • The concept of harvesting around the home location
  • Food to support the expansion of the tribe
  • Maximum number of members and reproduction, the tribe can spawn new members on a simple formula
  • TribeNeedSets, possibility to have different members of a tribe to have different set of needs. E.g a queen, warrior, or a worker do have different things to do.

You can see some details of the implementation in the following pages: Tribes Design, Behavior Operations, Behaviors and Reactions.

Skills needed

Our server and client are all coded in C++ and the database is MySql. For this project C++ knowledge is needed with some knowledge of mysql. Also the NPC behaviours are defined in XML files, so some basic knowledge of XML is needed.

What's missing

Behaviour:

Keep a list of goals with priorities. The goal with the highest priority will be executed. After successful completion of a goal this priority will be lowered, so other goals will be executed. Possible goals for now are:

  • Grow in number (mate)
  • Build/enhance village size or quality
  • Gain wealth
  • Expand non aggressively (if other tribes are found, they stop)
  • Expand aggressively (if other tribes are found, attack)

In addition:

  • Be able to evaluate what’s needed to accomplish a goal, splitting it into subtasks.
  • Be able to give the subtasks to members to achieve the goal. For example if goal is grow in number, it should send input to members to seek food, then to build houses, then to mate.
  • Execute some random actions like sitting down for resting, looking around, waiting few seconds.
  • React to other NPCs nearby and stop walking to look at the nearby creature (just for few seconds, then restart walking).

Artificial intelligence in collecting materials:

  • Building materials – required by the tribe to support expansion, a small population can survive without the need for a distinguishable home but a large one cannot.
  • Raw materials – used by the tribe to craft and trade allowing it to actively participate in the economy, increase wealth, tools quality, weapons. These are the actions needed for NPC to use natural resources:
  • Dig or search for resources along the movement paths
  • Know which tool is needed for digging/harvesting
  • Remember a location when they find a resource
  • See objects that lie on the ground, so can be picked up and used

Building villages

This is the most important part of the tribe system. The tribe should be able to :

  • Keep a list of houses/buildings which can be created by the tribe
  • Keep a cost associated to the creation of each building and the resources needed
  • Have a function associated to each building, which can be just sleeping, or can be a forge to make items, or a well, to get water.
  • Be able to build and spawn houses/buildings in a predefined area
  • Keep a list of houses/buildings which are owned by the tribe
  • Use those buildings for their primary function

Building caves

Tribes should be able to dig the ground/walls and build caves. They can then use those areas to live and to hunt.

  • Keep a list of building blocks the tribe can use to create the dungeon
  • have an algorithm for creating a dungeon from the building blocks
  • know the cost in terms of resources
  • know the time needed to create each block
  • spawn one block or multiple blocks
  • (to be evaluated) collapse the geometry of multiple blocks to create a single piece for performance reasons. This requires some CS internals knowledge and we need CS help.

Development

Based on the current engine, the changes must take place in the NPC superclient. Sadly, having many tribes and complex actions would most probably put a higher load on the CPU. This issue shouldn't be addressed now though and will be discussed based on some benchmarks + unit-tests.

Operations

Operations are the base unit from which behaviors and ultimately, tribes, are built. The full list of operations is currently available on this page. The current operations set suffices for now but might be a subject to change if, while developing, we realize we can't make our actors do certain actions.

Behaviors

Described here, behaviors are the set of operations that governs the life of an npc. The only changes this expansion requires is to populate the xml files with more behaviors that correspond to types of tribes. (discussed more below, on Tribal Object)

Reactions

Reactions are certain world events triggered by npc perceptions. The before-mentioned list of perceptions is also a subject to change, based on the needs encountered. Besides the possibility of populating the perception list, there is no technical issue to be addressed on Reactions.

Needs

Tribal needs set the path tribe members have if no external factors intervene. Based on these needs, behaviors are assigned to tribe members upon creation. The current need list is very low-populated so more Needs / NeedSets will be added...

Current needs:

  • DeathRate
  • Generic
  • Reproduce
  • ResourceArea
  • ResourceRate
  • TimeOfDay

Treats

Treats are special features that a tribe has. Some tribes may be expansive, while some may be conservative. Some tribes may wage wars while some may try to establish peace with others. To handle these situations, the best solution is to have treats represented as TribeNeedSets, store them in xml format and assign them to tribe members upon creation.

Provisional list of treats:

  • conservative
  • expansionist
  • warlike
  • peaceful
  • advanced
  • primitive
  • diplomatic
  • barbarian

Example for the xml tree structure:

 <tribe name="Sumer">
   <needset name="expansionist" />
   <needset name="advanced" />
   <needset name="diplomatic" />
 </tribe>

Moods

Moods are a new thing regarding Planeshift and they will make tribe members quite unpredictable. The first step in this implementation will be to randomly assign a temperament to each NPC upon creation. The four temperaments are:

  • Sanguine
  • Choleric
  • Melancholic
  • Phlegmatic

(info on each one here)

Based on their temperament, npcs will receive a mood at the start of each day. The mood will alter their behaviors during the day by inserting certain actions. Things considered so far:

Mood Inserted operations to Behavior
Lazy Circle Operation, Sit Operation, Standup Operation, Wait Operation
Aggressive Melee Operation
Industrious ~no operation should be added, do as ordered~

(it's just a provisional table)

Temperaments will be described in an xml file by listing all moods and a chance (x%) for them to be chosen at the start of the day. Example:

 <temperament name="sanguine">
   <mood name="lazy" chance="10" />
   <mood name="industrious" chance="80" />
   <mood name="aggressive" chance="10" />
 </temperament>
 <temperament name="choleric">
   <mood name="lazy" chance="20" />
   <mood name="industrious" chance="60" />
   <mood name="aggressive" chance="20" />
 </temperament>

Moods will also be described in an xml file by listing all operations that should be inserted in the behavior.

Example:

 <mood name="lazy">
   <operation name="circle" repeat="3" />
   <operation name="sit" repeat="2" />
   <operation name="wait" repeat="4" />
 </mood>
 <mood name="aggressive">
   <operation name="melee" repeat="5" />
 </mood>