Appearance
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
| Plugin | Gives you | Page |
|---|---|---|
CorePlugin | Time, Rng | Determinism |
RenderPlugin | Scene, Camera, Renderer, MeshRef, instancing, interpolation | Rendering |
InputPlugin | Input, ActionMap, scripted input | Input |
AssetsPlugin | Assets, Model | Assets |
TimerPlugin | Timer, Lifetime, Delayed | Timers and tweens |
TweenPlugin | Tweens, ease | Timers and tweens |
UiPlugin | Ui, UiClick | HUD and UI |
DebugPlugin | The 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
| Plugin | Import | Page |
|---|---|---|
CameraPlugin | kiln | Camera |
savePlugin({ ... }) | kiln | Saving |
SpriteAnimationPlugin | kiln | Animation |
SkeletalAnimationPlugin | kiln | Animation |
PhysicsPlugin / physicsPlugin({ gravity }) | kiln/physics | Physics |
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.