The database and the Intrigue Manager
Two things carry an Intrigues game. The database is what you write. The Intrigue Manager is the object that runs it.
The database is an asset
Section titled “The database is an asset”The database is one asset in your project. You make it with Create > MrW > Intrigues > Database, or with Create database on the Studio’s Home page, or Create Database… in the manager’s inspector while no database is assigned. It is data only and does not run.
You edit it in Intrigues Studio. One project can hold several databases, and the Studio shows one at a time. See Home.
What the database holds
Section titled “What the database holds”- Graphs. Your schemes, clans and families, and the nodes of each. Node groups, the frames that tidy a graph, are stored too, and nothing at run time reads them.
- Definitions. Variables, cultures, policies, roles, requirement sets and scheme categories.
- People. The actors of the Actors page, their looks, the age groups, the oldest age and the Full Name Format.
- Texts. Every text of the story, its languages, and the translations.
- World rules. Family rules, clan rules, the chronicle settings and the behaviour settings, which hold the dice seed and the calendar.
- Behaviour. Traits, formulas, decisions, opinions, kinds of memory and tie, ambitions, clan attitudes, budget plans and what clans start with.
- Portraits. The Sprite Database, with the tags of its pictures.
Your code reads these lists but must not change them, for example RequirementSetsReadOnly and DecisionsReadOnly. The running game works on its own copies.
The manager runs it
Section titled “The manager runs it”The Intrigue Manager is a component on one object in your scene, and a scene needs it, with a database assigned. If you write your own manager, derive it from IntrigueManager. A class that derives straight from IM is refused with an error.
The inspector header says Ready once a database and a Dialogue Manager are assigned, and Setup required until then. The Database field has the hover text The database that holds every scheme, requirement set, actor, clan, family and text. The Dialogue Manager field takes a prefab that the manager spawns at startup to show dialogues. With one assigned, the section also shows Default Style and Announcement Style.
While Setup is incomplete, the inspector says why. With no database it reads No database is assigned. Intrigues loads its schemes, actors and texts from it. and offers Create Database… and Assign Existing. With no Dialogue Manager it reads No Dialogue Manager prefab is assigned. The manager cannot start without it. and offers Use Default Prefab. The hover text of Ready is A database and a Dialogue Manager are assigned. The hover text of Setup required is Assign a database and a Dialogue Manager prefab before entering Play mode.
Below Setup are sections for scene actors and bodies, for localization while a database is assigned, and, in Play mode, a Runtime section that shows the player, the actors, the active schemes and the language.
What the manager does at start
Section titled “What the manager does at start”When the game starts, the manager reads the database and builds the world from it, in a fixed order: the dice seed, the behaviour rules, the methods of your scripts that graphs call, the texts, the variables, the cultures, the schemes, the policies, the roles, the family rules, the families, the clans and the Dialogue Manager.
The actors are not part of that list: each actor joins the world in its own Awake. See Actors.
After that, your code and your screens reach the world through the static class IM, for example IM.Actors, IM.Schemes and IM.Player.
One manager across scenes
Section titled “One manager across scenes”A game has one manager. At start it moves to the root of the scene, if it was a child, and it stays when another scene loads. A scene loaded later can bring its own manager, but the one that came first stays and the later one is removed.
If the later manager names another database, the game logs a warning that names both databases. The running manager and its database stay.
In the Editor, outside Play mode, nothing is removed. Two open scenes can each hold a manager, and Intrigues warns Two Intrigue Managers are open and uses the first one.
How it connects
Section titled “How it connects”- To set up a scene, see Set up your first scene.
- For the whole picture, see How Intrigues fits together.
- The manager can create objects for actors that have none: see Actors.
- The Studio opens from the manager’s Open Studio button. See First tour of the Studio.