A browser-based creation tool for building custom AIfrits Artifacts NPC profiles, dialogue trees, trading behavior, and validation-safe JSON exports. No install, no build step — open the HTML file and go.
The Character Generator lets you build full character files — tree JSON, character JSON, and bundles — without touching raw text. It understands the AIfrit schema deeply: dual next/next_node fields, mood tags, flag scoping, trade outcome blocks, and the full validation layer.
character_generator.html in any modern browser. Works offline. No server, no dependencies, no build step.localStorage instantly. Work persists across browser sessions and page refreshes automatically..json file onto the window — tree, character, or bundle — and it auto-detects the format and loads it immediately.From zero to a working dialogue tree in under five minutes.
character_generator.html and open it in any modern browser (Chrome, Firefox, Edge, Safari). No server needed.tree_id and character_id in the top bar. These become the filenames and link the tree to your character. Use snake_case — e.g. tourist_bob_buyer..json file onto the window to edit it.The studio is a three-column, tabbed editor. Here's what each region does.
tree_id, character_id, title, trade mode, version, preset selector, export profile. Action buttons for new, import, and export. The ⌘ Search button opens the command palette.
entry_node_id and extended_entry_node_id. These define where the runtime starts the conversation on first and return visits.
Every node has a type field. The type affects runtime behavior, sidebar color coding, and which validation checks apply.
hidden should always have a requires_flag or conditions block. The validation system will warn you if a hidden node has no gate — it would be unreachable and silently fail in the runtime.
When you click a node in the sidebar, the editor opens it with five tabs.
Where you write what the character says.
Content Mode toggle — switch between simple dialogue string mode (fastest for buyer/seller trees) and dialogue_lines mode (multi-speaker, per-line delays, AI flags for scripted runtime trees).
Mood Quick Picker — click emoji buttons to toggle mood tags. Active moods appear as MOOD: 😌 😊 prepended to the dialogue text. The live preview below shows exactly how the stored string will look.
Dialogue Body — the text the character speaks, after the mood tag line.
ai_prompt — optional prompt for the AI to rewrite or fill in the dialogue at runtime. Leave blank to use the authored dialogue verbatim.
Mini-Game Payload — collapsed section for mini_game type nodes. Paste the live game payload as JSON here.
Where you build the player's response options.
Add Choice — adds a new player option to this node. Each choice has a Display Text (what the player sees), a Next Target (dropdown of all node IDs), and an internal id / option_id.
Missing link warning — if a choice points to a node that doesn't exist, the Next Target field shows missing. This also marks the node broken in the sidebar.
↑ ↓ reorder — use the arrow buttons to change the display order of choices.
Choice Metadata (collapsed) — per-choice flags (sets_flag, flag_set, requires_flag), phase gates, gold requirements, rapport/trust deltas, and raw JSON fields for outcomes, effects, and requirements.
Container toggle — switch between exporting as choices or player_options depending on the target runtime style.
Controls how the engine decides whether to show this node and what happens after it completes.
Gate fields — requires_flag (single flag must be set), requires_flags (ALL of these must be set), requires_flags_any (ANY of these must be set). Comma-separated strings.
next_node_id — direct routing without a choice. When set, the node advances automatically after completing without showing choices.
fallback_node_id — where to route if conditions fail or a choice target is missing.
conditions JSON — the full conditions block for priority-based entry point selection (e.g. flag_absent, flag_present, phase_min).
on_complete / outcomes — action blocks that fire when the node finishes. Set enable_trading: true, a price_modifier, reputation_change, flag sets, and checkpoint unlocks here.
Less common fields kept out of the main view to avoid clutter.
priority — integer used when multiple nodes are marked is_entry_point: true. Lower numbers fire first when conditions match.
speaker override — overrides the default character speaker for this specific node (useful for multi-character scenes).
character_id override — routes the node to a different character's data context.
behavior_context_injection — checkbox. When on, the runtime injects live behavioral context (rapport level, recent trades, known keywords) into the AI prompt for this node.
notes / scene_note — author-only notes that don't export to the live runtime files.
ambient_effects JSON — runtime ambient overrides (e.g. ui_mode: "antagonist", glitch_enabled: true for characters like Agent VEX).
Passthrough Extras JSON — any live fields the tool doesn't model explicitly are stored here and round-trip safely on export.
A read-only panel showing what the node will look like in the exported JSON.
Flattened Dialogue Preview — the full dialogue string as it will be stored, including mood tags.
Schema Preview — the full node exported as JSON in the currently selected export profile (preserve/hybrid/scripted).
Route View — "Routes Out" shows every choice and next_node exit from this node. "Reached From" shows every other node that links into this one. This is the fastest way to trace a path through the tree without looking at the graph.
Flags Set / Flags Required — which flags this node sets and which it requires, color-coded by scope (local vs global).
| Tab | Key | What it's for |
|---|---|---|
| ◈ NODE | 1 | The active node editor with its five sub-tabs. This is where 90% of authoring happens. |
| 🎭 STUDIO | 2 | Character identity, assets, lore, trade behavior, buff/penalty notes, AI persona seed, AI system prompt, flag registries. Edit everything about the person, not just the tree. |
| ✔ VALIDATION | 3 | Full validation report: error/warn/info messages with links to the offending node. Flag Registry showing every flag used, where it's set, and where it's required. Path & Route Summary with entry nodes, farewell nodes, trade closeout nodes, and broken links. |
| 🕸 GRAPH | 4 | Visual node map. Nodes are laid out by BFS depth from entry points. Click any node in the graph to jump to it in the editor. Broken links are drawn in red dashes. Unreachable nodes have a red border. |
| {} JSON | 5 | Live preview of the tree JSON, character JSON, and bundle JSON as they would be exported right now. Also includes raw JSON editors for Desk Notes and Quest Metadata. |
The export profile controls how the output JSON is shaped. Change it in the top bar dropdown or in Studio Settings.
| Profile | Use when | What it does |
|---|---|---|
| preserve | Editing live files | Round-trips the file byte-for-byte. Uses the same field names, case style, and key ordering as the file you imported. This is the safest default for production files like tourist_bob or agent_vex. |
| hybrid | New characters | Writes both next and next_node_id in choices, uses choices as the key, outputs dialogue as the content field. Suitable for characters that need to work with both older and newer runtimes. |
| scripted | Targeting scripted runtime | Uses dialogue_lines arrays, player_options as the choice key, and next_node in choices. Suitable for characters like Agent VEX that need multi-speaker line sequences. |
_extras) are always passed through on export in all profiles. Switching from preserve to hybrid or scripted will reshape choice key names — the Validation tab will warn you if this affects the current file.
| Shortcut | Action |
|---|---|
| Ctrl + K | Open command palette — search nodes, switch tabs, run actions |
| Ctrl + S | Force save to localStorage with a visual confirmation toast |
| 1 | Switch to Node tab (when no input is focused) |
| 2 | Switch to Studio tab |
| 3 | Switch to Validation tab |
| 4 | Switch to Graph tab |
| 5 | Switch to JSON tab |
| N | Add a new node (when no input focused) |
| D | Duplicate the selected node |
| Esc | Close command palette |
The Studio produces two files per character — a tree JSON and a character JSON — plus an optional bundle combining both.
| Field | Type | Notes |
|---|---|---|
| tree_id | string | Primary identifier. Used as filename. e.g. tourist_bob_buyer |
| character_id | string | Links to the character file |
| title | string | Human-readable display name |
| version | number | Increment when making breaking changes |
| trade_mode | buyer | seller | neutral | Controls which trade direction the tree handles |
| entry_node_id | string | Default conversation start node |
| extended_entry_node_id | string | Used on return visits or after lore unlocks |
| nodes | Node[] | All dialogue nodes for this tree |
| flags_defined | string[] | Flags this tree creates |
| flags_consumed | string[] | Flags this tree reads from other trees |
| theme_tags | string[] | Searchable content tags |
| prerequisite_flags | string[] | Flags that must be set before this tree can be entered |
| Field | Notes |
|---|---|
| node_id | Unique within the tree. Used as the link target for choices. |
| type | See node types table above |
| dialogue | Full dialogue string including optional MOOD: 😌\n prefix |
| dialogue_lines | Array of {speaker, text, delay_ms, ai_generated} for scripted runtime |
| choices / player_options | Array of player response options |
| is_entry_point | If true, engine considers this a candidate for tree entry (with priority + conditions) |
| priority | Lower = checked first. Used when multiple entry nodes exist. |
| conditions | Object. Supports flag_present, flag_absent, phase_min, phase_max |
| requires_flag | Single flag that must be set for this node to be visible |
| requires_flags | Array. ALL must be set. |
| requires_flags_any | Array. ANY one must be set. |
| on_complete | Action block fired when node finishes. Contains trade, flag, and reputation fields. |
| outcomes | Secondary action block for outcome-specific side effects |
| next_node_id | Auto-advance target (no choice shown) |
| fallback_node_id | Where to go if gating fails |
| ai_prompt | Prompt for AI to rewrite the dialogue line at runtime |
| behavior_context_injection | Injects live rapport/trade context into the AI call |
| ambient_effects | Runtime UI overrides (glitch mode, antagonist theme, etc.) |
| terminal | Boolean. True for farewell/terminal types. |
| hidden | Boolean. True for hidden type. |
| Field | Notes |
|---|---|
| id / option_id | Internal identifier. Also exported as option_id for scripted runtime. |
| text | Display text shown to the player |
| next / next_node_id / next_node | Target node. The Studio normalizes to next internally and exports all three in hybrid mode. |
| sets_flag / flag_set | Flag to set when this choice is picked |
| requires_flag | Flag required to show this choice |
| requires_flags | All of these flags must be set |
| phase_min / phase_max | Conversation phase gates |
| requires_gold | Gold cost to select |
| rapport_change / trust_delta | Reputation effects for choosing this option |
| outcomes | JSON block for choice-specific side effects |
| effects | Additional effect block |
| requirements | Complex requirement object for skill checks etc. |
| Field | Notes |
|---|---|
| enable_trading | Boolean. Triggers the trade UI after this node. |
| trade_mode | buyer | seller | neutral. Overrides tree-level mode for this node. |
| price_modifier | Float. 1.0 = base price. 1.1 = 10% premium. 0.9 = 10% discount. |
| reputation_change | Integer delta applied to the player's rapport with this character. |
| sets_flag / flag_set | Flag to set on completion |
| flag_set_2 / set_flag_2 | Second flag set on completion |
| set_flags | Array of flags to set |
| checkpoint_unlock / note_id | Unlock a story checkpoint or journal note |
Agent VEX uses the scripted runtime style — dialogue_lines arrays with player_options as the choice key, next_node in choices, and advanced ambient effects. To edit her tree:
agent_vex_tree.json using Import Tree or drag-and-dropuse dialogue_lines mode in the Dialogue tab for her nodesambient_effects via the Advanced tab (JSON block) for glitch/antagonist UI modebehavior_context_injection: true on nodes that reference live game stateHer priority and conditions fields on entry nodes enable the multi-visit routing engine. Lower priority = checked first. The flag_absent: vex_encounter_initiated condition gates first-encounter nodes, and flag_present gates return visit nodes.
Flags in the system have two scopes:
global_ are always treated as global. Others can be declared global in the character's global flag registry field in the Studio tab.The Flag Registry in the Validation tab shows every flag in the current tree, its scope, where it is set, and where it is required — useful for catching flags that are required but never set.
Mood tags live on the first line of the dialogue field:
MOOD: 😌 😊 The rest of this text is the dialogue body.
The Studio parses and re-assembles this automatically. Click emoji buttons in the Mood Quick Picker to toggle them. The live preview shows the final combined string at all times.
Moods affect the runtime's visual presentation (character expression, ambient music, UI color wash). Multiple moods can be stacked.
When a character has multiple is_entry_point: true nodes, the runtime checks them in ascending priority order and fires the first one whose conditions pass.
Pattern for first vs. return visits:
// First encounter node priority: 1 conditions: { flag_absent: "char_met" } // Return visit node priority: 2 conditions: { flag_present: "char_met" }
Set the on_complete block of the first encounter node to sets_flag: "char_met".
.json file anywhere on the window. Auto-detects tree, character, or bundle format and imports with a toast confirmation.The guided wizard is now the recommended starting point for player-friendly character creation. It asks for identity, voice, opening dialogue, player choices, lore, trade behavior, and farewells, then generates an engine-safe dialogue tree.
Open the AI-Assisted Character Wizard or use the Advanced Generator for direct node editing.
next and next_node together for live compatibility.sets_flag / set_flag_2.