.ctproject (project file)
A .ctproject is a game.json with build targets added. Each
build target says which platform to export for, how your BT code ships, and
where the finished game goes. Studio opens a .ctproject as a project, and
ctgame build --target NAME builds one of its targets. Anything that runs a
game.json can also run a .ctproject.
Put it at the project root (Studio names it project.ctproject). Relative
paths are relative to its folder.
Example
{
"version": "1.0.0",
"game": { "name": "My Game" },
"module": { "name": "my-game" },
"bt": { "sources": ["bt/main.bt"], "entry": "launchGame" },
"build_targets": [
{
"name": "Windows",
"platform": "windows",
"code_mode": "aot_shared",
"output": "build/windows/MyGame.exe",
"deployment": "D:/Games/MyGame"
},
{
"name": "Linux",
"platform": "linux",
"code_mode": "aot_linked",
"output": "build/linux/MyGame"
},
{
"name": "WebAssembly",
"platform": "webassembly",
"code_mode": "bytecode",
"output": "build/web/index.html"
}
]
}
build_targets[]
All game.json fields apply, including your game's
version and the optional
format section. The project file adds
build_targets, an array of targets:
| Field | Type | Default | Description |
|---|---|---|---|
name | string | — | Required. Target name, used with ctgame build --target NAME. Must be unique. |
platform | string | desktop | desktop (the computer you build on), windows, linux, macos or webassembly. Desktop platforms must match the computer running the build. |
code_mode | string | — | How your BT code ships; see Code modes. If omitted, the manifest's bt section is packaged as it is. |
output | string | — | Required. Path of the executable to produce, including its name (with .exe on Windows), or the .html page for webassembly. Its folder must be a separate folder just for the build, not the project folder. |
deployment | string | — | Folder that Build & Deploy (--deploy) replaces with the finished build, for example a test install folder. Everything already in it is replaced. |
bt_debug_runtime | boolean | false | Desktop only. Build with the debugger-capable BT runtime so a debugger can attach to the exported game (keeps bt.debug). Needs no C toolchain unless the game has its own C code (Toolchains). |
native_build | object | — | Deprecated. Ignored by exports; Studio keeps it when saving. |
Code modes
| Value | What ships (Linux/Windows x64) | WebAssembly |
|---|---|---|
source | Your .bt scripts, compiled when the game starts. | Supported |
bytecode | Precompiled bytecode (bin/program.ctbt). Starts faster than source and doesn't ship your scripts. | Supported (JIT off) |
aot_embedded | Machine code inside the executable. One file; no C compiler needed. | Not supported |
aot_shared | The executable plus bin/program.dll or bin/program.so beside it. Ship both. | Not supported |
aot_linked | Machine code linked into the executable. One file, fastest startup; needs a C toolchain. aot_static means the same. | Not supported |
AOT means ahead-of-time: your scripts are compiled to machine code at build time. See Deployment modes for how to choose. macOS is Not supported (Platforms).
What a build does
- A desktop build replaces the output folder with a fresh copy that contains
only the game (the executable, plus
bin/program.*foraot_shared). If the build fails, the previous build is left in place. - A web build writes its files into the output folder and leaves other files there alone.
- Build caches go in a
.ctbuild/folder in the project. Don't commit it; deleting it is safe but makes the next build slower. See Files a build produces. - Compiled code modes compile
bt.sourcesand theui.entryscript together. Every script folder is packaged whole, so any package your scripts include must be inside a script folder or listed inpackage.copy. - If the project has
native.sources, the C code is compiled into the executable. See Native SDK. ctgamenever modifies your project files.
-o, --icon, --wasm and --wasm-build-dir can't be combined with
--target. See ctgame.
In Studio
- If the project has no target for Windows, Linux or WebAssembly, Studio shows
a default one (outputs
build/windows/game.exe,build/linux/game,build/web/index.html). These are saved to the file only when you save or build. - Studio only rewrites
build_targetsandstudio_debug_host; the rest of the file is left exactly as you wrote it. If the file changed on disk since Studio loaded it, use Reload Targets before saving. - Create Project File copies your
game.jsontoproject.ctprojectin the same folder. The two files are independent afterwards. - Your local toolchain paths (CMake, compiler) are stored per machine, not in the project; see Studio user state.
Errors
| Message | Cause |
|---|---|
Each build target needs a name and output path | A target is missing name or output. |
Build target names must be unique / duplicate build target name | Two targets share a name. |
unknown build target | No target has the name given to --target. |
build target platform does not match this host | Desktop targets must be built on that OS. |
target output must be an executable in a separate package directory | output is missing or its folder is the project folder (or contains it). |
deployment must be a separate folder outside the output folder | --deploy without deployment, or the two folders overlap. |
unknown code deployment mode | Misspelled code_mode. |
WebAssembly supports loose scripts and bytecode; BT AOT emits x64 code | Use source or bytecode for web targets. |
loose-script mode requires source inputs in the project | code_mode: "source" needs bt.sources, not bt.program. |
compiled targets require BT source inputs | The project has no bt section to compile. |
Older project files
Studio still opens an old-style .ctproject that just points at a
game.json:
version: 1
manifest: "game.json"
ctgame doesn't accept this form. Use Create Project File from the
game.json to get a current project file.