Entity classifications

Sam edited this page Apr 8, 2017 · 3 revisions

HLEnhanced comes with an upgraded entity classification system. Whereas the old system used hardcoded constants to identify classes and establish relationships between classes, the new system is designed to give complete control to the mapper.

Description

The entity classification system provides mappers with the means to define which classes are available, what their defaults relationships to and from other classes are, and which explicit relationships are established between classes.

Relationship

Classifications can have relationships between each-other. The following relationships are available:

Relationship Description
R_AL (ALLY) pals. Good alternative to R_NO when applicable.
R_FR (FEAR) will run.
R_NO (NO RELATIONSHIP) disregard.
R_DL (DISLIKE) will attack.
R_HT (HATE) will attack this character instead of any visible DISLIKEd characters.
R_NM (NEMESIS) A monster Will ALWAYS attack its nemesis, no matter what.

Classification

A classification is a way for entities to identify which group they belong to. For example, all HECU entities use HUMAN_MILITARY to identify themselves as allies, and to identify scientists and security guards, who are HUMAN_PASSIVE, as enemies.

A classification is identified by its name, and has settings that can be changed:

Setting Description
Default source relationship The default relationship from one classification to another. If no relationship is defined between a classification and its target, this relationship will be implied. Defaults to R_NO.
Default target relationship The default relationship from the target classification to a source classification. This lets a classification define a default response to itself, sort of like an aura of effect that overrides the default source relationship. If not specified, this will have no effect.

Alias

Classifications can also be aliased to remap one to another. Useful when a classification is removed so it can adopt anothers' behavior.

Reset

The classification system can be reset to wipe all existing classifications and relationships. This allows one to rebuild the classifications and their relationships from the ground up.

When reset, only the default NONE classification will be defined, with a default relationship of R_NO.

Map configuration syntax

Classes and relationships can be defined using the map configuration file.

All options are defined within the entity_classifications section, inside the main config section.

reset keyvalue

The reset keyvalue can be used to reset the classification system. When set to 1, a reset will be performed prior to classification processing.

class keyvalue/section

This can be either a keyvalue or a section. In keyvalue form, all settings will be their default values, and optional settings will not be defined.

In section form, the following settings are available:

Setting Description
name Name of this classification. Required.
defaultSourceRelationship The default source relationship.
defaultTargetRelationship The default target relationship. Optional.

See the description for classes above for more information about the settings and their default values.

alias section

The alias section defines an alias.

The following settings are available:

Setting Description
source Name of the alias.
target Name of the classification to map to.

relationship section

The relationship section defines an alias.

The following settings are available:

Setting Description
source Name of the classification that the relationship is from.
target Name of the classification to check the relationship with.
relationship Relationship type. See [[Relationship
biDirectional Whether this relationship should be established between target and source as well. Set to 1 to enable.

Level design features

All monsters have a keyvalue called "Classification Override" that lets you specify which classification that monster should use. This keyvalue can be used on any other entity as well, but is only defined for monsters at this time.

monstermaker has a keyvalue that lets you specify the override for the monster it spawns.

CVars

entityclassifications_writetofile

This command will output a matrix of all classifications and their relationships with each-other to a text file. The name of the text file is provided as input, and includes the extension. This file will be created in hlenhanced/.

The file will contain the number of classes on the first line, the matrix following it, and the number of aliases and mappings of aliases to classifications.

C++ API

When modifying the classification of an entity, all one has to do is override EntityClassification_t GetClassification() and return the Id of the classification. Typically this is done by calling EntityClassifications().GetClassificationId( "my entity classification" ). The default classifications used by entities are defined in the classify namespace.

Determining the classification of an entity is done using the EntityClassification_t Classify() method.

Notes

  • In multiplayer, player info is shown if a player has the same classification as the player looking at them, and if the player looking at them does not have the NONE classification. If you wish to remove all classes, you must still define PLAYER for this information to display. (The NONE classification disables this information due to all world objects using that classification)
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.