How turanszkij/wickedengine works
Purpose and Build Surface
Wicked Engine is a C++17 cross-platform 3D engine, embeddable framework, standalone scene editor, and Lua-scriptable runtime. The root build entry is CMakeLists.txt; the Windows solution is WickedEngine.sln. The engine is exposed as a static-library-style API through WickedEngine/WickedEngine.h and built by WickedEngine/CMakeLists.txt.
Application Entry Points
The primary shipped application is the editor, with platform launchers at Editor/main_Windows.cpp, Editor/main_SDL2.cpp, and Editor/main_MacOS.mm; its orchestration class is Editor/Editor.cpp. Consumer application templates start in Samples/Template_Windows/main.cpp, Samples/Template_Linux/main.cpp, or Apple/iOS equivalents. All host applications create wi::Application, attach a native window, activate a render path, then repeatedly run the engine frame loop.
Runtime Orchestration and UI
WickedEngine/wiApplication.cpp is the lifecycle boundary: initialization, window/frame execution, active render-path management, and engine subsystem coordination. Render paths separate application presentation from engine rendering: WickedEngine/wiRenderPath.h, WickedEngine/wiRenderPath2D.cpp, and WickedEngine/wiRenderPath3D.cpp. Editor tools operate on that runtime through docking-style component windows, notably Editor/Editor.cpp, Editor/HierarchyWindow.cpp, and Editor/ComponentsWindow.cpp.
Scene, ECS, Assets, and Import
The scene layer owns entities, components, serialization, and scene composition: WickedEngine/wiScene.h, WickedEngine/wiScene_Components.cpp, and WickedEngine/wiScene_Serializers.cpp. WISCENE is the native persisted scene format; Content/models/*.wiscene are runtime/editor inputs. The editor imports external OBJ, FBX, glTF/GLB, and PLY into scene data via Editor/ModelImporter.h, Editor/ModelImporter_GLTF.cpp, and Editor/ModelImporter_FBX.cpp. Resource loading/caching is bounded through WickedEngine/wiResourceManager.cpp.
Rendering and GPU Boundary
WickedEngine/wiRenderer.cpp converts scene state into GPU work; WickedEngine/wiGraphicsDevice.h is the graphics abstraction. Concrete backends are DirectX 12 (WickedEngine/wiGraphicsDevice_DX12.cpp), Vulkan (WickedEngine/wiGraphicsDevice_Vulkan.cpp), and Metal (WickedEngine/wiGraphicsDevice_Metal.cpp), selected by platform/arguments. HLSL shader sources and CPU/GPU shared layouts reside in WickedEngine/shaders/—for example WickedEngine/shaders/ShaderInterop_Renderer.h, WickedEngine/shaders/objectPS.hlsl, and WickedEngine/shaders/tonemapCS.hlsl. Shader compilation is encapsulated by WickedEngine/wiShaderCompiler.cpp and the offline compiler entry WickedEngine/offlineshadercompiler.cpp.
Simulation, Effects, and Media
Physics is integrated through the engine-facing boundary WickedEngine/wiPhysics_Jolt.cpp and embedded Jolt implementation under WickedEngine/Jolt/Physics/PhysicsSystem.cpp; scene components feed bodies/constraints and simulation results return to transforms. GPU-driven effects are first-class renderer inputs, including emitted particles (WickedEngine/wiEmittedParticle.cpp), hair (WickedEngine/wiHairParticle.cpp), ocean (WickedEngine/wiOcean.cpp), terrain, voxel grids, and Gaussian splats. Audio and video services are provided by WickedEngine/wiAudio.cpp and WickedEngine/wiVideo.cpp; bundled FAudio supports audio on applicable platforms.
Scripting, Input, and Platform Services
Lua is embedded in WickedEngine/LUA/ and surfaced through WickedEngine/wiLua.cpp; *_BindLua.cpp files expose application, scene, render, input, audio, physics, and resource APIs. Scripts can control the same global/separate scenes and render paths used by C++. Input is abstracted in WickedEngine/wiInput.cpp, with SDL and platform-specific providers including WickedEngine/wiSDLInput.cpp. External runtime dependencies/infrastructure are primarily native graphics APIs, SDL2 on Linux, Apple Metal frameworks, Vulkan, and DX12 rather than networked services.
Main entry points: wiScene.h Scene and ECS · wiApplication.cpp Application lifecycle · wiRenderer.cpp Renderer · Editor.cpp Scene editor
Components 21
Build Surface
- Root build · Top-level cross-platform build entry.
CMakeLists.txt - Engine library build
WickedEngine/CMakeLists.txt - Engine API · Static-library-style public engine surface.
WickedEngine/WickedEngine.h
Host Applications
- Editor launchers
Editor/main_Windows.cpp - Scene editor · Docking-style editor orchestration and tools.
Editor/Editor.cpp - Consumer templates
Samples/Template_Windows/main.cpp
Engine Runtime
- Application lifecycle · Owns initialization, windows, frame execution, and active render path.
WickedEngine/wiApplication.cpp - Render paths · Separates application presentation from 2D/3D rendering.
WickedEngine/wiRenderPath.h - Input service
WickedEngine/wiInput.cpp - Lua scripting · Bindings expose engine application, scene, rendering, and service APIs.
WickedEngine/wiLua.cpp - Physics integration
WickedEngine/wiPhysics_Jolt.cpp - Audio and video
WickedEngine/wiAudio.cpp
Rendering
- Renderer · Converts scene state and effects into GPU work.
WickedEngine/wiRenderer.cpp - Graphics device · Selects DX12, Vulkan, or Metal backend by platform and arguments.
WickedEngine/wiGraphicsDevice.h - Shader sources
- Shader compiler · Compiles runtime and offline shader variants.
WickedEngine/wiShaderCompiler.cpp - GPU effects · Particles, hair, ocean, terrain, voxel grids, and Gaussian splats.
WickedEngine/wiEmittedParticle.cpp
Scene and Content
- Scene and ECS · Owns entities, components, composition, and serialization.
WickedEngine/wiScene.h - WISCENE serialization
WickedEngine/wiScene_Serializers.cpp - Model import · Imports OBJ, FBX, glTF/GLB, and PLY into scene data.
Editor/ModelImporter.h - Resource manager · Bounds resource loading and caching.
WickedEngine/wiResourceManager.cpp
Connections 24
- Root build → Engine library build: builds
- Engine library build → Engine API: exports
- Editor launchers → Scene editor: start
- Scene editor → Application lifecycle: hosts
- Consumer templates → Application lifecycle: embed
- Application lifecycle → Render paths: activates
- Application lifecycle → Input service: coordinates
- Application lifecycle → Renderer: runs per frame
- Scene editor → Scene and ECS: edits
- Scene editor → Model import: uses
- Model import → Scene and ECS: creates scene data
- Scene and ECS → WISCENE serialization: persists
- Scene and ECS → Resource manager: references
- Scene and ECS → Physics integration: feeds bodies and constraints
- Physics integration → Scene and ECS: updates transforms
- Lua scripting → Application lifecycle: controls
- Lua scripting → Scene and ECS: controls
- Render paths → Renderer: presents through
- Scene and ECS → Renderer: provides render state
- GPU effects → Renderer: contribute GPU work
- Renderer → Graphics device: submits GPU work
- Shader compiler → Shader sources: compiles
- Renderer → Shader sources: uses programs and layouts
- Application lifecycle → Audio and video: coordinates