Skip to content

Characters

Shi Johnson-Bey edited this page Mar 6, 2024 · 2 revisions

Configuring Characters in Anansi

All character data (sprites, relationships, traits, schedules, ...) must be specified within the Unity editor. This page explains different aspects of character configuration.

Character Identifiers

Characters have two identifiers: their display name and their UID. The display name is what is presented in the GUI when the character speaks. It is how the character is referred to in dialogue. The display name does not need to be unique, and you're free to use any spaces or punctuation. Conversely, a character's UID must be unique to the character. The UID may not contain any spaces, numbers, or punctuation (except for underscores _). By convention, the UID is all lowercase. Anansi uses a character's UID to reference them within the story database and storylet queries.

Character Traits and Stats

Character traits and stats are handled by the AgentController component from TDRS. This component syncs with the story database to make traits and stats available for storylet queries, social events, and schedules. This is where you want to specify any traits that a character should have that might represent things about their personality or social status within the game world. [TDRS's Wiki] has explanations of how to setup this portion of data.

Character Social Relationships

This information is also handled by TDRS, and you should visit the TDRS wiki for more help on configuring relationships. By convention, relationships are made as child GameObjects of the character that owns the relationship. Configuring initial relationships is an important part of specifying the social dynamics of the story world and, subsequently, what content might be available.

Character Sprites

Anansi allows you to create sprites that can change expression based on tags provided in their dialogue. By default, Anansi supports animated and static sprite images. The StaticSpriteController and AnimatatedSpriteController components allow users to associate sprite images or animations with a collection of tags. When the story needs to change a character's expression it will ask the spite controller for content that fits the tags. Users can also specify a fallback expression in the case that none is found.

If the built-in sprite controllers do not work for your setup, you can create a new MonoBehaviour that inherits from SpriteController to support your needs.

Character Schedules

Warning

The schedule API will be updated soon. The current implementation is a proof of concept and will be simplified to use RePraxis queries like storylets.

Schedules dictate where NPCs should be at a given time of day. They help characters feel more alive and add to the sense of simulation. Schedules are run automatically at the beginning of the game and when time advances in the game.

Each schedule is comprised of one or more schedule entries, where each entry specifies a location and time of day. Characters can have one or more schedules, and their final location is chosen based on which schedule has the highest priority. Additionally, you can specify preconditions that must hold true for a schedule to be used. Preconditions and priorities should provide you with enough tools to layer moderately complex schedules. Out of the box, Anasi supports editing characters' schedules within the Unity inspector or specified using YAML/JSON.