TBAF is a TypeScript subset that transpiles to BAF (Infinity Engine AI scripts). It lets you use TypeScript abstractions -- variables, functions, loops, enums -- that are fully resolved at compile time into flat IF/THEN/END blocks. BAF has no runtime variables or control flow; TBAF provides those at compile time.
.tbaf files are bundled with esbuild, converted to .baf via the transpiler, then compiled by WeiDU.
- You write
.tbaffiles using a subset of TypeScript - Transpiler converts
.tbafto.baf, the resulting file is written next to the source - WeiDU compiles the
.bafinto the game
Engine builtins (triggers, actions, objects) are provided by IETS as typed declarations.
- Writing TBAF -- Comprehensive reference for all supported syntax, condition algebra, and gotchas
- LLM Reference -- Compact reference optimized for LLM context windows (copy into your project for AI-assisted coding)