How TPScript works
TPScript is a small, self-contained compiler front-end that rewrites your gameplay source into Unreal C++.
The pipeline
your_code.tps
│
▼
┌────────────────┐
│ Tokenizer │ LEXER - splits the text into tokens
└────────────────┘
│
▼
┌────────────────┐
│ Parser │ PARSER - builds an AST (classes, props, funcs…)
└────────────────┘
│
▼
┌────────────────┐
│ Emitter │ EMITTER - writes UCLASS/UPROPERTY/UFUNCTION C++
└────────────────┘
│
▼
┌────────────────┐
│ Regenerator │ Manages files, modules, manifests, stale-file cleanup
└────────────────┘
│
▼
AHelloWorld.h / AHelloWorld.cpp
-
Lexer - the file is tokenized. TPScript understands identifiers, keywords, string literals (with escapes), character literals, numbers, and multi-character symbols. It deliberately treats
<<and>>as two tokens so deeply nested templates likeTArray<TSubclassOf<AActor>>balance correctly. -
Parser - builds an abstract syntax tree. It recognizes top-level constructs (
uclass,class ... extends,ustruct,uenum,interface,include,declare,log) and every member kind (prop,field,func,method,component,delegate, high-leveledit/internal/when_begin, …). -
Emitter - walks the tree and emits idiomatic Unreal C++:
#pragma onceheaders with#include "<Name>.generated.h",UCLASS()/UPROPERTY()/UFUNCTION()macros, constructors withCreateDefaultSubobject,overridemethod bodies, delegate macros, and more. -
Regenerator - the editor-facing layer. It discovers modules via a
.tpscript-manifest.json, writes generated files into the rightPublic//Private/categories, creates module boilerplate when missing, and cleans up stale files on Regenerate All.
The "regenerate" model
TPScript is not a hot-reload scripting layer. It generates real C++ that you then compile (with the built-in Compile button, Live Coding, or your IDE). This is what gives you full C++ performance and full Blueprint integration.
The workflow is intentionally mechanical:
Edit
.tps→ Regen This File → Compile → play.
You don't hand-edit generated C++. If you want to change behaviour, change the .tps and regenerate. That keeps mechanics consistent and reviewable.
Status markers
When you regenerate, each file gets a status:
| Marker | Meaning |
|---|---|
[NEW] | generated for the first time |
[UPD] | previously generated, updated |
[==] | unchanged, no diff |
[DEL] | old generated file removed (stale) |
[+] | auxiliary / added |
Pure C++, no runtime
The transpiler itself is a single pure-C++17 library (lexer, parser, model, emitter) with no Unreal dependencies. It runs inside the plugin's Runtime module. The only dependency on the engine is the regenerator wrapper that uses Projects, Json, JsonUtilities, Slate, and SlateCore for module discovery and the editor UI.
See Generated Code for what the output looks like in detail.