Scriptable Object Overview

The AnyRPG Engine makes heavy use of Unity Scriptable Objects to allow as much configuration of games as possible without requiring changes to the engine code.

The following items can be configured with Scriptable Objects:

  • Ability Effects
  • Abilities
  • Animation Profiles
  • Currencies
  • Dialogs
  • Factions
  • Items/Equipment/Weapons
  • Quests
  • Recipes
  • Cutscenes/Scenes/Levels
  • Trade/Gathering Skills

Ability Effects

Abilities

Animation Profiles

Currencies

Dialogs

Factions

Items/Equipment/Weapons

Quests

Recipes

Cutscenes/Scenes/Levels

Trade/Gathering Skills

Class Relationship Diagrams

Ability System

The ability system is separated into 2 parts: abilities and ability effects.

Abilities are relatively simple and are mostly responsible for determining when an effect is able to be cast.

Effects are the part of the system that are responsible for performing actions, and can call other effects to chain together pieces of functionality and build complex spells from simple components.

Both abilities and ability effects make heavy use of class inheritance to maximize the re-use of common code and minimize any code duplication to ensure predictable and reliable behavior when chaining effects together to build spells and abilities.

Abilities

Abilities have 3 basic ways to determine when it is time to cast an effect:

  1. Event based abilities are triggered by events in animations, and can be triggered multiple times by the same animation if that animation has multiple events configured.
  2. Instant abilities cast their effect right away, and in the cast of channeled abilities, instantly on each tick of the channel.
  3. Complete abilities cannot cast their effect until a cast reaches the end of its cast timer and completes successfully.
Ability Class Inheritance Model

Ability Effects

Ability Effects are separated into small pieces of related functionality, and can be chained together like building blocks to build up quite complex spells. The 3 main groups of functionality are:

  1. Attached effects are tracked by the CharacterStats class on the actual character, have a length that can be extended or refreshed, and are capable of both directly affecting a character’s stats, and performing additional effects over their lifetime.
  2. Targeting and timing effects are responsible for deciding when and where to trigger additional effects. They may choose valid targets from a group of targets, direct the motion of physical prefabs, and determine how long spell effects remain in the game before they are destroyed. They cannot perform any direct action on a character, but can call any other effect, including effects which can perform actions on characters.
  3. Action effects perform actions on characters. Current action capabilities include resurrection, teleportation, healing, and damage dealing.
AbilityEffect Class Inheritance Model