Tuesday, May 17, 2011

Herds: NPC population tracker

Herds and nests are key components of the "life like" NPC system.

The herd is an invisible population tracker object.  It has the ability to show in the room, as traces or signs of the herd.  If a large herd of Muex are in the player's room, and he is observant enough, he might observe muex tracks, or even a herd of muex in the distance.  A herd, like a regular NPC, has a health rating, and when health is depleted the herd goes extinct and is removed.  Herds, unlike regular NPCs, do not feed themselves directly, but instead spawn minion NPCs to gather food and direct it back to the herd.

The herd can monitor player activity in the room, and when appropriate (eg when hunted by a player or predator) will spawn an NPC based on the species members of the herd.

There are multiple types of herd deriving from the base herd.  The first is a sedentary herd, eg domesticated animals that do not wander.

The second is a nest building herd - this herd will wander until it finds an appropriate location for a nest, and then build one (by spawning an NPC with instructions to do so).  Once the nest is built, the herd will move into the nest and react from inside.

The third is a sentient herd, such as a group of humans with a purpose, like a squad of rangers or explorers.  These herds have a purpose to fufill and will act until the purpose is achieved or the herd is destroyed.