PanosK92/SpartanEngine
Acerca de
Un motor de videojuegos con un renderizador totalmente bindless e impulsado por GPU, que ofrece iluminación global trazada por caminos en tiempo real, trazado de rayos por hardware y una simulación física que funciona a 200 Hz. Desarrollado a lo largo de más de 12 años de I+D.
Juegos y emulaciónCrecimiento de estrellas medido
- in 24h
- +2
- in 7 days
- +15
- in 15 days
- +26
- in 1 month
- +85
Cambios netos en períodos que se solapan, no totales diarios. Los datos no disponibles se dejan en blanco. Las estrellas indican interés, no calidad.
README.md
Original
AAA-scale worlds, open source.
Started before AI and developed alongside me while in the game industry.
12YEARS IN DEVELOPMENT |
1ENGINEER |
600+ENGINEERS ON DISCORD |
200 HzVEHICLE SIMULATION |
| PLATFORMS | GRAPHICS APIS | ||||||
Windows |
Linux |
macOS |
Web |
DirectX 12 |
Vulkan |
Metal |
WebGPU |
Overview
Most open-source engines stall the moment you leave a small demo room. Spartan is built for a different league. It streams a seamless 33 × 25 km island carpeted in 11+ million instanced trees, undergrowth and rocks at 200+ km/h with zero traversal stutters at 60+ FPS — while running real-time ray-traced lighting, volumetric atmosphere, an FFT ocean, live traffic and a 200 Hz racing-sim vehicle model on top of a virtualized, GPU-driven C++ renderer.
And it is no longer just a renderer — it ships everything a finished game needs:
| Editor | Lua and visual scripting code or node graphs for gameplay |
Standalone runtime | Game builder packages a world into a distributable game |
Steam achievements, stats and rich presence |
The bundled worlds show the range, from Game, a playable racing game across the island of Zakynthos, to path-traced interiors, a car showroom and a real-time studio human showcase. Its rendering technology ships in Godot Engine and S.T.A.L.K.E.R. Anomaly, it features in a published programming book, and more than 600 engineers follow its development on Discord.
[!IMPORTANT] Built for veterans. Spartan is one engineer's engine, so there is no support queue and no one-to-one help. There is documentation, a Lua scripting guide and a codebase written to be read. If you are a high-agency engineer who can take it from there, you can ship with it.
Showcase
![]() |
|
| SKIN · Christensen-Burley subsurface scattering, dual-lobe skin specular, 4K micro-pores, 3D stubble, Marschner hair and refractive eyes ▶ Click to run it live in your browser (WebGPU, recent Chrome or Edge) |
|
![]() |
|
| ZAKYNTHOS · a seamless 33 × 25 km island with 7.5M+ full-3D trees (11M+ total scattered instances), 200+ spline roads, towns, live traffic, volumetric clouds and an FFT ocean — streamed at 200+ km/h at 60+ FPS with zero traversal stutters | |
![]() |
![]() |
| HUMAN · real-time character in a dark studio with subsurface skin, refractive eyes, procedural blinking and XPBD cloth | SHOWROOM · LaFerrari on a mirror-black turntable inside a dark architectural atelier |
![]() |
![]() |
| SPONZA · ReSTIR path tracing, no light probes, no bake | LIMINAL OFFICE · procedural and streamed, path traced, no bake |
All real-time captures. Every world is fully simulated: walkable, interactive and drivable.
Features
Open-world streaming33 × 25 km worlds and 11M+ foliage instances streamed at 200+ km/h with zero hitching at 60+ FPS. |
No bake, one drawReSTIR path-traced GI, hardware RT reflections & shadows, and GPU-driven virtualized geometry in a single indirect draw per pass. |
200 Hz simulationRacing-sim vehicle dynamics, Pacejka tires, thermal brakes and aero inside a general-purpose engine. |
Expand a section for the full breakdown.
Lighting and global illumination · Hybrid, ReSTIR PT and Reference path tracer
Choose among three lighting modes in Render Options → Lighting. Both path tracing modes require hardware ray tracing.
- Hybrid uses rasterized deferred lighting with optional ray-traced reflections and shadows.
- ReSTIR PT uses path tracing with spatiotemporal reservoir resampling for real-time multi-bounce global illumination.
- Reference path tracer traces independent camera paths and progressively averages samples while the scene is still, giving you a lighting reference for the other two modes. An optional NRD preview smooths diffuse lighting while preserving traced reflections and transmission. Switch it off to inspect the raw accumulation.
Lighting features
- Clustered deferred shading with a GPU-built logarithmic-Z grid and cone-vs-AABB culling for spots, so many local lights cost near-constant time per pixel
- IES photometric light profiles (LM-63): spot lights emit the measured beam of a real fixture, from car headlights with regulation cut-offs to architectural downlights, with correct lumens and candela across direct lighting, volumetric fog and path tracing. A feature usually reserved for the big commercial engines
- Hardware ray-traced reflections and shadows via ray queries
- Subsurface scattering for skin: a Burley diffusion profile with a per-channel radius softens and reddens the light under the surface, and ray-traced transmission lets it glow through thin parts such as ears
- Atmospheric scattering and image-based lighting with bent normals
- Volumetric clouds (Nubis-style) baked into the sky panorama, with cumulus and cirrus layers, multi-scatter lighting and aerial perspective
- Froxel volumetric fog: one view-aligned volume for height and distance fog, sun shafts and underwater caustic shafts, with temporal reprojection and shadowing
- FFT ocean with a Tessendorf spectrum and multi-cascade IFFT in compute, driving a camera-following clipmap with choppy displacement, dynamic normals and crest foam
- Screen-space shadows (inspired by Days Gone) and XeGTAO ambient occlusion
- Shadow map atlas with fast filtering and penumbra estimation
Rendering architecture · virtualized geometry, bindless resources, GPU-driven rendering, universal HLSL
Geometry, materials, textures, lights, transforms and bounds live in persistent, globally accessible buffers. No per-draw descriptor updates, no per-draw resource binding, no CPU-side draw loops.
- Zero-binding draw path: all per-draw data lives in a single bindless storage buffer, push constants carry only an index
- Single global vertex and index buffer for all geometry (inspired by id Tech), with vertex pulling that bypasses the Input Assembler and is shared by rasterization and ray tracing
- GPU-driven visibility buffer: two-phase Hi-Z occlusion culling (frustum, Hi-Z, backface cones) feeds a single mesh-shader visibility pass writing depth + 32-bit triangle/impostor IDs, followed by 8×8 tile classification and specialized indirect compute material resolve (opaque, alpha-tested, impostor) with analytic derivatives and zero 2×2 quad overshading
- Virtualized geometry organizes meshes into a hierarchy of clusters built with meshoptimizer. The renderer streams geometry in pages and selects detail based on how large each region appears on screen. Mesh shaders and vertex pulling are both supported.
- Bindless everything: materials, lights, samplers, uber shaders, minimal PSO permutations
- Universal HLSL compiled for Vulkan (SPIR-V), DirectX 12, Metal (Metal Shader Converter) and WebGPU (SPIR-V to WGSL through Tint)
- GPU-side asset processing: mip generation (FidelityFX SPD) and texture compression (Compressonator) at load time, not baked offline
- Unified deferred rendering: opaque and transparent surfaces share the same BSDF and render path
- Async compute for SSAO and screen-space shadows, in parallel with shadow rasterization
Performance, camera and post-processing · DLSS 4.5, XeSS, FSR 4 upscaling, FSR 3.1 frame generation, TAAU, VRS, GT7 tonemapping, HDR10
- NVIDIA DLSS 4.5 Super Resolution (SDK 310.9.1) and Intel XeSS 2.0.2 (SDK 3.0.2)
- AMD FSR upscaling (FSR SDK 2.4.0) on Windows with Vulkan and D3D12. Select AMD FSR in Renderer Options (or
r.antialiasing_upsampling 5). The SDK selects FSR 4.1.2 on supported Radeon GPUs and FSR 3.1 on other supported GPUs. Run dependency setup to fetch the signed loader and upscaler DLLs. Frame generation retains its existing, separate SDK. - AMD FSR 3.1 frame generation (FidelityFX SDK 1.1.4) on Vulkan and D3D12, works on any vendor's GPU, with frame-generation-aware fps, latency and frame rate limiting
- TAAU: temporal anti-aliasing with built-in upsampling, Halton jitter and variance-clipped history
- Variable rate shading and dynamic resolution scaling
- Foliage impostors let the virtualized geometry system draw distant trees with textured cards that preserve their silhouettes.
- Texture streaming within a fixed memory budget
- Custom GPU breadcrumbs for crash tracing and post-mortem debugging
- Physically based camera with auto-exposure and physical light units (lux, lumens and kelvin)
- Tonemappers: ACES, AgX and Gran Turismo 7 (default), with HDR10 output
- Post-processing: bloom, motion blur, depth of field, chromatic aberration, film grain and sharpening (CAS)
Vehicle dynamics at 200 Hz · Pacejka tires, thermal brakes, LSD, aero, force feedback
A full vehicle dynamics model running inside the PhysX fixed-timestep loop. Not a gameplay approximation: racing-sim fidelity inside a general-purpose engine.
| System | Details |
|---|---|
| Tires | Pacejka MF 5.2 with combined slip, thermal model, pressure, wear and multiple surfaces |
| Suspension | Convex hull sweep contact, spring-damper, anti-roll bars, bump stops, bump steer, camber and toe |
| Weight transfer | Geometric and elastic lateral split via roll centre heights and roll stiffness |
| Drivetrain | Engine torque curve, turbo, 7-speed gearbox, rev-match, open, locked and limited-slip differentials, RWD, FWD and AWD |
| Brakes | Thermal model with fade, front/rear bias and slip-threshold ABS |
| Aerodynamics | Drag, front and rear downforce, ground effect, DRS and rolling resistance |
| Steering | Ackermann geometry, high-speed reduction and self-aligning torque |
| Assists | ABS, traction control and handbrake |
| Integration | Semi-implicit Euler with consolidated net torque per wheel |
| Input | Controllers and steering wheels with haptic feedback |
| Camera | GT7-inspired chase camera with speed-based dynamics |
Engine systems · physics, animation, particles, weather, roads, Lua, audio, editor, profiler, VR
| System | Details |
|---|---|
| Platforms | Windows (DirectX 12 recommended, plus Vulkan), Linux & other platforms (Vulkan recommended) and macOS 26.0+ (Metal 4), with prebuilt binaries in every release; WebGPU on Windows through Dawn and in the browser through WebAssembly, see WebGPU and the web |
| Physics | PhysX with rigid bodies, character kinematics, vehicle dynamics and two-way cloth |
| Animation | Skeletal animation with keyframed clips, crossfade blending, four-bone skinning and two-bone IK with ground-aware foot planting |
| Particles | GPU-driven compute emission and simulation, depth-buffer collision and soft blending |
| Weather | Rain that soaks exposed surfaces, fills puddles and keeps covered areas dry, feeding tire grip |
| Procedural roads | Catmull-Rom spline roads with extruded profiles, terrain conforming, instanced props and path followers |
| Scripting | Lua 5.4 via Sol2 with the full engine API and lifecycle callbacks |
| Visual scripting | Node graph editor that compiles to Lua, with every engine API function as a node and a tutorial world |
| Audio | 3D positional audio, streaming, reverb and procedural engine synthesis via SDL3 |
| Cinematics | Camera cut sequencer with entity tracking, spline-driven movement and exact cut timing |
| Entity system | Component-based with transform hierarchies, prefabs and XML serialization |
| Threading | Hardware-aware thread pool with parallel loops and nested parallelism detection |
| Editor | Hierarchy, asset browser, inspector, script, visual script and shader editors, gizmos, profiler and memory viewer |
| Profiling | Nsight/RGP-style timeline with graphics and async compute lanes, RenderDoc integration and a GPU/CPU memory fragmentation map |
| Asset import | 40+ model formats (Assimp), 30+ image formats (FreeImage), 10+ font formats (FreeType) |
| VR (WIP) | OpenXR with multiview single-pass stereo on Vulkan and DirectX 12 |
Quick start
[!TIP] Just want to try it? Prebuilt binaries ship with every release; on first launch the World Launcher downloads the project assets and the worlds. Building from source? Getting started has the details.
Windows DirectX 12 recommended
# interactive launcher (press 1 for DirectX 12, 2 for Vulkan, 3 for WebGPU, O to open spartan.slnx)
generate_project_files.bat
# or non-interactive (d3d12 is recommended on Windows; use vulkan or webgpu for the other backends)
generate_project_files.bat vs2026 d3d12
Linux Vulkan recommended
tools/linux_dependencies.sh && ./generate_project_files.sh gmake vulkan && make config=release_x64
macOS 26.0+ Apple silicon, Metal 4
# needs Xcode 26, Homebrew (brew install cmake ninja) and the Metal Shader Converter
# from developer.apple.com/metal/shader-converter, then open spartan.xcworkspace
tools/macos_dependencies.sh && ./generate_project_files.sh xcode4 metal
Web WebGPU
To just try it: download spartan_web_webgpu_*.zip from the releases, unzip, run python serve.py and open the printed address in Chrome, Edge or Brave. To build it (full guide):
# the browser can't compile hlsl: build the windows webgpu backend and bake the WGSL shader cache once
# (setup downloads Dawn; or press [3] in generate_project_files.bat)
generate_project_files.bat vs2026 webgpu
.\binaries\spartan_webgpu_development.exe --bake-shaders
# needs emsdk (EMSDK or ~/emsdk), cmake, ninja and git, then open http://localhost:8080/spartan.html in a WebGPU browser
python tools/web_build.py deps
python tools/web_build.py engine --world pbr_materials_example.world
python tools/web_build.py serve
Build targets and architecture notes
The binaries/ folder keeps executables at the top level. Windows vendor DLLs live in third_party/ (Direct3D Agility components in third_party/d3d12/), compiler intermediates and Windows symbols in build/, preferences in settings/, diagnostics in logs/, and engine-wide generated data in cache/. Existing preferences, logs, and engine caches migrate on first launch without replacing files already at the new locations. World-specific bake caches remain alongside their world resources. data/, project/, and crashes/ retain their existing roles. steam_appid.txt stays beside the executable for local Steam development. Ship the vendor folder with the executable; game exports and Windows release archives preserve its structure. Python bytecode caches are excluded from game exports.
Project generation creates one target, spartan, built for the selected graphics backend in three configurations:
| Configuration | What it is | Executable |
|---|---|---|
development |
Optimized with full symbols, the default | spartan_<backend>_development.exe |
debug |
Unoptimized | spartan_<backend>_debug.exe |
release |
Optimized with link-time optimization | spartan_<backend>.exe |
The same executable is the editor and the game: -game hides the editor panels, and a game.xml written by Build Game next to the executable turns it into a packaged game that plays its start world directly. The full list of command-line arguments is in Getting started.
With dependencies already installed, regenerate without downloading them:
tools/premake5.exe --file=tools/premake.lua --skip-setup vs2026 d3d12
# macOS
tools/premake5 --file=tools/premake.lua --skip-setup xcode4 metal
Engine and world boundary. There is no game layer in C++. source/world/WorldSystems.cpp installs the world lifecycle hooks: camera controls, vehicle render submissions, breakable trees and the optional world systems (ambient wildlife, ambient atmosphere, road details, layered road surfaces). Vehicle physics and state live under source/car, vehicle MCP commands in source/mcp/McpCommandsCar.cpp, and traffic, race drivers, route drivers, car resets and skid marks are regular components in source/world/components. The optional world systems are off by default; a world turns them on through the WorldSystems Lua table from its companion script, the .lua with the same name in the world's resource folder (project/game_resources/scripts/game.lua for game.world), which runs on every load before the roads are built. Worker model imports publish their entity hierarchy through World::EntityBatch::Commit() after construction succeeds.
Physics. Scene stepping and contact observation use game-independent callbacks; the game installs vehicle contact handling. Vehicle state is opaque to engine consumers, while the existing Physics authoring and Lua API remains compatible.
Asset ownership. World saves record native asset ownership in OwnedResources. Automatic cleanup only removes unreferenced files recorded there; unlisted files, shared libraries, sculpt data and generated caches keep their separate lifetimes. Legacy worlds acquire ownership of referenced assets when saved and do not prune unrelated legacy files.
Component attributes. Attributes exposed for editing go through the component's setters. Raw copy-only or derived fields are read-only; use the named authoring properties for edits.
Play lifecycle. Play startup captures all authored transforms before any component starts, with both phases spread across frames. Stopping play drains completed worker batches before restoration and removal. World unload cancels staged work and clears renderer scene references and temporal history while preserving device lookup tables.
Documentation
| Getting started Build, run, command-line flags and the binaries/ layout |
Architecture The engine loop, subsystems, threading, events and profiling |
Worlds and entities Components, the .world format, prefabs and resources |
Lua scripting Script lifecycle, companion scripts, the full API and visual scripting |
| Rendering Frame pass order, bindless GPU-driven design, RHI, shaders, materials |
Physics and vehicles PhysX, cloth, the 200 Hz car model, .car files, AI, input |
Engine systems Animation, audio, navigation, networking, terrain, weather, cinematics, XR, Steam |
Console variables The cvar system and every registered cvar |
| Editor Panels, shortcuts, undo and the game builder |
MCP bridge Driving the live engine from AI agents and tools |
Testing and CI Smoke tests and the build pipeline |
Code style Conventions for contributions |
| WebGPU and the web The fourth RHI, native through Dawn and in the browser through WebAssembly |
In the wild
| Godot Engine Integrates Spartan's TAA Source → |
S.T.A.L.K.E.R. Anomaly Ships a rendering addon built on Spartan's source ModDB → |
Published book Jesse Guerrero's beginner programming book features Spartan's code and community Amazon → |
Origin A portfolio piece at the University of Thessaly under Professor Fotis Kokkoras |
Projects built on Spartan code can be featured here. Get in touch →
Ready for games?
Yes. Older coverage, like "The BEST Game Engine You SHOULDN'T Use", describes an engine that no longer exists. Back then Spartan was a renderer. Today it has the editor, scripting, standalone runtime, packaging and Steam support to ship — and on open-world scale, streaming throughput and real-time rendering it operates in a league well beyond typical open-source engines.
The one thing that hasn't changed is support: if you need hand-holding, pick something else. If you don't, Spartan is ready.
Community
|
Discord Rendering deep dives and work in progress, with 600+ engineers. Contribute Contributors get exclusive perks designed to accelerate learning. Sponsor Funds the hosting behind the one-click setup. |
![]() Podcast · Exploring the tech world and beyond, conversations across cutting-edge industries, on YouTube and Spotify |
License
[!NOTE] Released under the Spartan Engine License 2.0. Free for noncommercial use, and free for commercial use until a product earns $1M, for any team under $25M a year. No sign-up, no approval.
| Who | What you pay |
|---|---|
| Hobbyists, students, noncommercial projects | Nothing |
| Organizations under $25M a year (revenue plus funding) | Nothing until a product earns $1M, then 3% of revenue above $1M |
| Organizations at $25M a year or more | Custom agreement, get in touch |
| Selling Spartan itself as an engine, SDK, or hosted service | Custom agreement, get in touch |
License summary
Use, modify, and redistribute the engine, including reusing its code in other projects. Keep the copyright notice identifying Panos Karabelas and the license with redistributed code; compiled distributions must carry them in documentation or accessible legal notices. No splash screen or logo is required.
Each product keeps the terms of the license version it first shipped under, for its lifetime. One-time buyouts are available on request. Third-party components retain their own licenses, and copies previously released under MIT retain their existing permissions.
See license.md for the complete terms and the license FAQ for plain-language answers.
Built by Panos Karabelas · 12 years and counting
Explorar proyectos relacionados
Cargando…






