Introduction

A quick overview of Foil Engine and how it works.

What is Foil Engine?

Foil Engine is an AI conversation engine for building non-player characters. You define a character's identity and design a conversation flow as a state machine. The AI handles natural language generation, staying in character while following your structure.

No dialogue trees. No scripted lines. You set the guardrails, and the AI improvises within them.

The Mental Model

Every NPC follows this hierarchy:

  • Persona — The character identity: name, backstory, voice.
  • Scenario — A conversation flow attached to a persona. One persona can have many scenarios.
  • States — Phases of the conversation (e.g., greeting, negotiation, farewell). The NPC is always in exactly one state.
  • Transitions — Rules that move the NPC between states based on what the user says.
  • Decisions — The outcome when a transition fires: pass, redirect, reject, or kick_out.

Think of it as: Persona → Scenario → States → Transitions → Decisions. Each layer builds on the one before it.

Who is it for?

  • Game designers building interactive NPCs for RPGs, simulations, or narrative games.
  • Educators creating practice scenarios like interviews, negotiations, or language exercises.
  • Hobbyists experimenting with AI characters for storytelling or creative projects.
💡Ready to build?
Head to the Quickstart guide to create your first NPC in five steps.