Wednesday, July 20, 2011

Exerting Control

One of the key facets of Notorious will be the ability to exert control over the various NPCs in the game. This could be mercenaries hired to guard your dungeon, or to dig it out, or even heroes attempting to raid someone else's dungeon. Here's the new section on how I plan to have the player influence their actions.

Exert control
- Mercenaries and heroes wearing focus amulets can be controlled, or grant vision, communication, etc. by applying your power through the linked focus gem.

- Gem size allows a maximum amount of power to be channeled through to it. Overloading the power level of a gem increases the chance of destroying the gem.

- Spell power modified by the distance to the home stone. Travelling through rock increases power cost, so that there is a risk / reward for exposing your home stone for greater power, or hiding it for greater security (especially from unlinking). Power investment set at time of change, so there is a benefit to bringing the mercenary close to your home stone before setting up their new default behaviour.

- Linked gem spells

Vision: grants vision from the gem’s location. Flat fee, relatively inexpensive so that it can work on heroes a long way away exploring other dungeons.

Communication: Talk directly to the mind of the person/monster holding it. Flat fee, relatively inexpensive so that primary minion and informants can use it to carry out most menu interactions (checking prices, buying selling, rumours, etc). Raises suspicion if used on heroes.

Control: Attempt to influence the bearer to take a certain action. Power required is variable and competes with the bearer’s own priorities. Needs linking into the AI system to give options of (go to location, attack, capture, flee, search, rest, dig, build, give, take, etc). Control is either sustained until the player removes the power investment (default), or placed as a once-off so that the power is immediately returned once the specified action is completed.

Cloaking: Attempt to hide the presence of a gem from attuned people / players. Variable power required and competes with the opponent’s detection power.
Mimic: Attempt to make it appear that someone else is linked to the gem.

- General spells

Link to gem: Create a link to a gem to allow powers to operate through it. Maintaining a link to a gem increases exponentially depending on how many other gems you have linked to. Should be possible for beginning players to have 2-4, medium players to have 6-8 and end game players to have up to 10.

Detection: Attempt to detect gems in your vicinity. Competes with cloaking (ground may also cloak gems). May choose a level to be used constantly which will add detection of other players attempting to scout / raid your dungeon.

Trace link: Attempt to find out who has a link to to a gem. Competes with Mimic power level to reveal all players / mimics currently linked.

Artificial Intelligence

Exerting control will be dependent on modifying the behaviour of the Mercenaries under your control, so it will be fairly important to design an AI system that is robust enough to allow independent emergent behaviour, but make sense enough that players can interact with the system in a meaningful way.

Actions and Needs
Each NPC will have a list of needs that change over time (the need for happiness, riches, sleep, food, chaos, etc). These needs will lead to actions fulfilling that need such as sleeping, fighting, etc. Each action that the AI can make is given a weighting depending on the expected need reduction that the action will take, then organised into a priority list of highest to lowest need reduction. The highest action is the one that is executed until the need is satisfied enough that the action is no longer the highest (plus an additional ‘resistance to change’ amount to keep them from always swapping from one task to the next and losing time on travelling).

Exerting Control
The player can interact with the Actions by placing more or less emphasis on that action by spending power points. This can be used to raise non-desirable actions (such as digging) into top priority, or to remove NPC actions that are not contributing to the player’s expectations (such as relaxing). Since the actions are given inputs from the need system there will be no way to completely stop a mandatory action (such as sleeping or eating) but they can be suppressed so that other action can take precedence for longer periods.

This is a list of needs and a brief description of how they will be expected to change over time.
Sleep - ramps up on an exponential scale
Eat - Ramps up on an exponential scale
Chaos - Slowly increases over time depending on their desire for chaos.
Safety - Usually 0. Increases when enemy is in sight, and ramps up depending on their assessment of a battle. Should be maxxed if they think the next round will kill them.
  • Owning space gives a set amount of happiness per hour depending on the mercenary’s desire for space.
  • Owning items gives a set amount of happiness per hour depending on the mercenary’s desire for that type of item. May be too complex an interface for little reward. Might simply make a ‘desirable item’ shortlist akin to dwarf fortress preferences and mainly include useable weapons.
  • Increasing Riches gives a one-time boost to happiness depending on the desire for riches. This may be triggered by getting %loot from kills, or by regular negotiated payments. Happiness gain indirectly proportional to their current wealth.
  • Doing Work drops happiness depending on their desire for the task done (Guarding, Digging, Building, Set traps, etc)
  • Faction likes/dislikes can influence happiness when they see mercenaries or heroes of an opposing faction. Can be used to introduce incompatible mercenary mixes such as dark dwarves and dark elves, Ors and goblins, etc, or encourage hiring similar types of mercenaries (or keep them VERY separated)

This is a list of actions and the needs that they fulfil
Eat - Attempts to go to home or designated dining hall and eats. Should drop hunger to 0 in a couple of turns.

Sleep - Returns home or to a designated barracks and sleeps. Should drop need for sleep AFTER waking (~5 turns?), so if they are sleeping they will still be unsatisfied if another action takes priority (an attack occurs threatening safety)

Guard location - Attempt to go to a location and remain alert. Generates unhappiness depending on desire for guarding. Player needs to exert control for this action to be considered. Elevates attack options once location is reached. Can also be used to suppress prisoners if guarding an prison area.

Patrol between locations - Attempt to walk between multiple locations and remain alert. Generates unhappiness depending on desire for guarding. Player needs to exert control for this action to be considered. Can also be used to suppress prisoners if guarding an prison area.

Defend Home - Return home and guard. Increases priority if enemy in home. Increases priority if personal safety is at risk. Increases priority depending on mercenary wealth. Decreases happiness depending on desire for guarding, but not as much as guarding location (1/4?)

Attack Character - Attacks the designated character. Can be elevated into priority by sighting someone when guarding, or to a lesser extent sighting an enemy when doing another task. Use aggression attribute? Decreases Chaos need. Increases safety need (indirectly proportionally to aggression?)
This action will be replaced by modes of attack such as:
  • Attack character with melee weapons
  • Attack character with ranged weapons
  • Attack character with ability X
Attack toward location - Move to location with very highly elevated attack character action pending. If any enemy is in sight, attack nearest. Player needs to exert control for this action to be considered.

Hide for Ambush at location - Move to location and wait for adjacent enemy before initiating an attack. Generates unhappiness depending on desire for guarding/ambush.

Flee - Generic flee action that will attempt to run away from the source of the damage. May lead to mercenary getting caught or corralled into a corner. Increases priority with Safety need and escalates so that it should be top priority if they perceive that they will die next turn. Reduces with reduction in safety concerns (no-one hitting them last turn, no-one in sight, health above 50%, etc.)

Flee to location - Uses flee mechanic, but has a specific location that they will attempt to get to rather than simply going away from the battle. Will usually be lower than Flee itself, but offers the player a way to exert control over where the mercenary should retreat to. A* to location needed as a weight against this action, especially if it takes them through the battle. I’d anticipate that building small hides and a fairly large sustained investment into this action will keep most mercenaries alive, even through wipes.

Go to location - Basic movement. Most actions will incorporate this action into their own, so this one is specifically designed for players to dictate a location change (say, going to the throne room for further instructions). Most likely used as a once-off power placement. Little to no interaction from needs. Possibly generate unhappiness at same rate as transporting goods.

Dig Nearest - Assign character to continually dig out designated areas. Decreases happiness depending on desire for mining. Player needs to exert control for this action to be considered. Digging skill increases digging speed.

Dig Location - Assign character to dig out a specific location rather than digging any designated area. Decreases happiness depending on desire for mining. Player needs to exert control for this action to be considered. Digging skill increases digging speed.

Mine nearest Gold - Phase 2 of digging that separates extracting gold from deposits rather than simply digging anything. Designated area produces a large quantity of gold before disappearing rather than being mined out quickly like any other rock. Digging skill increases quantity of gold mined.

Mine Gold at location - As above, but with a specific location designated.

Extract nearest Gems - Phase 2 of digging that separates extracting gems, rather than simply digging anything. Designated area will eventually produce a large gem capable of channeling power, along with potential minor gems for throwaway use (on heroes). Digging skill increases chance that gems retain their maximum size.

Extract Gems at location - As above, but with a specific location designated.

Build Wall - Construct a wall following the designated tiles. Need to also remove ownership of tile, or reduce their potential to provide happiness. Decreases happiness depending on desire for building. Player needs to exert control for this action to be considered.

Build Trap - Construct a trap at specified location. Need to reduce the potential of the tile to provide happiness to owner. Decreases happiness depending on desire for building. Player needs to exert control for this action to be considered. Trap skill increases the level of the trap set (to compare against hero detection / disarming skill)

Manufacture item X - Phase 2. Construct an item using materials. Priority increases with availability of resources and desire to construct. Decreases happiness depending on desire for manufacture. Some mercenary types (or captured blacksmiths) may spontaneously attempt this, but will be predominantly player driven.

Transport item to location - Move an item from its current position to another. Most likely triggered by heroes dropping loot. Can be used by player to reorganise gems and equipment use. Decreases happiness depending on desire for transporting.

Relax - Returns to home and slowly generates happiness. More or less a default action for unhappy mercenaries. More than likely this one will be reduced, or other actions that gain happiness increased for more efficient happiness management.

Raid village - Should have a number of options under this one for each type of raid (raid for items / money, Capture prisoners, Cause chaos). Priority changed by chaos, security, unhappiness. Successful raids reduce chaos and increase happiness.

Capture character - Make into prisoner. Can be used against raiding heroes, or against town.

Raid dungeon - Send them out against another player.

Pick a fight - Increases with Chaos and presence of opposing factions.

Revolt - Severe unhappiness for an extended duration. Usually means that space / money / items are not sufficient to keep the character under control. Will attempt to leave the dungeon. May also be used for prisoners who feel that potentially dying on their way to the front door is better than continuing on.

Get Payment - Go to vault and attempt to extract any outstanding payment. Priority increases with unhappiness. Successful payment increases happiness by an amount dependent on the character’s current wealth. Failure to retrieve payment decreases happiness further, but also dampens this type of happiness gathering for a moderate period so that they may try other avenues of gaining happiness (like relaxing)

Take ownership of location - Increases the space owned by the character. This may be available under severe unhappiness, but will be mainly used by the player to increase the happiness regeneration flowing from the character’s increased levels, or increased wealth.

Take ownership of item - Marks the item as now belonging to the character. Triggered by loot drops when %loot contracts are used. Can also be used to forcibly transfer someone else’s item to this creature, with appropriate anger from victim. Can be used by the player to give new weapons or gems from the vault.

Give ownership of location to character - Remove ownership of space and transfer it to another character. Creature competing the transfer will be angry on the loss of space, but not as angry as if it’s been taken from him. Very unlikely to be triggered naturally, but gives a way for the player to adjust their mercenary structure.

Give ownership of item to character - As above, but utilising item in the creature’s posession.

Sign new contract - Demand a new contract be signed. Priority increased through consistent unhappiness or multiple gains of levels. One step before revolting, and possibly linked to an email out to the player. Can also be triggered by the player to negotiate different payment methods (most likely with a once-off power payment)

(Mainly) Hero Specific:
  • Escort Prisoner - Attempt to move with the prisoner to the entrance. If they make it they are credited with rescuing that prisoner.
  • Disarm Trap - Apply disarming skill to any detected trap. Priority increases significantly when a trap is near and known. Ramps up with expectation of successful disarming.
  • Search for secret doors / traps - Apply searching skill rather than moving on quickly. Priority increased with searching skill and hero aggressiveness.