Skip to content

Plugins ​

Most of Kiln is plugins. CorePlugins is the set nearly every game uses; the rest are opt-in.

ts
import { createApp, CorePlugins, CameraPlugin, savePlugin, SpriteAnimationPlugin } from 'kiln'
import { PhysicsPlugin } from 'kiln/physics'

createApp(config).use(CorePlugins, CameraPlugin, PhysicsPlugin)

In CorePlugins ​

PluginGives youPage
CorePluginTime, RngDeterminism
RenderPluginScene, Camera, Renderer, MeshRef, instancing, interpolationRendering
InputPluginInput, ActionMap, scripted inputInput
AssetsPluginAssets, ModelAssets
TimerPluginTimer, Lifetime, DelayedTimers and tweens
TweenPluginTweens, easeTimers and tweens
UiPluginUi, UiClickHUD and UI
DebugPluginThe Tweakpane inspector (dev builds only)Debug panel

These are headless-safe and cost nothing when unused: the render plugin only draws once the app starts on a canvas, and the debug panel does nothing headless or in production.

Opt-in ​

PluginImportPage
CameraPluginkilnCamera
savePlugin({ ... })kilnSaving
SpriteAnimationPluginkilnAnimation
SkeletalAnimationPluginkilnAnimation
PhysicsPlugin / physicsPlugin({ gravity })kiln/physicsPhysics

The camera rig takes over the camera and saving needs configuration, so neither is on by default.

Configuring core plugins ​

Several core plugins have a configurable form. Use it instead of the default in CorePlugins by listing the plugins yourself:

ts
import { CorePlugin, renderPlugin, inputPlugin, DEFAULT_ACTIONS, AssetsPlugin, TimerPlugin, TweenPlugin, UiPlugin, debugPlugin } from 'kiln'

createApp(config).use(
  CorePlugin,
  renderPlugin({ background: 0x87ceeb, fov: 50 }),
  inputPlugin({ actions: { ...DEFAULT_ACTIONS, dash: ['KeyQ', 'Pad:RB'] } }),
  AssetsPlugin, TimerPlugin, TweenPlugin, UiPlugin,
  debugPlugin({ open: false }),
)

Community plugins ​

kiln add <name> copies a community plugin's source into src/plugins/<name>/, where it is yours to read and change. See Community plugins.

Writing your own ​

A plugin is plugin((app) => { ... }). See Prefabs and plugins.