Concepts

Packages

How the engine divides into packages, what each one costs in a build, how they depend on each other, and which to install for what.

Install npm install @driftengine/core

DriftEngine is a set of npm packages under the @driftengine scope, all released together on one version line. A game installs @driftengine/core and adds the others as it needs them.

PackageWhat it is
@driftengine/ai Provider-neutral intelligence sessions, typed tools and context, and an agent loop that does not wait
@driftengine/animation Skeletons, clips, poses and the graphs over them: sampling as a pure function of a caller-supplied time
@driftengine/assets Model readers and the streaming loader for the .drft container
@driftengine/audio Layered stems, synthesis, rhythm analysis and positional placement
@driftengine/capture A video to a playable scene, on the player's device: the models it runs and the stages that use them
@driftengine/chemistry Thermochemistry of bulk matter: elements, species, substances and what they turn into
@driftengine/core The runtime of DriftEngine, a WebGPU game engine with a WebGL2 fallback: renderer, loop, input, cameras, scene graph and physics
@driftengine/create Starts a DriftEngine game: a Vite and TypeScript project, its instructions for a coding agent, and the engine's skill
@driftengine/drft The .drft container: a streaming format for baked 3D scenes
@driftengine/editor The model of a scene editor: a tree of what exists, an inspector over what is selected, and play-in-editor
@driftengine/entities Entities with generational identity, component storage, systems and scenes
@driftengine/media Clip encoding and frame delivery for recording what the engine draws
@driftengine/native-host The engine on a native window and a native WebGPU device, with no browser between them
@driftengine/nav A navigation mesh: geometry to walkable convex polygons, and a straight line across them
@driftengine/network A transport seam, rewind and replay, lockstep and an authoritative host, on the fixed-step loop
@driftengine/package Builds an installable application from a game built on the engine
@driftengine/physics Collision shapes, spatial queries and swept kinematic collision
@driftengine/script The drift/* capability bindings: what this engine provides to DriftScript, and the only place the two are coupled
@driftengine/splats Gaussian splat captures: readers, an off-frame sort, and a pass that composes into the scene
@driftengine/terrain Heightfields: a query that answers the surface that is drawn, and patches that meet without cracks
@driftengine/texture DriftTexture: a texture as a compiled, sampled field rather than an image
@driftengine/tools The editor panels a shipped game can carry, and the command stack that makes their edits undoable
@driftengine/ui2d The 2D layer: batched sprites, sheets, tilemaps, and a retained interface tree over them
@driftengine/xr WebXR sessions, stereo views, controller input and hand joints, over both backends

What core is, and what it brings with it

@driftengine/core is the runtime: the loop, the renderer and its passes on both backends, the scene graph and culling, cameras, input, geometry builders, maths, storage and preferences. It depends on two other packages and re-exports both, so you can import their names from core:

  • @driftengine/physics in full. The cameras and the ribbon builder use its collision sweep, so core cannot be built without it, and re-exporting it means PhysicsWorld and CharacterController come from the same import as createRenderer.
  • @driftengine/drft for the mesh data type every package shares, MeshData. Its validator, validateMeshData, is imported from @driftengine/drft itself.

Everything else is optional, and a package that builds on core declares it as a peer dependency.

Every package on one version

Each package pins the exact version of every engine package it depends on, so a project uses one version for every @driftengine package it installs. Upgrade them together:

npm install @driftengine/core@latest @driftengine/audio@latest @driftengine/assets@latest

A mismatch is caught by npm at install time, as an unmet peer dependency, which is a better place to find it than a missing export at run time.

What each costs

The engine's size gate builds each entry point on its own and fails the engine's CI if the gzipped size moves more than 3% from the figure it holds. These are those figures, read from the gate at the release this site documents:

What is importedGzipped
@driftengine/drft on its own14.3 KB
@driftengine/core, creating a renderer910.1 KB
core + the transform gizmo914.8 KB
core + @driftengine/cloth926.9 KB
core + @driftengine/audio916.3 KB
core + @driftengine/animation916.2 KB
core + @driftengine/script950.4 KB
@driftengine/ai on its own1.7 KB
@driftengine/media on its own11.3 KB
@driftengine/texture on its own2.3 KB
@driftengine/nav on its own8.8 KB
@driftengine/tools on its own5.6 KB
@driftengine/capture on its own71.3 KB
core + @driftengine/splats926.8 KB
core + @driftengine/terrain911.4 KB
core + @driftengine/ui2d920.1 KB
core + @driftengine/assets937.2 KB
core + audio + positional sound918.4 KB
@driftengine/xr on its own10.6 KB
@driftengine/physics on its own47.0 KB
@driftengine/entities on its own0.9 KB
@driftengine/network on its own2.4 KB
@driftengine/editor on its own10.4 KB
@driftengine/chemistry on its own18.1 KB
chemistry, with its presentation helpers20.4 KB

Most of core is shader source, generated WGSL for every combination of features the lit pass can be built with. Shader text barely minifies, which is why the optional packages look small beside it.

Features that live inside the lit pass cannot be packages, so they are compiled in only when a quality option asks for them: physically based maps, spot and area lights, clustered lighting, image-based lighting, depth of field, screen-space reflection, temporal antialiasing, colour grading and decals. A driver compiles the text it is given, so a feature that is off costs no GPU time.

Which package for what

You want Install
A renderer, a loop, input, cameras, collision and rigid bodies @driftengine/core
Models from glTF, OBJ, FBX, USD, STL, 3MF or Blender @driftengine/assets
Music, sound effects, positional audio @driftengine/audio
Skeletal animation, blending, IK @driftengine/animation
Sprites, tilemaps and an interface tree @driftengine/ui2d
Entities, components and systems @driftengine/entities
Multiplayer: lockstep, prediction, rollback @driftengine/network
Navigation meshes and pathfinding @driftengine/nav
Heightfield terrain @driftengine/terrain
Gaussian splat captures @driftengine/splats
Textures as compiled programs, streamed @driftengine/texture
A video turned into a scene @driftengine/capture
Recording video of the game @driftengine/media
VR and AR through WebXR @driftengine/xr
Language-model agents with typed tools @driftengine/ai
Chemistry of bulk matter: fire, smoke, reactions @driftengine/chemistry
Editor panels inside a shipped game @driftengine/tools
The scene editor's model @driftengine/editor
DriftScript bindings to the engine @driftengine/script
Desktop and Android builds of the game @driftengine/package
Running with no browser @driftengine/native-host

Three packages that need nothing else

@driftengine/physics, @driftengine/entities and @driftengine/chemistry import no other engine package. A server that runs a simulation, or a worker that steps one, can import any of them without pulling a renderer into its module graph. That's what makes an authoritative multiplayer host possible in plain Node.

Built JavaScript or TypeScript source

Every package ships compiled JavaScript with declaration files, and that is what a bundler and Node find by default. Every package also ships its TypeScript source behind the drift-source export condition, for a project that depends on a checkout of the engine and wants an edit to it live with no build; Installation covers that set-up.

This page's source, on GitHub