AI Relations (Editing)

From The DarkMod Wiki
Revision as of 13:48, 13 September 2006 by Greebo (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Originally written by Ishtvan on http://forums.thedarkmod.com/topic/1636

Inputting Team Relationship Info in the Editor

  1. Add all the AI you're going to add, sort out what teams you want each to be on, setting the "team" key to the appropriate integer value on the AI entities. (eg, team 0 = player, team 1 = indoor guards/servants, team 2 = city guards, team 3 = city civilians, team 4 = undead )
  2. Define the relationship matrix on the Worldspawn. (To edit the worldspawn, select a wall and hit "n". That should bring up the key/value pairs on the worldspawn.)

To define the relationship matrix, add keys and values in the following way:

key: "rel 0,1" value: "1"

That means team 0's relationship with team 1 has the value 1. (Positive values ar e friendly, negative values are enemy, 0 is neutral.)

If you have say 3 teams, you have to set at least the "upper triangle" of the matrix. If an element in the lower triangle is not found, it assumes it is the same as the upper traingle (ie, if you only supply 0,1 , 1,0 is assumed to be the same - symmetric relations).

If you do not supply a value for the diagonal relationship (0,0 or 1,1), a default value is used. Right now I set this default to "5", but that can of course change.

What I mean by upper and lower triangle is: 0,1 1,2 etc are part of the upper triangle (column > row), 1,0 2,1 are part of the lower triangle (row > column). So you have to put in 0,1 but if you want 1,0 to be the same, you don't have to put it in. (ie, team 1's relationship with team 0 is the same as team 0's relationship with team 1, if you don't specifically put in a different value for 1,0 than you put in for 0,1)

Why set the diagonals?

It might seem weird to define a team's relationship with itself by setting "rel 1,1" to something, but later on we might want to have a "rogue team," like beasts that attack everyone, even other members of the "beast" team (eg, a cannibalistic predator or something). Also, the teams' relationship with itself can be thought of as "morale," and we can maybe check this number to see how likely they are to come to each other's aid in combat and stuff like that.

Just to emphasize, you don't HAVE to set the diagonals, they will be set to some default value (5) if you don't. If you want team X "every man for himself" and attack its own members, set "rel X,X" to a negative value.

If no relationship matrix is present, or if the mapper makes an error when inputting it and you see a "[AI Relations] logical error..." or "[AI Relations] Syntax error..." message when you play the map: A value of -1 will always be returned by relationship matrix checks, meaning all AI are enemies. (this slightly screws up existing D3 maps if they have no relationship matrix, since some AI are enemies that aren't supposed to be. I'm still working on fixing that)