Modules¶
The reference of the repository's modules: what each folder under src/rtype/ holds, class by class, and the rules
between them. It is the catalogue that used to sit in the root AGENTS.md; the root file keeps the one-line map and the
architecture rules, and this file keeps the detail, which changes with every feature. Plugins.md has the plugin graph,
Backend.md the platforms and renderers, engine/design.md the Engine.
Project structure¶
src/rtype/core/—coretarget, static library (rtype-core): what several modules share and that belongs to none of them, one folder per feature, included ascore/<feature>/<File>.hpp, namespacertype::core::<feature>. It depends on no other project target and keeps no global state. A class goes in only if two or more unrelated modules need it; what onlypluginsneeds stays inplugins.core/asset/(rtype::core::asset) —AssetId: the hash of an asset's path, the same in every process, which components keep to name a texture or a sound. The ECS reflection of it (kAssetId) is inplugins/AssetIdReflection.hpp.AssetFiles.hpp(normalizePath,isInsideDirectory,resolveAssetPath,readTextFile) andAssetStore<T>(the assets of a resource by id, with hash-collision checks) are shared by the asset resources ofplugins, which throwAssetLoadException(asset/exceptions/).core/hash/(rtype::core::hash) —NameHash.hpp: the FNV-1a 64-bit hash (hashName,hashString,hashInteger), the same in every compiler and process.core/config/(rtype::core::config) —Settings: the flat configuration every plugin and backend reads its own section of, and itsSettingsException(config/exceptions/).core/library/(rtype::core::library) —LibraryEntry.hpp: the C entry point of a library the engine loads (RTYPE_LIBRARY), its version and toolchain check (checkLibrary), andLibraryRegistrar, through which libraries exchange their registries by name.core/reload/(rtype::core::reload) — hot reload, free of any module:Reloadable(a feature that applies new versions of its files),FileWatcher(mtime and size polling with a debounce),ChangeSet,ReloadOutcome(applied, failed, needs a rebuild),ReloadReport(the log line) andHotReloader, which polls and reloads.core/system/(rtype::core::system) —CacheDirectory.hpp,ExecutablePath.hpp: where the system keeps a user's cache and the running executable.core/version/(rtype::core::version) —Version.hpp:VersionInfoanddescribe(), the text ofaylo-runtime --version. The version itself is set once in the rootxmake.lua(docs/release/package.md).
src/rtype/ecs/—ecstarget, shared library (rtype-ecs): the Entity Component System and, later, the App and its plugins (rtype::ecs). Design indocs/ecs/design.md. It depends oncoreonly. Exported classes and functions are markedRTYPE_ECS_API, and the library keeps no global mutable state (state lives in the world), so it can also be built static by switching its kind and definingRTYPE_ECS_STATICpublicly (seeExport.hpp).- Files are grouped in one folder per feature (
entity/,type/(the core shared by every kind of ECS data: fields, hooks, descriptions, registry),component/,resource/,event/,storage/,change/(change ticks),world/,command/(deferred structural changes),hierarchy/(Parent,Children),query/,system/,call/(engine calls: named functions plugins give to scripts, andCallBuffer, the bytes of their arguments and results),schedule/,time/,app/(the App and its plugins)), included asrtype/ecs/<feature>/<File>.hpp. - Exception to the namespace rule: the types users write every day stay in the flat
rtype::ecsnamespace whatever their folder (rtype/ecs/entity/Entity.hppdeclaresrtype::ecs::Entity). Only internal parts get a sub-namespace, named after their folder:rtype::ecs::storage,rtype::ecs::detail(detail/),rtype::ecs::exceptions(exceptions/).
- Files are grouped in one folder per feature (
src/rtype/network/—networktarget, static library (rtype-network): the transport, which moves bytes between machines (sockets, connections, acks, reliability). It knows nothing about the ECS and depends on Asio only, as a private package: no public header includes Asio, and only.cppfiles ofio/do. Exported symbols are markedRTYPE_NETWORK_API. Design indocs/network/design.md, task plan indocs/network/implementation.md.- Namespaces mirror the folders (no flat-namespace exception as in
ecs):rtype::networkfor the root (Types.hpp,NetworkSettings.hpp,RandomSource.hpp), then one folder and sub-namespace per feature:protocol/(rtype::network::protocol, wire constants, sequences, packets),bytes/,connection/,io/,server/,client/,exceptions/. A folder is created only when a file goes in it.
- Namespaces mirror the folders (no flat-namespace exception as in
src/rtype/replication/—replicationtarget, static library (rtype-replication): the only code that knows both the ECS and the network; it turns aWorldinto messages and back (rtype::replication). Exported symbols are markedRTYPE_REPLICATION_API. Feature folders and sub-namespaces as innetwork:component/,event/,serialization/,manifest/,input/,snapshot/,server/,client/,packet/,admin/(the world messages of the admin channel),exceptions/.input/InputCalls.hppholds its engine calls (rtype.replication.addInput,readInput),client/ClientCalls.hppthe client's (rtype.replication.localClient), both registered byReplicationPlugin.src/rtype/engine/—enginetarget, static library (rtype-engine):Engineruns a game directory (game/by default,<dir>): it reads itsproject.luauthrough Luau (scripting/SettingsLoader, which also exposes the command line asengine.args), builds theAppwith the program's plugins,EngineConfig::addPlugins, and the engine's (transform, replication, scripting, server or client) in a fixed order, calls the game's nativeEngineConfig::setup, runs it, and builds it again onrequestReload()or whenproject.luauchanges.reload/holdsProjectReloadableandScriptsReloadable, the engine's hot reload sources (HotReloader,plugins/HotReload.hpp).plugin/holdsSharedLibraryandPluginLoader, which load the plugin libraries, andPluginSignature. The pluginsproject.luaunames underpluginsare added after the replication plugin. On clients,NetworkInputfills thePlayerInputsent to the server from theInputactions.EngineConfigholds the mode, the command line and these functions;CommandLineparses the--name valueflags. Exported symbols are markedRTYPE_ENGINE_API. Design indocs/engine/design.md.src/rtype/editor/—editortarget, static library (rtype-editor) and theaylo-editorprogram (app/main.cpp: the engine inkStandalone,EngineConfig::debugtrue,EditorPluginadded byaddPlugins) (rtype::editor, macroRTYPE_EDITOR_API, empty as the library is static). It requires the graphics and capsule plugins and adds no system: it sets the graphics plugin'sPlatformEventFilterandToolFrameresources, and pauses the App's schedules while editing.EditorPluginbuilds anEditorState(the ImGui context, the input bridge, the play session, the open scene, what the panels remember) and reads theeditorsettings (scene,textEditor) withreadEditorOptions().gui/holdsGuiContext,Theme(the look and its tone widgets),GuiInput(the window's events to ImGui, and which of them the game sees),GameViewportandGuiMesh(ImGui's draw data and textures as acontract::renderer::Mesh).play/holdsPlaySession(Play, Pause, Step, Stop),scene/holdsSceneEdit(the capsule changes, open, save, new files) andIsolation(a capsule shown alone, prefab mode),console/holdsConsoleLogandOutputCapture(the program's output, for the Console),shell/holdsTextEditor(a file opened in an external editor), all without ImGui.panels/holds the Game, Hierarchy, Inspector, Assets, Particles, Console and Stats panels and the toolbar,FieldEditor(the widgets of a reflected value, assets dropped on fields) andWorldView. Dear ImGui (docking branch) is a private package: no header of the editor includes it. Design indocs/Editor.md.src/rtype/runtime/— the generic executableaylo-runtime: amainthat runs anEngineongame/as a client, or as the server with--server, which loads the plugins and backends from their libraries (the executables link none). The build copies them to the repository root (rulertype.copy_to_root). Games whose gameplay is still C++ (ethan_game(bestoftheworld)) keep their ownmainand give it to theEngineasEngineConfig::setup.rtype_duelis written in Luau (game/scripts/); its ownmainonly picks the side from its first argument.src/rtype/contract/— the contracts, one shared library per interface (contract-platform,contract-renderer,contract-audiodevice,rtype-contract-<name>): what the implementations fulfil and the plugins use, with the vocabulary they speak, included asrtype/contract/<name>/<File>.hpp, namespacertype::contract::<name>, exported symbols markedRTYPE_CONTRACT_<NAME>_API. A contract knows no ECS and no plugin; the ECS declarations of its types live in the plugin that uses them, reopening its namespace. Seedocs/Plugins.mdanddocs/Backend.md.contract/platform/—IPlatform,PlatformRegistry(platforms by name),WindowConfig,event/(theEventvariant),input/(Key,MouseButton...),exceptions/.contract/renderer/—IRendererandRendererRegistry(renderers by name), then one folder per theme. Exception to the namespace rule, as inecs: these folders stay in the flatrtype::contract::renderer(rtype/contract/renderer/drawing/Sprite.hppdeclaresrtype::contract::renderer::Sprite); onlymath/andexceptions/get a sub-namespace.drawing/—Sprite,Shape,Text(a laid-out text: MSDF glyphs),Texture,Color,BlendMode.view/—ViewandCameraView(what aViewshows: letterboxed viewport, view-projection, screen and world conversions).particle/— the particle types:Particle,ParticleSystemDesc,ParticleCurve,ParticleRandom.shaders/—CompiledShader(the plain data of a game shader, withMaterialDesc) and the shaders ABI: the GLSL every shader is assembled in and the backends' built-in shaders include.math/,exceptions/.
contract/audiodevice/—IAudioDevice,AudioTypes,AudioDeviceRegistry(devices by name) andexceptions/.
src/rtype/plugins/— the engine, as ECS plugins: one shared library per plugin (plugin-<name>,rtype-plugin-<name>), one folder each, included asplugins/<name>/<File>.hpp, namespacertype::plugins::<name>, exported symbols markedRTYPE_PLUGIN_<NAME>_API. Each plugin keeps its own code and declares its own components, resources and events (RTYPE_ECS_*). A plugin scripts drive registers its engine calls in<Name>Calls.hpp(add<Name>Calls(), called from itsbuild()), namedrtype.<plugin>.<verb>, with their argument and result structs (RTYPE_ECS_CALL_DATA). A plugin names what it requires ingetDependencies(); the program adds it first, and no plugin adds another one. Seedocs/Plugins.md.plugins/graphics/(rtype::plugins::graphics) —GraphicsPlugin: starts the platform and the renderer from aBackendRegistrythe executable fills (so it depends on no backend), with thertype.Backendmain-thread resource, the window events and the PreUpdate / Render systems that poll the window, frame the drawing and draw theSpriteQueueby layer. Also theCameracomponent (projection and priority, placed by its entity'sTransform), theTextureAssetsresource (the textures byAssetId, queued byload()and decoded with stb), theSpriteQueueresource (what the frame draws) and theVisibleArearesource (what the frame shows). Two main-thread resources let a tool sit between the window and the game:PlatformEventFilter(sees every event first, may change it or hide it) andToolFrame(a callback run just before the frame ends, with the platform and the renderer). It requires theInputPluginand theTransformPlugin.plugins/input/(rtype::plugins::input) —InputPlugin:Control(named with text bycontrolFromName(),ControlNames.hpp, overcontract/platform/input/KeyNames.hpp),Input,InputAction,ButtonStates, thertype.Inputresource, fed by aPreUpdatesystem from thePlatformEvents in order, and the typed input events (InputEvents.hpp) for gameplay code. It knows nothing of the graphics plugin, which requires it.plugins/capsule/(rtype::plugins::capsule) —CapsulePlugin: capsules, entities described once and spawned by copy, actors and levels alike.Capsule(a flat list of nodes: name, parent, side, the capsule it instances,ComponentValues), theCapsulesresource (by theAssetIdof their path,define()again for hot reload),spawnCapsule(),loadCapsule()(switches levels, with theLoadedCapsuleresource) andreloadCapsule(), each recorded in aCommandsbuffer (CapsuleSpawn.hpp), theCapsuleInstancecomponent on every spawned root, and thertype.capsule.spawn/load/reloadcalls (CapsuleCalls.hpp).format/CapsuleText.hpp(rtype::plugins::capsule::format) reads and writes the capsule file format (docs/CapsuleFormat.md);CapsuleFiles(thertype.CapsuleFilesresource) reads a game's.capsule/.scene/.actorfiles from the plugin'sfinish()and reads saved files again forCapsuleReloadable, the plugin's hot reload source, which fillsReloadedCapsulesfor the system that reloads what they spawned.detail/CapsuleSpawnerchecks a capsule and records its walk. It requires no plugin. Seedocs/ecs/features/18-capsules.md.plugins/transform/(rtype::plugins::transform) —TransformPlugin: theTransformcomponent gameplay writes, relative to the entity's parent, and theGlobalTransformrendering reads, computed from it inPostUpdateon every side.TransformMath.hpp(combine,toLocal),WorldPoses(world poses for what runs beforePostUpdate, such as the physics) andReparent.hpp(detachInPlace,attachInPlace). TheEngineadds it, and the plugins that use it require it.plugins/physics/(rtype::plugins::physics) —PhysicsPlugin: 2D physics on Jolt (Collider,RigidBody,Velocity, thePhysicsWorldresource, collision events, scene queries,moveAndSlide), simulated on the server side, with query-only bodies on clients. Jolt is a private package: only.cppfiles anddetail/include it. The debug view is inphysics/debug/(rtype::plugins::physics::debug), its own libraryplugin-physics-debug, the engine calls inPhysicsCalls.hpp. Design indocs/physics/design.md.plugins/audio/(rtype::plugins::audio) —AudioPlugin:AudioRegistry(starts the device the settings name,"null"always registered, asNullAudioDevice),AudioConfig,AudioVolumes, theAudioAssetsresource (sounds byAssetId, opened and decoded by the device), theAudioSourceandAudioListenercomponents and thePlaySound/PlayMusic/StopMusicevents, played by client-side PostUpdate systems.AudioReflection.hppreflects the contract'sBus. Design indocs/audio/design.md.plugins/http/(rtype::plugins::http) —HttpPlugin: HTTPS requests for scripts.HttpSettings(thehttpsection: allowed hosts, limits, secrets), theHttpClientresource (libcurl, private indetail/CurlClient, polled without waiting byrtype.Http.Poll), theHttpResponseevent, thertype.http.requestandrtype.http.cancelcalls and theengine.http.requesthelper (HttpForms.luau). Design indocs/Http.md.plugins/json/(rtype::plugins::json) —JsonPlugin: JSON for scripts. Thertype.json.encodeandrtype.json.decodecalls (JsonCalls.hpp) do the real work with nlohmann::json, private indetail/JsonCodec, on a value flattened into a pre-order node stream (an engine call carries reflected fields, never a table of any shape); theengine.jsonhelpers (JsonForms.luau:encode,decode,tryDecode,map) only walk a Luau table's shape and rebuild a value from the stream. No component or event. Design indocs/Json.md.plugins/shape/(rtype::plugins::shape) —ShapePlugin: theShapeRenderercomponent (aShapefilled and/or outlined at its entity'sGlobalTransform) and the client Render system that draws them over the sprites, by layer.plugins/GraphicsReflection.hppreflects the renderer contract'sBlendModeandRectas ECS fields. It requires theGraphicsPluginand theTransformPlugin.plugins/sprite/(rtype::plugins::sprite) —SpritePlugin: theSpriteRenderercomponent, sprite atlases and animations; it requires no plugin, so a server adds it alone.SpriteDrawPluginpushes the sprite entities to theSpriteQueueon a client.SpriteAtlas(named frames andSpriteAnimations, built bygrid()or in code), theAtlasAssetsresource (atlases byAssetId: Aseprite / TexturePacker JSON files read with nlohmann_json, or images packed at load time with stb_rect_pack), theSpriteAnimatorcomponent and theAnimationFinishedevent. A PostUpdate system on every side plays the animators into theirSpriteRenderer, and a client one hands the atlases' textures toTextureAssets. nlohmann_json is a private package: onlysprite/detail/includes it. Seedocs/Sprites.md.plugins/tilemap/(rtype::plugins::tilemap) —TilemapPlugin: levels made in Tiled and parallax backgrounds.Tilemap(tilesets, tile layers stored in 16x16 chunks, image layers), theTilemapAssetsresource (maps byAssetId, Tiled.tmjfiles and external.tsjtilesets read with nlohmann_json intilemap/detail/),spawnTilemap()(oneTilemapLayerentity per layer) and theParallaxcomponent. A client Render system moves theParallaxentities before the camera, and another pushes the visible chunks' tiles to theSpriteQueue. It requires the graphics plugin. Seedocs/Tilemap.md.plugins/text/(rtype::plugins::text) —TextPlugin: text from MSDF font atlases made offline by msdf-atlas-gen (assets/fonts/).Font(glyph metrics and kerning), theFontAssetsresource (fonts byAssetId, msdf-atlas-gen JSON read with nlohmann_json intext/detail/, with the UTF-8 decoder),layoutText()/measureText()(TextLayout.hpp) and theTextRenderercomponent. A client Render system lays out each text and pushes it to theSpriteQueueas acontract::renderer::Text, drawn byIRenderer::draw(Text)(Vulkan batches its glyphs in the sprites' order, read by the default shader's glyph variant,glyph.frag). It requires the graphics and shader plugins. Seedocs/Text.md.plugins/shader/(rtype::plugins::shader) —ShaderPlugin: game shaders and materials.ShaderAssets(shaders byAssetId, written in the engine's GLSL dialect),MaterialAssets(Material: a shader and its values), theMaterialInstancecomponent (an entity's owninstance uniformvalues),ShaderHandles, which keeps the renderer up to date, andShaderReloadable, which reloads the shaders saved in<game>/assets/shadersfor the engine'sHotReloader(hotReload).ShaderCalls.hppholds whatengine.assets.shaderandmaterialcall.detail/holds the parser, the assembler and the compiler. glslang is a private package: onlyshader/detail/ShaderCompiler.cppincludes it. It requires the graphics plugin. Seedocs/Shaders.md.plugins/GlmReflection.hpp— lets components reflectglm::vec2,vec3andvec4fields.plugins/AssetIdReflection.hpp— lets components reflectcore::asset::AssetIdfields (kAssetId).plugins/AssetDirectory.hpp— theAssetDirectoryresource theEngineinserts:<game>/assets, where every asset path starts and which it cannot leave (core::asset::resolveAssetPath()).
src/rtype/tools/sign/—aylo-sign: the keys and signatures of the game plugins (docs/Plugins.md).src/rtype/interop/— header-only targets, one per graphics API (interop-vulkan,rtype::interop::vulkan): the interfaces a platform implements to serve the renderers of that API (IVulkanSurfaceSource). Seedocs/Backend.md.src/rtype/platform/<library>/— one target per windowing backend, namedplatform-<library>.platform/glfw/—platform-glfwtarget, shared library (rtype-platform-glfw):GlfwPlatform, the GLFW implementation ofIPlatformandIVulkanSurfaceSource(rtype::platform::glfw, exceptions inplatform/glfw/exceptions/), registered as"glfw"byregisterPlatform()(Registration.hpp). The only module that includes GLFW: it translates every GLFW callback and the gamepad state intortype::contract::platform::Events.
src/rtype/render/<api>/— one target per renderer, namedrender-<api>, implementingcontract-renderer.render/vulkan/—render-vulkantarget, shared library (rtype-render-vulkan):VulkanRenderer, the Vulkan implementation ofIRenderer(rtype::render::vulkan), registered as"vulkan"byregisterRenderer()(Registration.hpp). Shaders go inshaders/and are compiled to SPIR-V by theglsl.spirvrule defined in itsxmake.lua.
src/rtype/audio/<library>/— one target per audio backend, namedaudio-<library>.audio/miniaudio/—audio-miniaudiotarget, shared library (rtype-audio-miniaudio):MiniaudioDevice, the miniaudio implementation ofIAudioDevice(rtype::audio::miniaudio), configured byMiniaudioConfig(itsminiaudiosettings section) and registered as"miniaudio"byregisterAudio()(Registration.hpp).core/(rtype::audio::miniaudio::core) holds the RAII wrappers of miniaudio's objects (Engine,SoundGroup, one per bus,Sound),VoicePoolthe playing voices behind the generationalVoiceIds,exceptions/theMiniaudioException. miniaudio and stb are private packages: the only module that includesminiaudio.h, and the executable seesRegistration.hpponly. The implementation of miniaudio (and of stb_vorbis, its OGG decoder) is compiled once, invendor/MiniaudioImplementation.cpp, which clang-tidy skips (vendor/.clang-tidy).
src/rtype/luau/—luautarget, static library (rtype-luau) for Luau scripting. Failures a correct program can hit returnResult<T>; exceptions are only for API misuse (docs/luau/error-handling.md). The opt-in sandbox andTable::freeze():docs/luau/sandbox.md. Therequireloader (ModuleLoader):docs/luau/modules.md.src/rtype/scripting/—scriptingtarget, static library (rtype-scripting): the Luau bridge, turning what scripts declare into ECS data (rtype::scripting, exported symbols markedRTYPE_SCRIPTING_API). It has its ownError/Result, likeluau.component/holdsComponentDeclarationandregisterComponent(), which computes the deterministic layout of a script component and registers it.view/(rtype::scripting::view) holds what scripts touch ECS data with: theComponentViewusertype (reads and writes a component's fields in place, checked against aViewScopegeneration), theEntityusertype (registerViewTypes()) and the field conversions (readField(),writeField(),fillFromTable()).system/holdsSystemDeclaration, its reader andregisterSystem(), which turns a script system into aScriptCallableon the App.call/holdscallEngine(), which makes anecsengine call from a script's table of argument fields and turns its result into Luau values, forengine.calland forctx.call(a system's declaredcalls).setup/(rtype::scripting::setup) holds the setup forms built on those calls: each plugin brings its setup forms, in a<Name>Forms.luaufile;setup/FormsPrelude.luaucreatesengine.assets,engine.inputand the helpers ofengine.forms.ScriptHostowns the Luau runtime and theengineglobal (constant flagsisClient,isServer,isDebug,engine.ecs.component, read bycomponent/DeclarationReader.hpp, andengine.ecs.system, read bysystem/SystemDeclarationReader.hpp); a system declares theresourcesandeventsit uses, given to scripts byctx.resourcesandctx.events(plain-data ones only), through theecsDynamicResourcesandDynamicEventsparameters; it knows noPlugin. The host and the App may be destroyed in either order.plugin/holdsScriptingPlugin, theecs::Pluginthat owns aScriptHostand, frombuild(), requires the entry points (Config::main/server/client, defaultmain: main, then server, then client by side); only they and what they require run, a missing default entry warns onstd::cerr, a missing explicit one throws.ScriptHostseals itself before the first module (setup forms,Runtime::sandbox(), deep freeze ofengine) and owns aluau::ModuleLoader(shareGlobalsoff, one global table per file) and sets the owner of declarations to the module's chunk namescripts/<key>.modules/(rtype::scripting::modules) holds therequirepath logic:ScriptPath(pure parser of a require string) andScriptResolver(finds the file insidescripts/: aliases,init.luau, exact case, no escape; theluau::ModuleLoadercallback;docs/scripting/plan.mdD10).exceptions/holdsScriptLoadException, thrown when a script cannot be loaded, sincebuild()cannot return aResult. It linkscore,ecsandluau. Design indocs/luau/ecs-bridge-plan.md.tests/<module>/— GoogleTest unit tests, one folder per module, each with its ownxmake.lua.examples/<category>/.../<Name>/— standalone examples, each with its ownxmake.lua, grouped in folders of any depth (e.g.examples/graphic/render/vulkan/VulkanInstance/). Everyxmake.luaunderexamples/is an example named after its folder. They are only built when enabled (see Commands).docs/— design documentation (e.g.docs/Plugins.mdfor the libraries and their dependencies,docs/ecs/features/17-hierarchy.mdfor parents and children,docs/Input.mdfor the event and input pipeline,docs/physics/design.mdfor the physics,docs/audio/design.mdfor the audio,docs/Sprites.mdfor atlases and animations,docs/Tilemap.mdfor tilemaps and parallax,docs/Text.mdfor MSDF text,docs/Editor.mdfor the editor,docs/Shaders.mdfor game shaders,docs/CapsuleFormat.mdfor the capsule file format,docs/engine/design.mdfor theEngine, its build order and reloads;docs/benchmarks/for the library and format comparisons behind a choice)..github/— CI workflow and issue templates..agents/skills/— agent skills (.claude/skills/symlinks to it).
Each module has its own xmake.lua, included from the root xmake.lua. Add new sources under the
matching module: plugin-*, contract-*, core, ecs, network, replication, engine, platform-glfw, render-vulkan,
audio-miniaudio, luau and aylo-runtime glob
**.cpp in their own folder.
Dependency rules¶
Dependencies always point towards the contracts and ecs, never away from them:
core ← ecs, contract-*
contract-* ← platform-*, render-*, audio-* (loaded by the engine, built before the executables)
ecs, contract-* ← plugin-* (loaded by the engine, built before the executables)
luau ← scripting
network ← replication
ecs ← replication, scripting
scripting, replication, plugin-transform, plugin-input ← engine ← executables, examples
coredepends on no other project target;ecsdepends oncoreonly.coreis static and keeps no global state, so a copy in each binary is harmless.luau,network,replication,scriptingandengineare static libraries, linked into the executable, because no plugin, backend or contract links them. They may keep state (the Luau VM, sockets), which would be duplicated by a shared library linking them: the build refuses it (rulertype.static_modulesin the rootxmake.lua).ecsand the contracts stay shared: they hold the registries and the type information plugins and backends share, so every binary must see one copy. A static module marks its exports withRTYPE_<LIB>_API, which expands to nothing through the public defineRTYPE_<LIB>_STATIC.networkdepends on Asio only (private): never on the ECS, a plugin or any other project target.replicationdepends onecsandnetworkand is the only module that knows both; the renderer, the platforms andluaunever include its headers.- A contract depends on
coreand glm only (contract-rendereralso oncontract-platform, asIRenderertakes anIPlatform): never on the ECS or a plugin. A type of the ECS never goes in a contract, and what a contract type needs from the ECS is declared in the plugin that uses it. - The platforms, renderers and audio backends link their contract only: neither the ECS nor a plugin. An audio backend
never depends on a platform or a renderer, nor they on it. miniaudio never leaves
audio/miniaudio/: no header outside it includes<miniaudio.h>. - A plugin depends on
core,ecs, glm, the contracts and plugins it uses, plus its own private packages (Jolt, nlohmann_json, glslang, stb: no public header includes them). Never add a dependency on aplatform-*,render-*,audio-*orluautarget to it. The plugins form a graph without cycles:plugin-graphicsknows no plugin that draws, and each of them is ordered against it only. A resource several plugins fill is taken as aResAppend. - Modules exchange contract types only (
rtype::contract::platform::Event,rtype::contract::platform::input::Key...). GLFW never leavesplatform/glfw/: no header outside it includes<GLFW/glfw3.h>or uses aGLFW_*code. - A platform module and a renderer module never depend on each other: what a renderer needs from a window that is
specific to its graphics API goes through the matching
interop-*target, which both sides depend on (seedocs/Backend.md). - The executables link no plugin and no backend: the
Engineloads thoseproject.luaunames fromplugins/next to the executable and<game>/plugins/. Each library exports one entry point (RTYPE_PLUGIN_LIBRARY, orRTYPE_LIBRARYfor a backend, which knows no ECS). Seedocs/Plugins.md. enginelinkscore,ecs,luau,scripting,replication, and nothing depends on it but the executables, the examples and its tests. It links no plugin and no contract: it loads them, and a program can still add its own throughEngineConfig::addPlugins.