Krotox Engine › Docs › Krotox Manual › Getting Started

Krotox at a glance: how the 2D engine fits together

The parts of Krotox Engine and how they connect: the editor, the C++ core, Vulkan 1.3 rendering, Box2D physics, Mono C# scripting, and the files a project is made of.

Krotox Engine is a 2D game engine written in C++17. You build a game in the Krotox Editor, write gameplay in C#, and ship it to Android or Windows from the same project. This page explains the moving parts so the rest of the manual makes sense.

The big picture

PartWhat it isWhere you meet it
EditorA dockable desktop app built with ImGui. Scene view, hierarchy, inspector, asset browser, tile painting, build settings.Everything you do by hand.
Engine coreThe C++17 static library every game runs on. Holds the scene, the renderer, physics, audio and the asset manager.Invisible, but it is what your game *is* at run time.
RendererVulkan 1.3 only, using dynamic rendering and synchronization2. 2D sprites, shapes, text and lines are batched into as few draw calls as possible.The Viewport and your finished game.
ECSEnTT entity-component system. An entity is an ID; everything it does comes from the components you add.Hierarchy and Properties panels.
2D physicsBox2D 3.x, stepped on a fixed clock (60 Hz by default) and interpolated for drawing.Rigidbody 2D, colliders, joints.
ScriptingMono C#. Hot reload in the editor on desktop; Full-AOT (compiled ahead of time) on Android.Script components and your .cs files.
Audiominiaudio, with Master, SFX, Music and UI mixer groups.Audio components and AudioCommand.
PackagingAssets, scenes, shaders and font atlases are compressed with miniz into one data.pak.Build Settings.

Entities and components

Krotox does not use deep class hierarchies for game objects. A game object is an entity: a 64-bit ID with a name. What it looks like and how it behaves is decided by the components on it:

Components are grouped by dimension, and the editor labels them with coloured badges: [2D] in emerald, [UI] in amber, [CORE] in slate. If an entity mixes components that cannot work together, the hierarchy shows an amber warning and the inspector offers a one-click fix.

Think of components as data and your scripts as behaviour. A script reads and writes components; it rarely needs to store copies of what a component already holds.

The two C# assemblies

Scripting uses two assemblies:

Every script is a class that derives from KrotoxEngine.Entity. See Writing scripts & the lifecycle.

What a frame looks like

Every frame of a running game goes through the same order. Knowing it explains most "why did that happen first?" questions:

  1. Destroys requested since the last frame are applied.
  2. Transforms are updated.
  3. Input bindings fire.
  4. OnUpdate(ts) runs on every script.
  5. While the physics accumulator has time left: OnFixedUpdate() runs, Box2D steps, and collision and trigger callbacks fire.
  6. Animation and audio update.
  7. OnLateUpdate(ts) runs on every script.
  8. Coroutines advance, and input records this frame's key states.

The full detail is in the lifecycle reference.

The files a project is made of

FileWhat it holds
MyGame.ktxprojThe project file (YAML): name, settings, build options, a stable project ID.
*.ktxA scene: every entity and component in it.
*.prefabA reusable entity tree you can place many times or spawn from code.
*.metaA sidecar next to every asset. It keeps the asset's 64-bit ID stable across machines and version control.
*.ktxassetA ScriptableObject data asset (shared data such as weapon stats).
*.csYour C# scripts.
EngineSettings.yamlMachine-wide editor settings (theme, Android toolchain paths). Lives next to the editor, never inside a project.
Commit the .meta files together with their assets. They are how a scene keeps pointing at the right texture after a teammate pulls your changes.

How a game ships

When you build, Krotox packs the scenes and assets that the game uses into data.pak and places it next to a small runtime:

See Building for Android and Windows builds, resolution & scaling.

Where to go next