View Source DevJoy.Character behaviour (DevJoy v1.1.0)
A character is an NPC acting in a game.
Data module
A data module is supposed to fetch character basic information like avatar and full name
which could be entered in your code or fetched from some API or site.
Such module needs to implement get_character/1
callback.
config :dev_joy, DevJoy.Character, data_module: MyApp.DataModule
Extra module
An extra module is supposed to fetch character extra information stored in data field
which could be entered in your code or fetched from some API or site.
Such module needs to implement get_character_data/1
callback.
config :dev_joy, DevJoy.Character, extra_module: MyApp.ExtraModule
Fetching data
All data is fetched at compile time for every dialog and question. It's recommended to cache all external data in order to avoid long compilation time.
Summary
Types
External url or ralative path within project
Additional data
Full name
Identifier
Character struct
Callbacks
Retrieves information about a character using it's id.
Retrieves information about a character using it's id.
Functions
Gets a data and extra module from configuration. Using a data module it retrieves information about a character using their id. Using an extra module it retrieves additional data for a character using their id.
Types
Callbacks
@callback get_character(id()) :: DevJoy.Scene.struct_fields()
Retrieves information about a character using it's id.
Retrieves information about a character using it's id.
Functions
Gets a data and extra module from configuration. Using a data module it retrieves information about a character using their id. Using an extra module it retrieves additional data for a character using their id.