Cross-Forge Integration
Simple Quest Forge integrates with three optional companion packages via reflection bridges. All integrations are fully automatic — install a companion package into your project and dropdown menus, code pickers, and additional features appear instantly. Remove a companion package and everything still compiles with zero errors. Your data is always preserved.
This page explains how the bridge system works, what each companion package adds, and the complete lifecycle of installing, using, removing, and reinstalling companion packages.
Overview
Simple Quest Forge has 4 bridge classes, each detecting a different companion package:
| Bridge | Companion | Status | What It Adds |
|---|---|---|---|
| SEFBridge | Simple Enemy Forge | Active | Enemy, faction, and squad code dropdowns for objectives and rewards |
| SIFBridge | Simple Item Forge | Active | Item and loot table code dropdowns, loot table SO references on quests |
| SAFBridge | Simple Attribute Forge | Active | Attribute name dropdowns for prerequisites/rewards, modifier SO drag-drop |
| SDFBridge | Simple Dialogue Forge | Stub (future) | Reserved for future dialogue node integration |
How Bridges Work
Each bridge class uses Type.GetType() to probe for companion types at editor load
time. This is pure reflection — no conditional compilation (#if), no hard
assembly references, no using directives pointing to companion namespaces. The
bridge either finds the companion type or it doesn't, and gracefully handles both cases.
This pattern has several important properties:
No Hard Dependencies
SQF compiles fine without SEF, SIF, or SAF installed. There are no using SimpleEnemyForge;
directives anywhere in the SQF codebase. The bridge only references companion types by
assembly-qualified string names via reflection.
Automatic Detection
Bridges detect companion packages immediately when they are imported into the project. No manual setup, no scripting defines to toggle, no configuration files to edit.
Graceful Fallback
When a companion is not installed, IsAvailable returns false and
all bridge methods return empty arrays or null. The wizard UI gracefully falls back to plain
text input fields instead of dropdown menus.
Generated Editors Auto-Adapt
The generated custom editors also use runtime Type.GetType() checks. When you
install or remove a companion package, the Inspector automatically switches between typed
ObjectFields and generic ScriptableObject fields — without regenerating.
SEFBridge (Simple Enemy Forge)
Bridges to Simple Enemy Forge for enemy, faction, and squad data. SEF provides 7 interconnected forge wizards, and SQF can link to 3 of its database types.
| Feature | Interface | Use in SQF | Example |
|---|---|---|---|
| Enemy codes | ISimpleEnemyDataSource |
Kill objective targetCode dropdowns | GOBLIN_WARRIOR, ELDER_DRAGON, FOREST_WOLF |
| Faction codes | ISimpleFactionDataSource |
Reputation reward targetCode dropdowns | THIEVES_GUILD, ROYAL_GUARD, MERCHANT_ALLIANCE |
| Squad codes | ISimpleSquadDataSource |
Group objective targetCode dropdowns | GOBLIN_PATROL, BOSS_AND_MINIONS, BANDIT_CAMP |
Assembly: SimpleEnemyForge.Runtime
What Changes in the Wizard
When SEF is detected, the following UI elements appear:
- Step 1: "Enemy Databases", "Faction Databases", and "Squad Databases" ReorderableList sections appear with drag-and-drop zones. Link your SEF-generated databases here.
- Step 3: The smart target code picker (dropdown button next to any targetCode field) shows enemy, faction, and squad codes in categorized sections.
When SEF is not installed, these sections are replaced with a simple message: "Simple Enemy Forge not installed. Enemy and faction database linking unavailable." You can still type target codes manually as plain text.
SIFBridge (Simple Item Forge)
Bridges to Simple Item Forge for item and loot table data.
| Feature | Interface | Use in SQF | Example |
|---|---|---|---|
| Item codes | ISimpleItemDataSource |
Collect objective and item reward targetCode dropdowns | SILVER_PENDANT, HEALTH_POTION, IRON_SWORD |
| Loot table codes | ISimpleLootDataSource |
Loot reward targetCode dropdowns, loot table SO references | BOSS_LOOT_TABLE, DUNGEON_CHEST, RARE_DROP_TABLE |
Assembly: SimpleItemForge.Runtime
What Changes in the Wizard
- Step 1: "Item Databases" and "Loot Databases" ReorderableList sections appear with drag-and-drop zones.
- Step 3: The smart target code picker shows item codes and loot table codes in dedicated sections. A "Loot Table" section also appears on each quest with a dropdown to select a loot table code and an ObjectField to reference the loot database SO directly.
Loot Table Integration
Each SimpleQuestDefinition has two loot-related fields:
lootTableCode(string) — The code identifying which loot table this quest rewardslootTable(ScriptableObject) — A direct reference to the SIF loot database SO
When SIF is installed, the wizard shows a dropdown of available loot table codes and automatically
resolves the SO reference. When SIF is removed, the lootTableCode string survives
(data preservation) and the SO reference becomes null. Reinstalling SIF restores the dropdown.
SAFBridge (Simple Attribute Forge)
Bridges to Simple Attribute Forge for attribute data and modifier assets. This is a dual-assembly bridge that probes two separate systems independently:
| Feature | Assembly | Detection Flag | Use in SQF |
|---|---|---|---|
| Attribute names | SimpleAttributeForge.Runtime |
HasAttributes |
Prerequisite targetCode dropdowns (e.g., "STR >= 20"), reward targetCode (e.g., "Grant +10 DEX") |
| Modifier assets | SimpleModifierSystem.Runtime |
HasModifiers |
Modifier ScriptableObject drag-drop ObjectFields as quest rewards |
Dual Detection
The SAFBridge has two separate availability flags because the attribute system and modifier system live in different assemblies:
SAFBridge.HasAttributes— true whenISimpleAttributeDataSourceis found in theSimpleAttributeForge.RuntimeassemblySAFBridge.HasModifiers— true whenSimpleModifierAssetBaseis found in theSimpleModifierSystem.RuntimeassemblySAFBridge.IsAvailable— true when either system is detected
This means you can have just the attribute system, just the modifier system, or both. The wizard adapts its UI based on which components are available.
What Changes in the Wizard
- Step 1: When
HasAttributesis true, an "Attribute Databases" ReorderableList appears for linking SAF attribute databases. WhenHasModifiersis true, a "Modifier Assets" section appears with drag-and-drop ObjectField slots. - Step 3: When attributes are available, the target code picker shows attribute names in a dedicated section. When modifiers are available, each quest shows a Modifiers section with ObjectField slots for assigning modifier ScriptableObject assets as quest rewards.
SDFBridge (Simple Dialogue Forge)
A stub bridge reserved for future integration with Simple Dialogue Forge. The
bridge class exists and follows the same reflection pattern, but currently
SDFBridge.IsAvailable always returns false because Simple Dialogue Forge
has not yet been released.
When SDF ships, this bridge will provide dialogue node linking for quest conversation triggers, quest-giver dialogue trees, completion dialogues, and branching narrative integration.
Safe Round-Trip Lifecycle
All integrations are designed for zero-error round-trips. You can freely install and remove companion packages at any point in your project's lifecycle without breaking anything. Here is the complete lifecycle:
Import SEF, SIF, or SAF into your Unity project via the Package Manager. The bridge detects it automatically during the next domain reload. Dropdown menus and database linking sections appear in the wizard.
Link your companion databases in Step 1 of the wizard. Use the smart target code picker in Step 3 to select enemy codes, item codes, attribute names, etc. Assign modifier assets and loot table references.
Click Generate. Your quest database is created with all target codes stored as plain strings and SO references stored as ScriptableObject fields. The generated custom editor uses runtime
Type.GetType() checks to display typed ObjectFields when companions are available.
Delete the companion package from your project. Result: zero compilation errors. Target code strings are preserved (e.g., "GOBLIN_WARRIOR" is just a string). SO references become null (Unity can't reference types that no longer exist). The wizard shows "not installed" messages where dropdown sections used to be.
Import the companion package again. The bridge re-detects it. Dropdown menus reappear. Target code strings are still intact — they never changed because they're just strings. SO references may need to be re-assigned by regenerating from the wizard.
Linking Databases in Wizards
All database linking happens in Step 1 (Setup) of each wizard. Each database type has its own ReorderableList that supports:
- Multiple databases — Link as many databases of each type as needed
- Drag-and-drop zones — Drop database assets directly onto the drop zone for quick bulk adding
- Reordering — Drag entries within the list to change priority
- Validation — Invalid databases (wrong interface type) are rejected with a dialog explaining what interface is required
The merge logic uses first-DB-wins for duplicate codes. If two enemy databases both contain a "GOBLIN" code, the first database in the list provides the data.
All three wizards (Quest Forge, Quest Chain Forge, Procedural Quest Forge) support the same database linking system. The linked databases determine what codes appear in dropdown menus throughout the wizard.
Smart Target Code Picker
In Step 3 of the Quest Forge wizard, every targetCode field (on objectives, rewards,
and prerequisites) has a small dropdown button next to it. Clicking this button opens a
categorized GenericMenu that aggregates all codes from all linked databases:
This picker is context-aware — it shows all available codes regardless of which bridge they come from. For example, a kill objective's targetCode typically comes from the Enemies section, while a reward's targetCode might come from Items or Attributes.
If no companion packages are installed, the dropdown button is hidden and you type target codes as plain text. You can always type manually even when the picker is available.
Schema Cross-References
When you export a schema (Full JSON or Markdown) from Step 2, the export includes cross-reference
data from all linked databases. This data appears as arrays of {code, name} pairs
(called SchemaLinkedEntry internally):
This cross-reference data serves two purposes:
- AI guidance — The AI model knows which enemy/item/faction codes are valid and can reference them correctly in generated quests
- Import validation — When importing AI-generated quests, target codes are checked against the linked database codes for warnings
Integration FAQ
Do I need companion packages to use SQF?
No. SQF is 100% functional standalone. Companion packages add convenience features (dropdown menus, code pickers, SO references) but are entirely optional. You can always type target codes as plain text strings.
What happens to my data when I remove a companion package?
Target code strings (like "GOBLIN_WARRIOR") are preserved because they are plain strings. ScriptableObject references (loot table, modifiers) become null because Unity cannot reference types that no longer exist. The wizard shows "not installed" messages instead of dropdown sections. Your project compiles with zero errors.
Do I need to regenerate after installing/removing a companion?
No. The generated custom editors use runtime Type.GetType() checks and auto-adapt
without regeneration. When SAF is installed, modifier ObjectFields show the correct type filter;
when SAF is removed, they show generic ScriptableObject fields. This happens automatically.
Can I link databases from multiple companion packages at the same time?
Yes. You can link enemy databases (SEF), item databases (SIF), and attribute databases (SAF) all at the same time. The smart target code picker aggregates codes from all bridges.
What if two databases have the same code?
The first-DB-wins rule applies within each database type. If two enemy databases both have "GOBLIN", the first enemy database in the list provides the data. Codes across different database types are independent (an enemy code "WARRIOR" and an item code "WARRIOR" don't conflict).