Skip to content

Doorways Internals

Nicolas Suarez edited this page Nov 7, 2022 · 3 revisions

This page details how Doorways works internally, and does not document its API. This page will generally only be useful if you're looking to hack on Doorways' source code. If you're looking for documentation on using Doorways to make a mod, check out the Doorways DLL Modding Documentation page.

Categorization

Doorways' codebase is deliberately laid out in a way that provides a high degree of separation between public, internal, and patch components. Public components will only be able to leverage functionality defined by Doorways Internals, and direct game engine patch calls will not be possible.

DoorwaysFramework

The root namespace, DoorwaysFramework, contains all the user-facing code that DLL Mod authors may make use of in their mods. This means it's mainly going to be co-ordination code and glue to the Internals namespace, with little actual computation performed.

This module contains APIs that allow mods to easily affect gameplay, such as checkpoints, multiple tables, alternate manses and new mansus portals, et cetera.

DoorwaysFramework.UI

This module is a public-facing API that allows mod authors to add, remove, and modify core engine UI components. It provides frameworks to allow for easy instantiation of common visual game elements as well as menu item modifications.

DoorwaysFramework.Entities

This module is a public-facing API that allows mod authors to manipulate game entities such as Cards, Recipes, Verbs, Endings, Legacies, etc. It also provides a framework for defining custom entity types that can be defined and loaded from non-DLL mod JSON, as well as extension types which inherit and extend existing types rather than acting as new types.

This is also the framework where the Dynamic Entities API is defined, which allows game entities to resolve their fields at runtime in either a per-instance or per-query fashion.

DoorwaysFramework.Events

This module is a public-facing API that allows safe access to events which are raised whenever certain game events happen.

DoorwaysFramework.Internals

The Internals sub-namespace is, predictably, marked internal which means only code defined in the Doorways assembly will be able to access it. This is intentional, because the code in this module is intended to form the building blocks for Doorways' functionality, not its forward-facing mechanisms.

DoorwaysFramework.Internals.Loader

The Internals.Loader sub-namespace intercepts and manages content loading for non-DLL doorways mods. It implements JSON support for all compatible Doorways DLL modding features, and allows for other mod file formats such as HJSON and C# (non-compiled).

DoorwaysFramework.Internals.Patches

The Patches module is the one and only place where Harmony patches are allowed to be defined. Patch functions must not only be defined exclusively in this class, but any access to their effects must be wrapped in an API which enforces the invariants expected by both the patch and the targeted game engine components.