View on GitHub

FOnline Engine

Flexible cross-platform isometric game engine

Baking Pipeline

This document explains the engine resource baking pipeline: where it is wired, which source files own baker behavior, and how to validate changes. For the broader engine tool map, see Tools.md.

Use this for reusable engine behavior. Game-specific content folder rules and product package policy belong in the embedding project’s docs.

Source paths inspected

What baking does

Baking turns project resources and configuration into runtime-ready output. The build pipeline creates BakeResources and ForceBakeResources command targets in BuildTools/cmake/stages/ScriptsAndBaking.cmake. Those targets run the project baker application with the embedding project’s main config applied.

At runtime/source level, baking is owned by:

CMake entry points

BuildTools/cmake/stages/ScriptsAndBaking.cmake creates baking commands after application targets are available.

Current target responsibilities:

The actual final target names that depend on these commands are project/preset-dependent. Do not document one embedding project’s target names as universal engine behavior.

Runtime classes

BakingContext

Defined in Source/Tools/Baker.h. It carries shared bake state:

BaseBaker

The abstract base for individual baker implementations. Each baker provides:

BaseBaker::SetupBakers() in Source/Tools/Baker.cpp creates requested bakers and then calls SetupBakersHook() so external/project code can extend the baker list.

MasterBaker

MasterBaker coordinates a full bake through BakeAll(). It is the app-facing type used by both BakerApp.cpp and BakerLib.cpp.

BakerDataSource

BakerDataSource adapts resource inputs/outputs to the engine DataSource interface. It tracks input resource packs, output resources, cache checks, and output path construction.

Built-in baker types

Source/Tools/Baker.cpp registers built-in bakers when requested and enabled:

When documenting a specific asset type, inspect the relevant baker class and its tests rather than inferring behavior from file extensions alone.

Script compilation relationship

ScriptsAndBaking.cmake also creates script compilation commands:

These are separate command targets from resource baking, but they share the same stage because generated/baked runtime inputs are part of the same build preparation workflow.

Tests to inspect

Baker behavior is covered by focused tests in Source/Tests/:

Use the smallest test that matches the baker you changed. If CMake target names are generated by the embedding project, discover them from that project’s presets/build files instead of hard-coding them here.

Change routing

Validation checklist

  1. Configure from an embedding project root.
  2. Build the project baker application/library target if the changed path affects app/library code.
  3. Run the relevant baker test(s) under Source/Tests/.
  4. Run BakeResources for incremental behavior when cache/build-hash logic matters.
  5. Run ForceBakeResources when forced rebuild behavior matters.
  6. Inspect generated output only as output, not as hand-authored source.
  7. Update this document and BuildToolsPipeline.md if stage responsibilities change.