Docs
Documentation
45 guides to every part of Ductane 1.6.0, in reading order: start with the sample, then the frame loop, then whatever your game needs. Search them with ⌘K.
Start
Get startedAdd Ductane to a Swift package, run the sample game, play it by script and check it.The sample gameDuctaneSample, the small first-person game that ships with the engine — how to run it, its controls, its environment variables and how its code is split.Your first gameA new Swift package that depends on Ductane, a minimal GameLoop, and the window and FrameRenderer set-up that puts it on screen.
The frame loop
GameLoopThe protocol a game implements — its requirements, what the engine owns and what the game owns, frame slots, and the order of a frame.Fixed timestepFixedTimestep runs the simulation in identical steps however frames arrive, and interpolation keeps the drawing smooth between them.Running hiddenKeep the simulation running while the window is hidden, draw frames into a texture with no window, and run a game as a headless check.CameraThe first-person Camera, the third-person OrbitCamera, their view matrices, and the reversed-Z projection with an infinite far plane that every Ductane frame is drawn through.
Rendering
Loading meshesLoad USD, glTF and other formats with MeshLoader, laid out to match your pipeline, with bounds, materials, node transforms and generated tangents.Materials and texturesRead a file's metallic-roughness materials with Material and TextureSlot, load their maps once with TextureStore, and keep color and data textures apart.ShadowsCascaded sun shadows with ShadowMap and ShadowCascades, spot-light shadows in a ShadowAtlas, and point-light shadows in ShadowCubes.Clustered lightsPoint and spot lights with PunctualLight, checking a level's light budget with LightSet, and per-fragment selection with ClusterGrid and ClusteredLights.Sky and environmentA ProceduralSky as radiance by direction, prefiltered into an EnvironmentMap for image-based lighting, and how the sample draws and lights with both.The sky by the hourDaySky sets a sky by the time of day — sun, sky colors, moon and exposure from one number — SkyPass draws it with the stars, the moon's phase, aurora and a rainbow, and CloudPass lays volumetric clouds over it.Tone mappingThe HDR scene target, ToneMapping's exposure in stops and its three curves, and why the interface is drawn after the tone map.ParticlesParticleRecipe, ParticleSystem and ParticleEmitter simulate on the fixed step; ParticleRenderer draws sparks and dust into the HDR scene.DecalsDecalSet keeps marks left on surfaces, aged and faded on the fixed step; DecalRenderer draws them as quads cut from a DecalAtlas, after the opaque scene.Many copiesDraw many copies of the same meshes with one draw per submesh per kind, using InstanceBatches and InstanceBuffer, with shadows through a self-drawing ShadowMap batch.Level of detailMeshDetail makes simpler tiers of a mesh when it loads and picks the coarsest one a distant copy can use without a visible change.CullingSkip what a view cannot see with Frustum and BoundingBox — five planes under an infinite far plane — for the camera and for each shadow pass.Graphics settingsGraphicsSettings is a player's trade of looks for speed, with Low, Medium and High presets, saved with Codable; SceneScaling draws the scene smaller than the window and scales it up.The HUDHUDRenderer draws text, rectangles, lines, rings and polygons in screen space, after tone mapping, so interface colors land exactly as authored.Loading screensLoadingScreen stands in front of a world while it loads, with a title, a subtitle and a bar that only climbs, then holds, fades and says when to hand the player control.
Characters
Skeletons and clipsLoad a rigged character's skeleton and animation clips from USD or glTF, pose it each frame, cross-fade between clips and hand the joint palette to a vertex shader.Skinned characters on the GPUSkinnedModel loads a skinned USD or glTF character once, SkinnedInstance gives each copy its own pose, and SkinningPass skins them in a compute pass so your ordinary pipelines can draw them.Moving a figureFigureMotion turns a body's speed, heading and footing into the clips to sample each step, eased and on one stride, and StrideAlignment measures where each gait's stride lines up.CharacterControllerA first-person body with feet — walking, stepping up, gravity, jumping, crouching and sliding, standing on moving and turning platforms, and being pushed.Finding a wayNavigationGrid gives a character a path over the ground and the floors a CollisionMesh makes — round walls, up stairs and ramps, down off ledges — built off the main thread round the player.Hanging things off jointsAttach a lantern to a hand or a turret to a hull with TransformHierarchy, keep a thing's extent in a Volume, and hit-test volumes with a ray or a segment.
World
Levels and the editorLevel, the engine's versioned JSON level format, and LevelEditor, an editor a game embeds to change its own levels while it runs.Worlds from a fileWorldFile is the description a world editor writes beside a scene's props — placements, ground, sky and clock, weather, sounds, markers — and WorldPackage opens the .usdz that carries it, so a game draws and walks the world as its author saw it.Drawing a worldWorldRenderer draws a world exported by a world editor — ground, props and scattered copies, sky and clouds, shadows, lights, water, effects, weather, fog and the seasons — the way the editor's own viewport draws it.The edge of the worldWorldBoundary is a dome or walls round a whole map that nothing leaves, and a net under the ground that puts anyone who falls through back where they last stood — drawn by BoundaryRenderer as a lattice, a grid, an energy field or a haze.Showing the wayWaymark draws the way to a place — a line over the ground along the way a player can walk, and a beam at the place — and WaymarkScan sends a ring out from the player that outlines what is worth finding through walls, with an icon and its distance.WeatherWeather as a few numbers — a kind, a severity, wind, snow lying, wet ground, ground fog — changed by a seeded schedule on a shared clock, drawn by WeatherRenderer, CloudPass and VolumetricFog, heard through Soundscape, and laid on a game's own surfaces by DuctaneWeather.h.The world's clockWorldClock runs the day, the season and the moon from one shared time, so every player sees the same hour; FallColors and Foliage turn a wood through the year, and Sway moves foliage and cloth in the weather's wind.AudioAudioEngine plays positional one-shots and looping sounds tied to a place, and the character controller and level supply what a footstep needs to sound right.MusicMusicPlayer plays a game's score, one track looped or a playlist in turn, faded in and out, under the player's music and main volume settings and quiet while the game is in the background.Input and settingsRead keyboard, mouse and controller through InputState, add your game's own actions, let players rebind keys and pad buttons, and keep sensitivity, invert, dead zones and head bob in PlayerSettings.Controller calibrationMeasure each thumbstick at rest with PadMeasurement, keep the result in PlayerSettings so a drifting or worn controller stays playable, and tell a pad that stopped sending from a stick being held.SavingSaveStore keeps any Codable value between runs, atomically, in a place that works sandboxed or not; PlayerSettings is the settings every first-person game needs.
Your game's name
The splashSplashScreen shows the engine's tile on a black ground with Made with Ductane beneath it, fading in and out, skippable without eating the key that skipped it.The markEngineMark is the engine's mark as geometry, a cobalt tile with Du in white, drawn in your HUD at any size and checked against the SVG files in Brand/ by a test.
Checking your game
Scripted walksPlay the sample by script — keys, seconds and pad buttons — read where the feet ended up, and how the engine checks its recorded walks before every change.Recorded framesDraw a frame with no window using FrameRenderer.render(into:), and how the engine compares its recorded frames pixel by pixel before every change.Measuring performanceRead what a frame cost with FrameTimes, show it with FrameRateReadout and FrameTimesAverage, measure memory with MemoryUse, and time a fixed Flythrough route the same way every run.