mote.graphics3d.addFogVolume(t)mote documentation
Everything you need to build games with mote: the engine, the Lua API and the Blender add-on. The guide comes first; the reference of all 1648 functions follows.
What is mote#
mote is a game engine for 2D and 3D games. The engine is a single executable,
mote.exe; games are written in Lua 5.4 and talk to the engine through the
global table mote. Blender is the level and character editor, through the
mote editor add-on.
- Rendering — deferred PBR, cascaded and local shadows, area lights, global illumination, reflections, glass, volumetric fog, water, sky and clouds, TAA upscaling, post-processing, a retro mode; a full 2D renderer on top.
- Physics — 3D and 2D rigid bodies, joints and motors, ragdolls, vehicles, buoyancy, fracture, collision layers.
- Animation — glTF skinning and node animation, state machines, layers, foot IK, root motion, ragdoll blending; 2D skeletons with mesh deformation.
- Scenes — levels exported from Blender keep their hierarchy, physics, lights, scripts and animation clips.
- Networking — UDP transport and a ready-made client/server multiplayer layer.
- Audio — playback, synthesis, 3D sound, buses and effects.
The last part of this documentation is the API reference: every function the engine
exposes, with its arguments. An argument marked ? is optional.
Installation#
- Put
mote.exein any folder. - Create a folder for your game with a file
main.lua. - Run the game: drag the game folder onto
mote.exe, or from a terminal:
mote.exe path\to\mygame
Without arguments, mote.exe runs, in this order: a game fused into the
executable, a game.lpak next to it, or main.lua in the current folder.
The Blender add-on#
- Blender 3.6 or newer: Edit → Preferences → Add-ons → Install…, choose
mote_level_exporter.py, enable mote editor. - In the add-on preferences set the path to
mote.exe(used by Export and run). - The panels are in the 3D viewport sidebar (N), tab mote.
Installing a newer version over the old one replaces it.
Your first game#
-- main.lua
local g3 = mote.graphics3d
local t = 0
function mote.load()
mote.render.apply{ tonemap = "agx", ssao = 1, taa = true }
end
function mote.update(dt)
t = t + dt
end
function mote.draw()
g3.setCamera(0, 2, -5, 0, 0.5, 0, 60)
g3.setLight(-0.4, -1, 0.3)
g3.setSunColor(1, 0.95, 0.9, 3)
g3.setColor(0.4, 0.4, 0.42)
g3.box(0, -0.05, 0, 10, 0.1, 10)
g3.setColor(0.9, 0.3, 0.2)
g3.push()
g3.translate(0, 0.6, 0)
g3.rotate(0, t * 45, 0)
g3.box(0, 0, 0, 1, 1, 1)
g3.pop()
mote.graphics.print("Hello, mote", 20, 20)
end
Edit main.lua while the game runs: the change is picked up without a
restart.
Game structure and the frame#
function mote.load() end -- once, at start function mote.update(dt) end -- game logic; dt = seconds since the last frame function mote.draw() end -- describe this frame function mote.keypressed(key) end function mote.mousepressed(x, y, button) end function mote.resize(w, h) end function mote.quit() end
Frame order: input → mote.update → network → mote.draw → render.
Physics steps only when you call mote.physics3d.update(dt) or
level:update(dt).
Rendering is immediate: everything in the frame — camera, lights, objects — is
described again in every mote.draw. What is not drawn this frame is not on screen;
nothing has to be created or destroyed.
Project layout#
mygame/
main.lua entry point
*.lua your modules: require("enemies") loads enemies.lua
models/*.glb glTF 2.0 models
textures/*.png|jpg
sounds/*.ogg|wav
levels/*.json scenes exported from Blender
All paths are relative to the game folder.
Conventions#
| Quantity | Convention |
|---|---|
| Axes | right-handed, Y up. An object faces +Z; its right is −X; its up is +Y. The camera looks along its own +Z. |
| Distance | metres |
| Time | seconds |
| Euler angles | degrees, applied yaw (Y), then pitch (X), then roll (Z): (rx, ry, rz) or rot = {rx, ry, rz} |
| Quaternions | x, y, z, w; in tables quat = {x, y, z, w} |
| Colour | 0..1 per channel, linear (textures are stored as sRGB) |
| Scale | a number (uniform) or {x, y, z} |
| Light | lumens (lumens) or candela (intensity) |
| Physics bodies | integer ids |
| 2D | pixels, x right, y down; 2D rotations in radians |
glTF models and Blender scenes are converted to these axes when loaded or exported.
Developer tools#
Available when a game runs from a folder; absent from packaged games.
| Key | Action |
|---|---|
| F3 | performance overlay: frame time graph, GPU time per pass, draw calls, triangles, lights, shadows, culling, Lua memory and garbage per frame, Lua profiler, 3D brush left changed at the end of the frame (with file and line) |
| F4 | physics colliders |
| F5 | reload main.lua |
| F6 / F7 | pause updates / step one frame |
| F8 | slow motion: 1 → 0.25 → 0.05 → 1 |
The Lua profiler (shown in F3) samples the running function every 1000 VM instructions and lists the six most expensive functions, by own time ("self") and including callees, in milliseconds per second. No code changes are needed.
Garbage. Lua runs its collector in generational mode, which deals with short-lived
tables in small steps. F3 shows how many kilobytes of garbage each frame makes; a steady few KB is
fine, hundreds of KB per frame are worth fixing. The usual sources are option tables and vectors
built inside update and draw: keep them in locals and refill them, or use
a transform instead of {pos, rot} tables.
local opts = { color = {1, 1, 1}, rot = {0, 0, 0} } -- made once
function mote.draw()
opts.rot[2] = t * 90 -- refilled each frame
g3.box(0, 1, 0, 1, 1, 1, opts)
end
| Call | Description |
|---|---|
mote.devtools.watch(name, fn) | a line in the F3 overlay showing fn() |
mote.devtools.keys.overlay = "f9" | rebind (keys: overlay, colliders, reload, pause, step, slow) |
mote.devtools.enable(false) | turn the tools off for this game |
mote.profile.lua(on) / luaReport(n) / luaReset() | the Lua profiler from code |
mote.profile.scope(name, fn, ...) | time a section of code |
mote.profile.gc() → {usedKB, allocKBPerFrame} | Lua memory in use and garbage per frame |
mote.devtools.trackBrush(on) | track the 3D brush without opening F3 |
mote.devtools.brushLeaks() → {{what, "file:line"}} | what the brush was left as at the end of the last frame |
Camera and drawing#
local g3 = mote.graphics3d g3.setCamera(0, 2, -6, 0, 1, 0, 60) -- eye, target, vertical FOV (degrees) g3.setCamera(headTransform, 75) -- or from a transform (looks along its +Z)
| Call | Description |
|---|---|
g3.setCamera(ex, ey, ez, tx, ty, tz, fov?) | camera at e looking at t; fov defaults to 60 |
g3.setCamera(transform, fov?) | camera placed by a transform |
g3.camera | the camera as a transform; updated by every setCamera; objects can be parented to it |
g3.setClipPlanes(near, far) | near and far clip planes |
g3.screenRay(sx, sy) → ox, oy, oz, dx, dy, dz | a ray through a screen pixel |
g3.worldToScreen(x, y, z) → sx, sy, depth | project a point; nil behind the camera |
The brush#
setColor, setMaterial, setEmissive,
setSurface, setTransparency and setModelShading apply to
everything drawn after them. Every frame starts with the defaults: white, no emission, metallic 0,
roughness 0.5, no surface. Three ways to keep a colour from leaking into the rest of the frame:
g3.push("all") -- saves the transform and the brush
g3.setColor(1, 0, 0)
g3.setEmissive(4, 0, 0)
g3.sphere(x, y, z, 0.1)
g3.pop() -- everything is restored
model:draw(x, y, z, { color = {1, 0.5, 0.5} }) -- tint for this call only
-- primitives take their look per call too; the brush is not touched
g3.box(0, 1, 0, 1, 1, 1, { color = {0.8, 0.2, 0.1}, rough = 0.3 })
g3.sphere(2, 1, 0, 0.5, { color = {1, 1, 1}, metal = 1, rough = 0.1 })
g3.cylinder(4, 1, 0, 0.3, 2, { emissive = {0, 3, 6}, rot = {90, 0, 0} })
| Primitive option | Effect |
|---|---|
color = {r, g, b, a} | base colour for this call |
metal = m, rough = r | metallic and roughness for this call |
emissive = {r, g, b} | emission for this call |
surface = s | false | a surface for this call, or none |
rot = {rx, ry, rz} | quat = {x, y, z, w} | rotation of the primitive, degrees or quaternion |
box,
cube, sphere, plane, cylinder, cone,
capsule, torus, tube, disc, ring,
pyramid, wedge, stairs, roundBox,
icosphere, prism, hemisphere and shape.
If something is coloured wrong, open F3: when a frame ends with the brush changed, the
overlay names the file and line that changed it.Transforms and hierarchy#
A transform is a scene node: a local position, rotation and scale relative to an optional
parent. Its world matrix is the parent's world matrix times its own. Transforms are accepted by
model:draw, character:draw, g3.setCamera and
g3.applyTransform. Level objects (obj.transform) and the camera
(g3.camera) are transforms too.
local T = mote.transform
local tank = T.new{ pos = {0, 0, 10}, rot = {0, 45, 0} }
local turret = T.new{ parent = tank, pos = {0, 1.2, 0} }
local barrel = T.new{ parent = turret, pos = {0, 0.2, 1.5} }
turret:rotate(0, 30 * dt, 0) -- around its own Y axis
tank:moveLocal(0, 0, 5 * dt) -- forward along its own +Z
local x, y, z = barrel:getWorldPosition()
local fx, fy, fz = barrel:forward()
Creating#
| Call | Description |
|---|---|
mote.transform.new{pos, rot, quat, scale, parent, name} | a new transform; every field is optional |
mote.transform.is(v) | true for a transform |
mote.transform.eulerToQuat(rx, ry, rz) → x, y, z, w | degrees to quaternion |
mote.transform.quatToEuler(x, y, z, w) → rx, ry, rz | quaternion to degrees |
mote.transform.lookQuat(dx, dy, dz) → x, y, z, w | rotation that points +Z along a direction |
Local values (relative to the parent)#
| Call | Description |
|---|---|
t:getPosition() / t:setPosition(x, y, z) | position |
t:getRotation() / t:setRotation(rx, ry, rz) | rotation, degrees |
t:getQuat() / t:setQuat(x, y, z, w) | rotation, quaternion |
t:getScale() / t:setScale(s | sx, sy, sz) | scale |
t:set{pos, rot, quat, scale, parent, name} | several values at once |
World values#
| Call | Description |
|---|---|
t:getWorldPosition() / t:setWorldPosition(x, y, z) | world position |
t:getWorldRotation() / t:setWorldRotation(rx, ry, rz) | world rotation, degrees |
t:getWorldQuat() / t:setWorldQuat(x, y, z, w) | world rotation, quaternion |
t:forward() / t:right() / t:up() | unit vectors of +Z, −X, +Y in world space |
t:toWorld(x, y, z) / t:toLocal(x, y, z) | convert a point between local and world space |
t:matrix() / t:localMatrix() | 16 numbers, column-major |
t:setWorldMatrix(m16) | set the world matrix |
Motion and hierarchy#
| Call | Description |
|---|---|
t:move(dx, dy, dz) | move in the parent's axes |
t:moveLocal(dx, dy, dz) | move along its own axes |
t:rotate(rx, ry, rz) | rotate about its own axes, degrees |
t:rotateWorld(rx, ry, rz) | rotate about the world axes, degrees |
t:lookAt(x, y, z, upx?, upy?, upz?) | point +Z at a world point |
t:setParent(p, keepWorld?) | parent: a transform, level object, character or nil. keepWorld (default true) keeps the world placement; false keeps the local values |
t:getParent() / t:getName() / t:setName(s) / t:copy() | hierarchy and identity |
setParent raises an error when the link would create a cycle.Transform stack#
The stack holds the current matrix applied to everything drawn in 3D after it: primitives, static and animated models, registered meshes, lights and decals. Every frame starts with the identity matrix; the stack is 64 levels deep.
g3.push()
g3.translate(x, 0, z)
g3.rotate(0, yaw, 0)
g3.box(0, 0.25, 0, 1.2, 0.5, 1.2) -- local coordinates
g3.push()
g3.translate(0, 0.5, 0)
g3.rotate(-20, 0, 0)
g3.box(0, 0.2, 0.6, 0.25, 0.25, 1.2)
g3.addLight{ kind = "point", pos = {0, 0.2, 1.4}, lumens = 800 }
g3.pop()
g3.pop()
| Call | Description |
|---|---|
g3.push("all"?) / g3.pop() | save / restore the matrix; with "all" also the brush |
g3.origin() | identity matrix |
g3.translate(x, y, z) | translate |
g3.rotate(rx, ry, rz) | rotate about the current axes, degrees |
g3.rotateQuat(x, y, z, w) | rotate by a quaternion |
g3.scale(s | sx, sy, sz) | scale |
g3.applyTransform(v) | multiply by a transform, a level object, or a table of 16 numbers |
g3.getTransform() → m16 | the current matrix |
g3.transformPoint(x, y, z) → x, y, z | a point through the current matrix |
registerMesh mesh drawn inside a transform goes through a CPU copy; prefer instancing for thousands of draws.First-person camera and weapons#
local g3, T = mote.graphics3d, mote.transform
local head = T.new{ pos = {0, 1.7, 0} }
local gun = T.new{ parent = g3.camera, pos = {-0.25, -0.22, 0.45} } -- right hand: x < 0
local yaw, pitch = 0, 0
function mote.load()
mote.mouse.setGrabbed(true)
mote.mouse.setVisible(false)
end
function mote.update(dt)
local mx, my = mote.mouse.getDelta()
yaw = yaw - mx * 0.15
pitch = math.max(-89, math.min(89, pitch + my * 0.15))
head:setRotation(pitch, yaw, 0)
local kb = mote.keyboard
local f = (kb.isDown("w") and 1 or 0) - (kb.isDown("s") and 1 or 0)
local s = (kb.isDown("d") and 1 or 0) - (kb.isDown("a") and 1 or 0)
local fx, _, fz = head:forward()
local rx, _, rz = head:right()
head:move((fx * f + rx * s) * 4 * dt, 0, (fz * f + rz * s) * 4 * dt)
end
function mote.draw()
g3.setCamera(head, 75)
weapon:draw(gun, { anim = "idle", time = mote.timer.getTime() })
end
g3.setCamera(head) copies the transform into g3.camera, so
everything parented to g3.camera follows the view. Recoil and sway are the local
position and rotation of gun. With physics, take the head position from a character
capsule (mote.physics3d.moveCharacter).
Primitives#
g3.box(x, y, z, w, h, d) g3.sphere(x, y, z, r) g3.plane(x, y, z, w, d) g3.cylinder(x, y, z, r, h) g3.cone(x, y, z, r, h) g3.capsule(x, y, z, r, h) g3.torus(x, y, z, R, r) g3.tube(x, y, z, rOut, rIn, h) g3.disc(x, y, z, r) g3.ring(x, y, z, rIn, rOut) g3.hemisphere(x, y, z, r) g3.pyramid(x, y, z, w, h, d) g3.wedge(x, y, z, w, h, d) g3.stairs(x, y, z, w, h, d, n) g3.roundBox(x, y, z, w, h, d, r) g3.icosphere(x, y, z, r) g3.prism(x, y, z, sides, r, h)
Coordinates are the shape's centre. An optional last table takes rot
(degrees), quat, segments, sides and top
(top radius of a cone).
g3.torus(0, 2, 0, 1.5, 0.3, { rot = {90, 0, 0}, segments = 48 })
g3.shape("capsule", x, y, z, { r = 0.3, h = 1.6, quat = {qx, qy, qz, qw} })
-- a collider of the same shape and parameters
local id = mote.physics3d.addShape("torus", "static", 0, 2, 0, { R = 1.5, tube = 0.3, rot = {90, 0, 0} })
A static collider follows the shape's triangles exactly; a moving one uses its convex hull.
Models#
local car = g3.loadModel("models/car.glb")
car:draw(x, y, z) -- position
car:draw(x, y, z, 2) -- position and uniform scale
car:draw(x, y, z, { rot = {0, 90, 0}, scale = 2 })
car:draw(transform) -- a transform, level object or character
car:draw(transform, { anim = "drive", time = t }) -- animated
car:draw(x, y, z, { anim = "run", time = t, blend = { anim = "walk", time = t, w = 0.3 } })
| draw option | Meaning |
|---|---|
rot = {rx, ry, rz} | rotation, degrees |
quat = {x, y, z, w} | rotation as a quaternion (instead of rot) |
scale = s | {sx, sy, sz} | scale |
offset = {x, y, z} | offset in local axes |
relativeTo = transform | coordinates are relative to a transform |
color = {r, g, b, a} | tint for this call |
anim = name | index | animation clip (index from 1) |
time = t | clip time, seconds |
loop = true | wrap the time (true) or clamp it (false) |
blend = {anim, time, w} | blend with a second clip, w = 0..1 |
Without anim a model is drawn from the GPU cache with one matrix. With
anim the pose is evaluated on the CPU this frame.
| Call | Description |
|---|---|
g3.loadModel(path) → model | load glTF / GLB |
model:animations() → {names} | clip names |
model:duration(anim) → seconds | clip length |
model:bones() → {names} | node names |
model:triangles() → {verts, indices} | triangles in model space |
model:pose() → pose | a pose for procedural animation, IK and ragdolls |
model:rootMotion(anim, t0, t1, bone?) → dx, dy, dz, dyaw | root movement between two clip times |
Supported glTF features: multiple meshes and nodes, node hierarchy, skinning, node and bone
animation, morph targets, metallic-roughness PBR materials, KHR_texture_transform,
a second UV set. Missing tangents are computed at load time.
Loading and streaming assets#
Textures of all models are decoded in parallel on every core; identical images in different
files are loaded once; textures larger than the limit (4096 px on the longest side by default)
are downscaled while loading. mote.level.load decodes the textures of all its
models before creating objects.
| Call | Description |
|---|---|
g3.setTextureMaxSize(n) | texture size limit for models loaded afterwards; 0 = no limit |
g3.preloadModels({paths}) → n | decode the textures of several models ahead of time |
Background loading#
The synchronous loaders block the frame while they work. mote.loader decodes on
worker threads while the game keeps running; meshes are finished on the main thread when ready.
mote.loader.model("models/castle.glb", function(model, err) castle = model end)
mote.loader.image("ui/map.png", function(img) map = img end)
mote.loader.level("levels/act1.json", { navmesh = true }, function(level) lvl = level end)
function mote.draw()
if not mote.loader.idle() then
local done, total = mote.loader.progress()
mote.graphics.print(("Loading %d / %d"):format(done, total), 20, 20)
end
end
| Call | Description |
|---|---|
mote.loader.model(path, cb) / image(path, cb) / level(path, opts?, cb) | start a background load; cb(result, err) |
mote.loader.progress() → done, total | progress of the current batch |
mote.loader.idle() | true when nothing is loading |
g3.loadModelAsync(path) → handle | low level: handle:ready(), :result(), :error() |
mote.graphics.loadImageAsync(path) → handle | the same for images |
Materials and procedural textures#
| Call | Description |
|---|---|
g3.setColor(r, g, b, a?) | base colour; a < 1 makes it transparent |
g3.setMaterial(metallic, roughness) | PBR parameters |
g3.setEmissive(r, g, b) | emission of the next primitives (values above 1 glow) |
g3.setTransparency{transmission, ior, thickness, opacity, ...} | refractive glass or plain transparency |
g3.setModelShading(name, param?) | shading model: standard, skin, cloth, hair |
g3.newSurface{...} → surface | a set of maps (albedo, orm, normal, height) from files, a preset or a generator |
g3.setSurface(surface | nil) | use a surface for the next primitives |
g3.decal(image, x, y, z, nx, ny, nz, size, roll?, r?, g?, b?, a?) | a decal on the geometry |
Procedural materials#
Built-in materials are generated natively on all cores; a 512×512 material takes tens of milliseconds, so they can be built during play.
local wall, tiling = mote.texgen.preset("concrete", { seed = 3, size = 512 })
g3.setSurface(wall)
g3.box(0, 1.5, 4, 8, 3, 0.2)
g3.setSurface(nil)
Presets: wallpaper, carpet, ceiltile, paint, plaster, concrete, lino, damask, hotelcarpet,
wood, tile, polished, metal, flesh. Options: seed, size (power of
two, 16–2048), tiling, bump, color and any
newSurface key.
Noise fields for your own generators tile seamlessly and return a flat 1-based array of n×n values in 0..1, row by row:
| Call | Description |
|---|---|
mote.texgen.noise(n, cellsX, cellsY?, seed) | value noise |
mote.texgen.fbm(n, cells, seed, octaves?, gain?) | fractal value noise |
mote.texgen.perlin(n, cellsX, cellsY?, seed?) | gradient noise |
mote.texgen.worley(n, cellsX, cellsY?, seed?, kind?, jitter?) | cellular noise; kind: "f1", "f2", "edge", "cell" |
mote.texgen.white(n, seed) | white noise |
mote.texgen.surface{size, generate = fn(u, v), ...} | a surface from a Lua function returning r, g, b, height, rough?, metal?, ao? |
Lights and shadows#
g3.setLight(-0.4, -1, -0.3) -- sun direction
g3.setSunColor(1, 0.95, 0.9, 3) -- colour and strength
g3.setAmbient(0.02, 0.02, 0.03)
g3.setEnvironment{ sky = {0.45, 0.55, 0.75}, horizon = {0.75, 0.72, 0.7}, ground = {0.3, 0.28, 0.26}, drawSky = true }
g3.addLight{ kind = "point", pos = {0, 2.5, 0}, color = {1, 0.8, 0.6}, lumens = 800, range = 10, shadow = true }
g3.addLight{ kind = "spot", pos = {0, 4, 0}, dir = {0, -1, 0}, cone = {20, 30}, lumens = 1500 }
g3.addLight{ kind = "rect", pos = {0, 3.58, 2}, dir = {0, -1, 0}, right = {1, 0, 0}, width = 2.4, height = 0.6, lumens = 5000 }
Lights are added every frame in mote.draw and follow the transform stack.
| addLight key | Meaning |
|---|---|
kind | "point", "spot", "sphere", "tube", "rect" |
pos, dir, right | position, direction, width axis (rect, tube) |
lumens | intensity | luminous flux or candela |
range | reach, metres |
cone = {inner, outer} | spot cone or barn doors of a panel, degrees |
radius, length, width, height | size of area lights |
profile = id | photometric profile from g3.newLightProfile |
shadow, shadowPriority | shadow and its priority in the shadow budget |
Area lights (rect, tube, sphere) are integrated over
their shape: diffuse light uses the polygon form factor clipped at the horizon, specular uses an
LTC fit of GGX, so highlights take the shape of the lamp.
| Call | Description |
|---|---|
g3.newLightProfile(path) → id, peak | profile from an IES LM-63 file |
g3.newLightProfile{angles, values} | fn(deg) | profile from a table or a function |
mote.render.lights{clustered = true} | clustered lighting for hundreds of lights |
mote.render.shadows{...} | sun cascades |
mote.render.localShadows{budget, ...} | shadow-map budget for local lights |
mote.render.gi{...} | global illumination with a probe grid |
Image settings#
mote.render.apply{
tonemap = "agx", autoExposure = 0.18, bloom = 0.1,
ssao = 1, ssr = 0.7, ssgi = 0.5, taa = true,
motionBlur = 0.5, dof = 0, vignette = 0.3, grain = 0.02,
renderScale = 0.75, -- render at 75 % and upscale with TAA
}
Each key is independent; keys you leave out keep their values. Retro mode:
pixelate, vertexSnap, affine, colorDepth,
dither, posterize.
| Call | Description |
|---|---|
g3.setFog(r, g, b, density) | exponential fog |
g3.addFogVolume{shape, pos, size, density, color} | a local fog volume |
mote.graphics.setVolumetric(strength, density, phase) | volumetric light |
mote.render.lut(path | fn | nil, strength?) | a .cube 3D LUT (up to 129³) or one built from a function; applied after tonemapping |
mote.render.lutStrength(s) | LUT strength 0..1 |
GPU-driven rendering#
Static geometry is drawn by the GPU itself. Static models (their opaque parts), meshes
registered with registerMesh and drawn with drawMesh, and primitives
(box, sphere, cylinder and the rest) are cut
into clusters of up to 64 triangles once. Each frame, compute shaders test every cluster
against the camera frustum and against a depth pyramid of what is already drawn, and the
G-buffer is drawn with one call per texture set. Shadow maps are culled the same way. Nothing
needs to be set up: it is on by default, and the same code draws the same picture either way.
What it changes in practice:
- A primitive costs one small record instead of hundreds of vertices built on the CPU, so
thousands of
g3.box/g3.spherecalls a frame are fine. - Geometry hidden behind walls is not drawn (occlusion culling), which is what makes large indoor levels and cities cheap.
- Draw calls depend on the number of different texture sets, not on the number of objects.
Registering a mesh id again replaces its geometry on the GPU, and removeMesh
frees it, so worlds that stream chunks in and out (voxel terrain, tiles) keep a bounded pool.
Meshes with an LOD chain (setMeshLOD) keep the classic path, which picks the level.
Occlusion is two-phase: objects visible last frame are drawn first, a depth pyramid is built from them, and everything else is tested against it. Nothing that is visible is ever skipped, even when the camera jumps.
| Call | Description |
|---|---|
mote.render.gpuScene(on?) → on | turn GPU-driven drawing on or off; returns the state (false on hardware without it) |
mote.render.gpuSceneStats() → table | entries, clusters, drawn, culled, materials, shadowClusters, poolTriangles of the last frame; reads the GPU back, so use it for debugging only |
setVelocity, animated models, and all
primitives in a frame that has a mirror, water, probe GI, voxel GI or a reflection-probe bake
(those passes re-render the scene from another eye).
-- measure what the GPU culled
mote.render.gpuSceneStats() -- turns the counters on
function mote.update(dt)
local s = mote.render.gpuSceneStats()
print(s.drawn, "of", s.clusters, "clusters drawn")
end
Terrain#
local ter = mote.terrain.new(mote.terrain.preset("hills"))
ter:physics{ radius = 64 } -- streamed colliders around the drawn point
function mote.draw()
ter:draw(player.x, player.z) -- stream, build and draw chunks around a point
end
| Call | Description |
|---|---|
mote.terrain.preset(name) → cfg | dunes, hills, mountains, islands, mesa, plains |
mote.terrain.new(cfg) → terrain | terrain from a configuration |
ter:draw(x, z) | stream and draw around a point |
ter:height(x, z) / normal(x, z) / slope(x, z) / color(x, z) | surface queries |
ter:raycast(ox, oy, oz, dx, dy, dz, max?, step?) | ray against the surface |
ter:set{...} / ter:rebuild() | change settings; rebuild re-creates chunks and colliders |
ter:physics{tile, cell, radius, friction, perFrame} | heightfield colliders: tiles of tile m (32), sample spacing cell m (1), within radius m (64); at most perFrame new tiles per frame (4), the tile under the point always |
ter:physics(false) / updatePhysics(x, z) / physicsTiles() | remove, stream without drawing, count |
2D graphics#
local g = mote.graphics
local hero = g.loadImage("textures/hero.png")
function mote.draw()
g.clear(0.1, 0.1, 0.12)
g.setColor(1, 0.5, 0.2)
g.rectangle("fill", 20, 20, 100, 60)
g.circle("line", 200, 60, 30)
g.setColor(1, 1, 1)
g.draw(hero, 300, 100, 0, 2, 2) -- image, x, y, rotation (radians), scale
g.draw(hero, 400, 100, { scale = 2, color = {1, 0.3, 0.3} }) -- options, tint for this call
end
2D is drawn over the 3D frame. Colour, font, blend mode and line width are state; colour resets to white every frame, the font is kept.
g.push("all") -- saves transform, colour, font, blend, line width
g.setFont("bold", 32)
g.setColor(1, 0.2, 0.2)
g.print("TITLE", 20, 20)
g.pop()
g.print("Score", 20, 60, { font = "bold", size = 24, color = {1, 0.8, 0.2} })
g.print(longText, 20, 100, { width = 300, align = "center" })
Also: transforms (push, pop, translate,
rotate, scale, shear), canvases, shaders, 2D lights and
shadows (mote.light2d), cameras (mote.camera2d), tilemaps with
auto-tiling (mote.tilemap, mote.autotile, Tiled import), particles.
Pixel art#
local g = mote.graphics
g.setVirtualResolution(320, 180) -- 320×180, whole-number scaling, centred in the window
g.setPixelSnap(true) -- sprites and text land on whole virtual pixels
function mote.draw()
local mx, my = g.toVirtual(mote.mouse.getPosition())
g.draw(cursor, mx, my)
end
| Call | Description |
|---|---|
g.setVirtualResolution(w, h, {integer = true}) | draw 2D in a w×h space; scaled by the largest whole factor (integer = false allows fractions); outside it the clear colour shows; nil turns it off |
g.getVirtualResolution() → w, h, scale | current values or nil |
g.setPixelSnap(on) | move sprites onto whole pixels without resizing them |
g.toVirtual(x, y) | window pixel → virtual pixel |
g.getDimensions() | size of the 2D area (the virtual size when set) |
mote.gui and mote.ui work in virtual coordinates.2D skeletal animation#
local def = mote.skeleton2d.new{
bones = {
{ name = "root" },
{ name = "hip", parent = "root", y = -60 },
{ name = "thigh", parent = "hip", rot = 90, len = 30 },
{ name = "shin", parent = "thigh", x = 30, len = 30 },
},
slots = { { name = "leg", bone = "thigh", attachment = "leg" } }, -- draw order
attachments = {
leg = { type = "region", image = legImage, x = 15 },
cape = { type = "mesh", image = capeImage, verts = {...}, uvs = {...}, tris = {...}, bones = { "hip", "thigh" } },
},
ik = { { name = "foot", bones = { "thigh", "shin" }, bend = 1 } },
animations = {
walk = { duration = 1, bones = { thigh = { rotate = { {0, -20}, {0.5, 20}, {1, -20} } } } },
},
}
local hero = def:instance()
hero:play("walk", { loop = true, mix = 0.2 })
function mote.update(dt) hero:update(dt) end
function mote.draw()
hero:setIK("foot", targetX, targetY)
hero:draw(400, 300, { scale = 2, flipX = facingLeft })
end
Coordinates are screen-style: x right, y down, rotation in degrees clockwise. A mesh without weights gets automatic weights from the distance to its bones (the two nearest).
| Call | Description |
|---|---|
mote.skeleton2d.new(spec) → definition | a skeleton definition shared by instances |
mote.skeleton2d.loadSpine(path, {images}) → definition | Spine JSON 3.8 / 4.x: bones, slots, region and mesh attachments (weighted or not), rotate/translate/scale and attachment timelines, two-bone IK; curves become linear |
def:instance() → inst | an animated instance |
inst:play(name, {loop, mix, speed, track, alpha, onEnd}) | play a clip; higher tracks layer over lower ones |
inst:update(dt) / inst:draw(x, y, {scale, flipX, rot, color, debug}) | advance and draw |
inst:setIK(name, x, y, mix?) / inst:boneWorld(name) → x, y, rot | IK target, bone placement |
inst:setBone(name, {rot, x, y}) / inst:setAttachment(slot, name) | manual overrides |
g.drawTriangles(image, {x, y, u, v, ...}) | textured triangles in 2D |
Bodies and queries#
local P = mote.physics3d
P.setGravity(0, -9.81, 0)
P.newBox("static", 0, -0.5, 0, 50, 1, 50)
local crate = P.newBox("dynamic", 0, 3, 0, 1, 1, 1, 0.1, 0.8) -- restitution, friction
crate.owner = { name = "crate", hp = 30 } -- any value you like
function mote.update(dt)
P.update(dt)
local hit = P.raycast(0, 10, 0, 0, -1, 0, 20)
if hit and hit.body.owner then hit.body.owner.hp = hit.body.owner.hp - 1 end
end
function mote.draw()
local x, y, z = crate:getPosition()
g3.push()
g3.translate(x, y, z)
g3.rotateQuat(crate:getRotation())
g3.box(0, 0, 0, 1, 1, 1)
g3.pop()
end
A body is an object made by one of the new* constructors. They take the
same arguments as the add* functions, which return a plain integer id instead.
Both work everywhere: every physics function accepts a body or an id, P.bodyOf(id)
returns the object for any id, and ray hits and contact events carry the objects
(hit.body, contact.bodyA, contact.bodyB). Bodies of a level
exported from Blender have their level object as owner.
| Body type | Behaviour |
|---|---|
"static" | never moves |
"dynamic" | moved by forces and collisions |
"kinematic" | moved by setPosition / setRotation; pushes dynamic bodies |
Shapes: box, ball, capsule, cylinder, convex, trimesh (static only), heightfield,
autoConvex (decompose a model into convex parts), addShape (primitive
shapes). Body rotations are quaternions.
| Call | Description |
|---|---|
P.getPosition(id) / P.setPosition(id, x, y, z) | position |
P.getRotation(id) / P.setRotation(id, x, y, z, w) | rotation |
P.setVelocity / getVelocity / getAngularVelocity | velocity |
P.applyImpulse / applyForce / applyForceAtPoint / applyImpulseAt | forces |
P.setMass / setDamping / setCcd / wake | body settings |
P.raycast(ox, oy, oz, dx, dy, dz, max) → hit | {id, x, y, z, nx, ny, nz, distance} or nil |
P.sphereCast / P.capsuleCast | swept queries |
P.moveCharacter(id, dx, dy, dz, dt) → mx, my, mz, grounded | move a capsule with collisions, steps and slopes |
P.remove(id) | remove a body |
| Body object | Description |
|---|---|
P.newBox / newBall / newCapsule / newCylinder / newConvex / newTrimesh / newHeightfield / newGround / newSensorBox / newSensorBall → body | create a body object; arguments as the matching add* |
P.bodyOf(id) → body | the object for an id |
P.isBody(v) | true for a body object |
body.id / body.owner | the integer id; your own value |
body:getPosition() / setPosition / getRotation / setRotation / getVelocity / setVelocity / getAngularVelocity | state |
body:applyImpulse / applyForce / applyForceAtPoint / applyImpulseAt | forces |
body:setMass / getMass / setDamping / setCcd / wake / setGroups / setContactEvents | settings |
body:move(dx, dy, dz, dt) → mx, my, mz, grounded | character movement (kinematic bodies) |
body:draw(opts?) | draw the collider shape |
body:remove() / body:isValid() | remove; false once removed (also after P.remove(id)) |
Joints, ragdolls, vehicles#
local P = mote.physics3d
local hinge = P.addRevoluteJoint(post, door, 0, 1, 0, 0, 0, 0, 0.5, 0, 0) -- axis, anchor on A, anchor on B
P.setJointMotor(hinge, { velocity = 2.5, maxForce = 4000 })
P.setJointLimits(hinge, -1.2, 1.2) -- radians (hinge) or metres (slider)
local lift = P.addPrismaticJoint(base, platform, { axis = {0, 1, 0}, limits = {0, 3} })
P.setJointMotor(lift, { position = 2, stiffness = 6000, damping = 900 })
P.addRopeJoint(hook, weight, 3)
P.addSpringJoint(a, b, rest, stiffness, damping)
P.addFixedJoint(a, b)
P.setJointBreak(hinge, 5000)
for _, id in ipairs(P.pollBreaks()) do print("joint broke", id) end
Ragdolls from a model skeleton: model:pose():ragdoll{ mass = 70 }, or
character:die{...}.
local body = P.addBox("dynamic", 0, 1, 0, 1.8, 0.6, 4.0)
P.setMass(body, 1200)
local car = P.newVehicle(body, { engine = { power = 400, topSpeed = 30 }, wheels = {
{ x = -0.85, y = -0.25, z = 1.3, radius = 0.38, steer = true },
{ x = 0.85, y = -0.25, z = 1.3, radius = 0.38, steer = true },
{ x = -0.85, y = -0.25, z = -1.3, radius = 0.38, drive = true },
{ x = 0.85, y = -0.25, z = -1.3, radius = 0.38, drive = true } } })
P.vehicleControl(car, { throttle = 1, steer = 0.3, brake = 0, handbrake = false })
Also: buoyancy (setWater, setBuoyancy), force fields and explosions
(addField, explode).
Contacts, triggers, layers#
local P = mote.physics3d
P.setContactEvents(crate, 150) -- report hits stronger than 150 N
for _, c in ipairs(P.pollContacts()) do
-- c.a, c.b, c.force, c.x, c.y, c.z, c.nx, c.ny, c.nz
end
local zone = P.addSensorBox(0, 1, 5, 2, 2, 2)
for _, e in ipairs(P.pollTriggers()) do
if e.enter then print("entered", e.a, e.b) end
end
P.setGroups(id, P.layers.debris, P.layers.all - P.layers.player)
P.setGroups(id, P.layers.trigger, P.layers.player, false) -- events without a collision response
Destruction#
local wall = mote.ruin.box{ size = {6, 3, 0.4}, pos = {0, 1.5, 6}, material = "concrete", pieces = 70 }
local vase = mote.ruin.model(vaseModel, { material = "ceramic" })
wall:impact(x, y, z, dx, dy, dz, power)
wall:explode(x, y, z, radius, power)
wall:damage(x, y, z, radius, amount)
function mote.update(dt) mote.physics3d.update(dt); wall:update(dt) end
function mote.draw() wall:draw() end
Voronoi fracture, cracks along a connectivity graph, collapse of unsupported pieces,
re-fracture on hard impacts, small debris, and merging of settled rubble into one static mesh.
Materials: mote.ruin.materials(). Options: pieces, seed,
pattern, anchor, color, interior,
lifetime, fade, chips, maxLoose,
refracture, solid. Queries: raycast, owns,
events, info, reset, remove.
2D physics#
mote.physics mirrors the 3D API in 2D: box, circle, capsule, convex, polyline
and heightfield bodies; fixed, revolute, spring and rope joints; sensors; raycasts; collision
layers. Soft bodies and ropes: mote.softbody, mote.rope.
The add-on#
Panels in the 3D viewport sidebar (N), tab mote:
| Panel | Contents |
|---|---|
| mote: assets | game folder; export the selection as separate models, as one model or as a collection; Only changed models skips unchanged files |
| mote: object | role, script, tags, asset name, physics, navmesh, hidden in game, volume and path settings |
| mote: character | animation states and transitions, collider, character export |
| mote: level | level name, world, navmesh, markers, Export level, Export and run |
| In Blender | In the game |
|---|---|
| Mesh, curve with geometry, text | a level object with a model models/name.glb |
| Armature with meshes and actions | a character: models/name.glb and name.anim.json |
| Collection instance | a prefab; the collection is exported once |
| Curve with role Path | a path: level:path, level:pathPoint |
| Empty | a marker or a volume (trigger, fog); part of the hierarchy |
| Light, camera | a light; a camera for level:useCamera |
| Parent | the parent of the object's transform |
| Object keyframes (actions, NLA) | scene clips (see Scene animation) |
| Custom properties | obj.props |
Axes are converted from Blender's Z-up to mote's Y-up. Models go to models/,
the level to levels/name.json. Re-exporting while the game runs reloads the level
and its models in the game.
Levels in the game#
local lvl
function mote.load() lvl = mote.level.load("levels/house.json") end
function mote.update(dt) lvl:update(dt) end -- physics, clips, behaviours, events
function mote.draw() lvl:draw() end -- models, lights, world
Every Blender object is a level object with its own transform (obj.transform).
The Blender hierarchy is kept: moving a parent moves its children. Colliders of static and
kinematic objects follow their objects; dynamic bodies drive theirs.
local door = lvl:find("Door")
door:rotate(0, 90, 0)
local lamp = lvl:find("Lamp")
lamp:setParent(g3.camera) -- carry it with the view
for _, crate in ipairs(lvl:withTag("crate")) do crate:hide() end
Object methods#
| Call | Description |
|---|---|
obj:getPosition() / obj:setPosition(x, y, z) | world position |
obj:getRotation() / obj:setRotation(rx, ry, rz) | world rotation, degrees |
obj:getQuat() / obj:setQuat(x, y, z, w) | world rotation, quaternion |
obj:move(dx, dy, dz) / obj:moveLocal(dx, dy, dz) | move in world / own axes |
obj:rotate(rx, ry, rz) / obj:rotateWorld(rx, ry, rz) | rotate about own / world axes |
obj:lookAt(x, y, z) | point +Z at a point |
obj:forward() / obj:right() / obj:up() | world directions |
obj:toWorld(x, y, z) / obj:toLocal(x, y, z) | convert points |
obj:setParent(p, keepWorld?) | parent: another object, a transform or nil |
obj:getParent() / obj:children() | hierarchy |
obj:show() / obj:hide() / obj:setVisible(on) | visibility of the object and its children |
obj:play(clip, opts?) / obj:stop() / obj:isPlaying(clip?) | play a clip on this object only |
Fields: obj.name, obj.props, obj.tags[tag],
obj.model, obj.body, obj.light, obj.char,
obj.hidden, obj.size, obj.transform.
obj.x/y/z and obj.qx/qy/qz/qw hold the world placement and are
refreshed every frame; assigning them moves the object.
Level methods#
| Call | Description |
|---|---|
lvl:find(name) / lvl:withTag(tag) / lvl:each(fn) / lvl:byBody(id) | look objects up |
lvl:spawn(template, x, y, z) / lvl:remove(obj) | copy / remove an object |
lvl:use(obj, who) / lvl:nearestUsable(x, y, z, range, dx, dy, dz) | interaction |
lvl:path(name) / lvl:pathPoint(name, metres) | paths |
lvl:useCamera(name) | a camera from Blender |
lvl:characters() / lvl:spawnPoints(tag?) | characters, spawn points |
lvl:draw{world, lights, debug, navmesh} | draw; keys turn parts on or off |
Behaviours#
The Script field in Blender links an object to a behaviour; one instance per object.
mote.level.behavior("door", {
init = function(self, obj, lvl) self.open = false end,
use = function(self, obj, lvl, who) self.open = not self.open end,
update = function(self, obj, dt, lvl)
obj.transform:setRotation(0, self.open and 90 or 0, 0)
end,
enter = function(self, obj, other, lvl) end, -- triggers
leave = function(self, obj, other, lvl) end,
contact = function(self, obj, other, force, lvl) end, -- hits above the threshold
})
An object whose model file is missing is drawn as a box of its bounds.
Scene animation#
Object keyframes in Blender — doors, lifts, machinery, a cut-scene made of many meshes — are exported as tracks, one per object and clip, sampled per frame in the parent's space. Tracks with the same clip name are grouped, so one name plays the whole scene.
- Sources: the object's active action and the actions in its unmuted NLA tracks.
- The clip name is the NLA track name, or the action name when the track has a default name.
- The object name is removed from the clip name:
Open_Dooron Door andOpen_Frameon Frame both become clipOpen(separators_,.,|). - The active action of an object plays by itself, looping.
- Actions that only move armature bones belong to characters, not to the scene.
lvl:play("Open")
lvl:play("Intro", { loop = false, speed = 1, from = 0, onEnd = function(lvl, name) end })
lvl:stop("Intro") lvl:stop()
lvl:isPlaying("Open") lvl:clipTime("Open") lvl:setClipTime("Open", 1.5)
lvl.clips.Open.duration lvl.clips.Open.objects
obj:play("Spin", { loop = true })
A channel that does not change in a clip is not written, so that axis can be driven from code while the clip plays.
Characters#
In Blender: an armature with meshes and actions. The mote: character panel defines
states (a clip, or a blend by a parameter), transitions (by trigger, parameter, flag or end of
clip) and events (pose markers), and exports models/name.glb with
models/name.anim.json.
local hero = mote.character.load("models/hero.glb")
hero:play("run")
hero:set("speed", 3.5)
hero:trigger("jump")
hero:on("step", function(name, clip) playFootstep() end)
function mote.update(dt) hero:update(dt) end
function mote.draw() hero:draw(heroTransform) end
| Call | Description |
|---|---|
mote.character.load(path, opts?) → char | model and states from .anim.json; without the file every clip is a state |
char:play(state, fade?) | go to a state, fade in seconds (0.2) |
char:set(param, value) / char:trigger(name) | parameters and triggers for transitions |
char:on(event, fn) / char:onState(fn) | clip events and state changes |
char:update(dt) | advance the animation |
char:draw(transform, scale?) | draw at a transform or level object; stays upright (uses the yaw) |
char:state() / clip() / states() / clips() / setSpeed(k) | state queries |
IK, layers, root motion, ragdoll#
Pose pipeline: animation → layers → foot IK → ragdoll → your pose edits → draw.
hero:footIK{ maxStep = 0.45 } -- feet on stairs and slopes
hero:addLayer("upper", { mask = "Spine" }) -- upper body plays its own clip
hero:layerPlay("upper", "aim", { fadeIn = 0.2 })
hero:rootMotion(true)
local dx, dz, dyaw = hero:takeRootMotion(yaw, scale)
hero:die{ impulse = { ix, iy, iz }, bone = "Head" } -- ragdoll that keeps its momentum
hero:getUp(0.8)
hero:onPose(function(pose) pose:lookAt("Head", tx, ty, tz) end)
| Call | Description |
|---|---|
char:footIK{maxStep, ignore, legs, align} / footIKWeight(w) | foot IK and its weight |
char:addLayer(name, {mask, exclude, maskWeights, additive}) | a body-part layer |
char:layerPlay(name, clip, {fadeIn, fadeOut, loop}) / layerWeight / layerStop | layer control |
char:rootMotion(on) / takeRootMotion(yaw, scale) → dx, dz, dyaw | movement from the clip |
char:die{impulse, bone, mass} / flinch(impulse, bone, time) / getUp(time) | ragdoll |
legs = {{"thigh_l", "calf_l", "foot_l"}, ...}. Remove the character's capsule from physics before die.Menus and HUD#
local gui = mote.gui.new{ reference = { 1280, 720 } } -- designed for 1280×720, fitted to any window
gui:build{ type = "column", id = "menu", anchor = "center", width = 520, padding = 24, gap = 14,
{ type = "label", rich = true, align = "center", text = "[size=44][b]MY GAME[/b][/size]" },
{ type = "row", gap = 10, justify = "between",
{ type = "button", text = "New game", grow = 2, onClick = startGame },
{ type = "button", text = "Options", grow = 1, onClick = openOptions },
{ type = "button", text = "Quit", width = "25%", onClick = mote.quit } },
{ type = "slider", id = "volume", min = 0, max = 1, value = 0.8, onChange = setVolume },
}
gui:get("menu"):show{ fade = 0.4, slide = { 0, 40 } }
function mote.update(dt) gui:update(dt) end
function mote.draw() gui:draw() end
Widgets: column, row, panel, grid, scroll, label, button, textField, slider, checkbox, progress, image, spacer. Keyboard and gamepad-style navigation: Tab, arrows, Enter.
| Layout key | Meaning |
|---|---|
justify | main axis: start, center, end, between, around, evenly |
align / alignSelf | cross axis: stretch, start, center, end |
width / height | pixels, "50%" of the parent, or "fill" |
grow | share of the free space |
minWidth / maxWidth / minHeight / maxHeight | size limits |
gap / padding | spacing; padding = n or {l, t, r, b} |
anchor | top-level position: topleft, top, center, bottomright, ... |
| Call | Description |
|---|---|
gui:build(spec) / gui:get(id) | build from a table; find by id |
w:animate{alpha, dx, dy, scale, duration, ease, delay, onDone} | animate (ease names from mote.ease) |
w:show{fade, slide, pop} / w:hide{...} | transitions |
w:setText(s) / setValue(v) / getValue() / setVisible(on) / setEnabled(on) | widget state |
Rich text#
mote.text.icons.coin = coinImage
mote.text.richDraw("[b]Gold:[/b] [img=coin] [color=#ffd040]120[/color]", 20, 20, { width = 300, size = 20 })
Tags: [b], [color=name|#rrggbb], [size=N],
[img=name]. Text wraps by words when a width is given. In mote.gui,
use a label with rich = true. For debug panels drawn every frame there is the
immediate-mode mote.ui.
Localization#
mote.locale.load("en", "lang/en.json") -- {"menu.play": "Play", "enemies": {"one": "{n} enemy", "other": "{n} enemies"}}
mote.locale.load("csv", "lang/strings.csv") -- key,en,de,ru,...
mote.locale.set("en")
local L = mote.locale.t
L("menu.play") -- "Play"
L("hello", { name = "Ada" }) -- "Hello, {name}!" → "Hello, Ada!"
L("enemies", { n = 5 }) -- "5 enemies"
mote.locale.number(1234567.5, 1) -- "1,234,567.5"
mote.locale.money(19.99, "USD") -- "$19.99"
mote.locale.date(os.time())
mote.locale.onChange(function(lang) rebuildMenus() end)
Plural forms: Russian, Ukrainian, Belarusian, Polish — one/few/many; Japanese, Chinese,
Korean — other; others — one/other. A missing key returns the key. The fallback language is
mote.locale.fallback (en). Right-to-left scripts are not supported.
Game feel#
mote.juice.hitStop(0.06) -- freeze for 60 ms on a hit
mote.juice.impulse(0.6) -- camera shake
mote.juice.flash(1, 1, 1, 0.5, 0.15) -- screen flash
local fov = mote.juice.fov(75, running and 85 or 75)
function mote.draw()
g3.setCamera(head, fov)
mote.juice.applyCamera(fov) -- add the shake to the camera
end
| Call | Description |
|---|---|
mote.juice.hitStop(seconds) | mote.update receives dt = 0 for this long |
mote.juice.slowMo(scale, seconds) | slow motion easing back to normal |
mote.juice.impulse(amount, {decay, freq, angle, offset}) | add camera trauma 0..1 |
mote.juice.applyCamera(fov) / shake2d(maxPixels) → dx, dy, rot | use the shake in 3D / 2D |
mote.juice.flash(r, g, b, a, seconds) | a fading full-screen flash |
mote.juice.fov(base, target, speed) → fov | smoothed field of view |
mote.juice.timeScale() | the current time multiplier |
Related modules: mote.camera2d (dead zone, bounds, shake),
mote.gamestate (states with enter/exit/pause/resume), mote.save
(slots, versions, migration), mote.mixer (buses and crossfades).
Audio#
local A = mote.audio
local step = A.load("sounds/step.ogg")
A.play(step, { volume = 0.8, pitch = 1.1 })
A.playAt(step, x, y, z, { volume = 1 }) -- 3D sound
local beep = A.synth{ preset = "blip" } -- synthesized
A.play(beep)
A.setReverb("room")
local id = A.play(music, { loop = true })
A.set(id, "volume", 0.3)
A.stop(id, 1.0) -- fade out over 1 s
Synth presets: coin, laser, explosion, powerup, hit, jump, blip, shoot, alarm, footstep,
zap, teleport (A.synthPresets()), with waveforms, envelope, filters, vibrato and
slides. Buses, effects and music: A.bus, A.setEffects,
A.playMusic, mote.mixer.
Input#
| Call | Description |
|---|---|
mote.keyboard.isDown(key) / wasPressed(key) | keyboard |
mote.mouse.getPosition() / getDelta() / isDown(b) / wasPressed(b) / getWheel() | mouse |
mote.mouse.setGrabbed(on) / setVisible(on) | capture the mouse |
mote.gamepad.isDown(i, button) / getAxis(i, axis) | gamepads |
mote.input, mote.action | actions bound to several keys and gamepad buttons |
Multiplayer#
mote.network is the transport; mote.net is a multiplayer layer
on top: replicated entities, delta snapshots, client prediction, interpolation, RPCs and lag
compensation. The transport is UDP with a "reliable" channel (ordered, large
messages split) and an "unreliable" one.
local N = mote.net
-- server
N.startServer(27015, { name = "Room", game = "mygame", maxClients = 8 })
N.onConnect(function(cid)
N.setOwner(N.spawn("player", { x = 0, z = 0, hp = 100 }), cid)
end)
N.onInput(function(cid, cmd, dt)
local e = N.ownedEntity(cid)
e.x = e.x + (cmd.mx or 0) * 5 * dt
end)
-- client
N.connect("192.168.1.5", 27015)
N.setInputSampler(function() return { mx = axisX() } end)
N.setPredict(function(e, cmd, dt) e.x = e.x + (cmd.mx or 0) * 5 * dt end)
-- both
function mote.update(dt) N.update(dt) end
| Call | Description |
|---|---|
N.rpc(name, fn) / N.call(name, ...) | remote calls |
N.sync(name, value) | a shared variable |
N.onSpawn(fn) / N.onDespawn(fn) | entity events on clients |
N.entities / N.allEntities() | entities on a client (interpolated) / on the server |
N.enableLagComp(seconds) / N.hitscan(cid, origin, dir) | lag-compensated hits |
N.setInterest{mode = "radius", radius} | send only nearby entities |
mote.network.discover(port, game) / servers() | find servers on the local network |
mote.network.ping() / stats() / simulate{lag, jitter, loss} | diagnostics |
Transport only#
local net = mote.network
net.host(27015, { name = "srv", maxClients = 16 })
net.onReceive = function(id, msg) local t = mote.deserialize(msg) end
net.sendTo(id, mote.serialize({ hp = 5 })) -- reliable by default
net.broadcast(data, "unreliable")
Over the internet the server needs a reachable UDP port.
Packaging and release#
mote.exe fuse mygame MyGame.exe # one executable with the game inside (encrypted) mote.exe lpak mygame game.lpak # a package to place next to mote.exe mote.exe fuse mygame MyGame.exe --plain # without encryption mote.exe web mygame out --serve # a browser build (WebAssembly)
From a running game: mote.build.exe(name), mote.build.lpak(),
mote.build.verify(name).
Encryption: AES-256-GCM archive with hidden file names and a random key per build, wrapped by the engine key; in an executable the key is bound to the file's bytes. Save files are encrypted with a separate key. This protects against unpackers and casual inspection, not against analysis with a debugger.
Excluded from builds: dot files and folders, build/, dist/,
*.blend*, *.psd, *.kra, *.xcf,
*.py, *.exe, *.lpak. Add rules in a
.moteignore file: name, folder/, *.ext,
prefix*, # comments.
Built-in Lua libraries#
Loaded at start; no require needed.
mote.json, mote.save, mote.data | JSON, save games, data tables |
mote.ai, mote.navmesh, mote.crowd | AI, navigation, crowds |
mote.anim, mote.ease, mote.curve | tweens, easing functions, curves |
mote.ecs, mote.events, mote.reactive, mote.async, mote.gamestate | entities, events, reactive values, coroutines, game states |
mote.gui, mote.ui, mote.text | interfaces and text |
mote.camera, mote.camera2d | cameras |
mote.vfx, mote.particle | effects |
mote.noise, mote.rng, mote.geom, mote.spatial | noise, random numbers, geometry, spatial queries |
mote.loader, mote.locale, mote.juice, mote.skeleton2d | background loading, localization, game feel, 2D skeletons |
Deprecated functions#
Kept so existing games keep working. Use the replacement in new code.
| Deprecated | Use instead |
|---|---|
model:drawAt(x, y, z, rx, ry, rz, sx, sy, sz) | model:draw(x, y, z, {rot = {rx, ry, rz}, scale = {sx, sy, sz}}) |
model:drawRot(x, y, z, yawRadians, s) | model:draw(x, y, z, {rot = {0, degrees, 0}, scale = s}) |
model:drawFull(...) (radians) | model:draw(x, y, z, {rot = {...}}) or a transform |
model:drawAnimated(anim, t, x, y, z, s) | model:draw(x, y, z, {anim = anim, time = t, scale = s}) |
model:drawAnimatedRot, drawAnimatedFull | model:draw(..., {anim, time, rot}) |
model:drawBlended, drawBlendedRot | model:draw(..., {anim, time, blend = {anim, time, w}}) |
model:drawFps, drawAnimatedFps, drawBlendedFps | a transform parented to g3.camera and model:draw(transform, opts) |
char:draw(x, y, z, yawRadians, scale) | char:draw(transform) |
lvl:setPosition(obj, ...), lvl:setRotation(obj, ...) | obj:setPosition, obj:setQuat, obj:setRotation |
API reference#
Every function the engine exposes. ? marks an optional argument. Methods are called with a colon on the object named in the heading.
mote.graphics3d#
3D scene: camera, transform stack, primitives, models, materials, lights
mote.graphics3d.addLight(args)mote.graphics3d.addOccluder(v)mote.graphics3d.addOccluderBox(x0, y0, z0, x1, y1, z1)mote.graphics3d.applyTransform(v)mote.graphics3d.bakeReflectionProbe(x, y, z, size?)mote.graphics3d.box(x, y, z, w, h, d, opts?)mote.graphics3d.capsule(x, y, z, r, h, opts?)mote.graphics3d.clearMeshCull(id)mote.graphics3d.clearOccluders()mote.graphics3d.clearPreloaded()mote.graphics3d.cube(x, y, z, size, opts?)mote.graphics3d.decal(ud, x, y, z, nx, ny, nz, size, roll?, tr?, tg?, tb?, ta?)mote.graphics3d.decalEx(t)mote.graphics3d.distanceTo(x, y, z)mote.graphics3d.drawMesh(id)mote.graphics3d.drawMeshInstanced(id, insts, stride?)mote.graphics3d.getClipPlanes()mote.graphics3d.getOpacity()mote.graphics3d.getTextureMaxSize()mote.graphics3d.getTransform()mote.graphics3d.getTransparency()mote.graphics3d.getWater(index?)mote.graphics3d.isBoxVisible(x0, y0, z0, x1, y1, z1)mote.graphics3d.isVisible(x, y, z, r?)mote.graphics3d.loadModel(path)mote.graphics3d.loadModelAsync(path)mote.graphics3d.mesh(verts)mote.graphics3d.meshBounds(id)mote.graphics3d.mirror(x, y, z, nx, ny, nz, w, h, tr?, tg?, tb?)mote.graphics3d.newLightProfile(src)mote.graphics3d.newSurface(t)mote.graphics3d.origin()mote.graphics3d.plane(x, y, z, w, d, opts?)mote.graphics3d.pop()mote.graphics3d.preloadModels(paths)mote.graphics3d.push(mode?)mote.graphics3d.registerMesh(id, verts)mote.graphics3d.removeMesh(id)mote.graphics3d.rotate(rx, ry?, rz?)mote.graphics3d.rotateQuat(x, y, z, w)mote.graphics3d.scale(x, y?, z?)mote.graphics3d.screenRay(sx, sy)mote.graphics3d.screenSize(x, y, z, r)mote.graphics3d.setAmbient(r, g, b)mote.graphics3d.setCamera(ex, ey, ez, tx, ty, tz, fov? | transform, fov?)mote.graphics3d.setClipPlanes(near, far)mote.graphics3d.setColor(r, g, b, a?)mote.graphics3d.setEmissive(r, g, b)mote.graphics3d.setEnvironment(t)mote.graphics3d.setEnvMap(path?)mote.graphics3d.setFog(r, g, b, density)mote.graphics3d.setLight(x, y, z)mote.graphics3d.setMaterial(args)mote.graphics3d.setMaterialShader(args)mote.graphics3d.setMeshCull(id, t)mote.graphics3d.setMeshLOD(id, levels, bias?)mote.graphics3d.setModelShading(name, param?)mote.graphics3d.setOccluders(list)mote.graphics3d.setOpacity(a)mote.graphics3d.setShadow(ground?)mote.graphics3d.setShadowCascades(a, b, c)mote.graphics3d.setShadowSoftness(r)mote.graphics3d.setSunColor(r, g, b, intensity?)mote.graphics3d.setSunIntensity(i)mote.graphics3d.setSurface(s?)mote.graphics3d.setSurfaceDetail(pom, detail?)mote.graphics3d.setTexture(id)mote.graphics3d.setTextureMaxSize(n)mote.graphics3d.setTransparency(v)mote.graphics3d.setVelocity(x, y, z)mote.graphics3d.setWind(cfg)mote.graphics3d.shape(kind, x, y, z, opts?)mote.graphics3d.sphere(x, y, z, r, opts?)mote.graphics3d.surfaceKinds()mote.graphics3d.surfaceParams(kind)mote.graphics3d.trample(x, y, z, r?)mote.graphics3d.transformPoint(x, y, z)mote.graphics3d.translate(x, y, z)mote.graphics3d.water(t)mote.graphics3d.waterPreset(name)mote.graphics3d.worldToScreen(x, y, z)mote.transform#
transforms with hierarchy
mote.transform.eulerToQuat(x, y, z)mote.transform.is(v)mote.transform.lookQuat(dx, dy, dz)mote.transform.new(o?)mote.transform.quatToEuler(x, y, z, w)mote.render#
image settings
mote.render.affine(on)mote.render.apply(t)mote.render.autoExposure(target, lo?, hi?)mote.render.clearHooks(stage)mote.render.colorDepth(bits)mote.render.culling(t)mote.render.dither(amount)mote.render.focus(dist, fstop?, focal?)mote.render.getCulling()mote.render.getGi()mote.render.getLights()mote.render.getLocalShadows()mote.render.getResolution()mote.render.getShadows()mote.render.getTransparency()mote.render.gi(t)mote.render.gpuScene(on?)mote.render.gpuSceneStats()mote.render.lights(t)mote.render.localShadows(t)mote.render.lut(src, strength?)mote.render.lutStrength(v)mote.render.motionBlur(amount)mote.render.off(stage, fn)mote.render.on(stage, fn)mote.render.onBackground(fn)mote.render.onOverlay(fn)mote.render.onPost(fn)mote.render.onWorld(fn)mote.render.pixelate(n)mote.render.posterize(levels)mote.render.resolution(t)mote.render.retroOff()mote.render.shadows(t)mote.render.sharpen(amount)mote.render.skip(name, on?)mote.render.skipped()mote.render.taa(on)mote.render.tonemap(name)mote.render.transparency(t)mote.render.vertexSnap(grid)mote.render.vmo(on)mote.render.vmoBake(x?, y?, z?)mote.render.vmoConfig(t)mote.render.vmoDebug(on)mote.render.vmoDynamic(on)mote.render.vmoFog(v)mote.render.vmoIntensity(v)mote.graphics#
2D drawing, text, images, canvases, shaders, screen effects
mote.graphics.addScenePass(ud, stage?, opts?)mote.graphics.addScreenShader(ud)mote.graphics.arc(mode, cx, cy, r, a1, a2)mote.graphics.bezier(v)mote.graphics.capsule(mode, x1, y1, x2, y2, r)mote.graphics.circle(mode, x, y, r)mote.graphics.clear(r, g, b, a?)mote.graphics.clearScreenShader()mote.graphics.clearTarget(ud, r?, gg?, b?, a?, stage?)mote.graphics.dispatch(ud, opts?)mote.graphics.draw(image, x, y, r?, sx?, sy?, ox?, oy? | image, x, y, opts)mote.graphics.drawTriangles(ud, verts)mote.graphics.ellipse(mode, cx, cy, rx, ry)mote.graphics.fontHeight(scale?)mote.graphics.getClip()mote.graphics.getDimensions()mote.graphics.getFont()mote.graphics.getLineCap()mote.graphics.getLineStyle()mote.graphics.getLineWidth()mote.graphics.getTransform()mote.graphics.getVirtualResolution()mote.graphics.inverseTransformPoint(x, y)mote.graphics.loadImage(path)mote.graphics.loadImageAsync(path)mote.graphics.newBuffer(v)mote.graphics.newCanvas(w, h)mote.graphics.newCompute(source, names?)mote.graphics.newImage(w, h, f)mote.graphics.newImageData(a, b?)mote.graphics.newMaterial(source, names?)mote.graphics.newScenePass(source, names?)mote.graphics.newShader(source, names?)mote.graphics.newTarget(t?)mote.graphics.ngon(mode, x, y, r, n, rot?)mote.graphics.origin()mote.graphics.overrideShader(name, source)mote.graphics.parametric(func, t0, t1, steps, mode?)mote.graphics.pie(mode, x, y, r, a1, a2)mote.graphics.point(x, y, size?)mote.graphics.polygon(args)mote.graphics.polyline(coords)mote.graphics.pop()mote.graphics.popClip()mote.graphics.printWidth(text, scale?)mote.graphics.printWrapped(text, x, y, width, align?, scale?)mote.graphics.push(mode?)mote.graphics.pushClip(x, y, w, h)mote.graphics.pushClipScreen(x, y, w, h)mote.graphics.rectangle(mode, x, y, w, h, rx?, ry?)mote.graphics.resetShader(name)mote.graphics.ring(mode, x, y, r, ri, a1?, a2?)mote.graphics.rotate(a)mote.graphics.roundRect(mode, x, y, w, h, r0, r1?, r2?, r3?)mote.graphics.scale(sx, sy?)mote.graphics.setAntialias(on)mote.graphics.setBlendMode(mode)mote.graphics.setBlur(px?)mote.graphics.setCanvas(c?)mote.graphics.setClip(x?, y?, w?, h?)mote.graphics.setColor(r, g, b, a?)mote.graphics.setDash(len?, gap?)mote.graphics.setExposure(e)mote.graphics.setFont(font, size?)mote.graphics.setFontSize(px)mote.graphics.setFXAA(on)mote.graphics.setGrade(t)mote.graphics.setGradient(args)mote.graphics.setLineCap(cap)mote.graphics.setLineStyle(st)mote.graphics.setLineWidth(w)mote.graphics.setPixelSnap(on)mote.graphics.setScreenShader(shader?)mote.graphics.setSSAO(strength, radius?, power?)mote.graphics.setSSGI(strength, radius?)mote.graphics.setSSR(strength, max_dist?, thickness?)mote.graphics.setStrokeColor(r, gg, b, a?)mote.graphics.setTransform(a, b, c, d, e, ff)mote.graphics.setVignette(strength, softness?)mote.graphics.setVirtualResolution(w?, h?, o?)mote.graphics.setVolumetric(strength, density?, phase?)mote.graphics.shaderSource(name)mote.graphics.shear(kx, ky?)mote.graphics.spline(mode, pts, closed?)mote.graphics.star(mode, x, y, r, inner, n, rot?)mote.graphics.textSize(text, scale?)mote.graphics.toVirtual(x, y)mote.graphics.transformPoint(x, y)mote.graphics.translate(x, y)mote.graphics.triangle(mode, x1, y1, x2, y2, x3, y3)mote.physics3d#
3D physics
mote.physics3d.addBall(kind, x, y, z, r, rest?, fric?)mote.physics3d.addBallJoint(a, b, ax, ay, az, bx, by, bz)mote.physics3d.addBox(kind, x, y, z, w0, h0, d0, rest?, fric?)mote.physics3d.addCapsule(kind, x, y, z, hh, r, rest?, fric?)mote.physics3d.addConeJoint(a, b, ax, ay, az, bx, by, bz, swing, twist?)mote.physics3d.addConvex(kind, x, y, z, vflat, rest?, fric?)mote.physics3d.addCylinder(kind, x, y, z, hh, r, rest?, fric?)mote.physics3d.addField(cfg)mote.physics3d.addFixedJoint(a, b)mote.physics3d.addGround(y)mote.physics3d.addHeightfield(x, y, z, nrows, ncols, heights, sx, sz, fric?)mote.physics3d.addPrismaticJoint(a, b, o?)mote.physics3d.addRevoluteJoint(a, b, axx, axy, axz, ax, ay, az, bx, by, bz)mote.physics3d.addRopeJoint(a, b, len, o?)mote.physics3d.addSensorBall(x, y, z, r)mote.physics3d.addSensorBox(x, y, z, w0, h0, d0)mote.physics3d.addShape(kind, body, x, y, z, opts?)mote.physics3d.addSpringJoint(a, b, rest, stiff, damp)mote.physics3d.addTrimesh(x, y, z, vflat, iflat, fric?)mote.physics3d.applyForce(id, fx, fy, fz)mote.physics3d.applyForceAtPoint(id, fx, fy, fz, px, py, pz)mote.physics3d.applyImpulse(id, ix, iy, iz)mote.physics3d.applyImpulseAt(id, ix, iy, iz, px, py, pz)mote.physics3d.autoConvex(verts, indices, opts?)mote.physics3d.bodyOf(id)mote.physics3d.capsuleCast(ox, oy, oz, half, r, dx, dy, dz, max)mote.physics3d.clearBuoyancy(id)mote.physics3d.clearFields()mote.physics3d.debugDraw(opts)mote.physics3d.debugMesh(with_static?)mote.physics3d.debugShapes()mote.physics3d.drawBox(id, hx, hy, hz)mote.physics3d.explode(x, y, z, cfg?)mote.physics3d.fracture(cfg)mote.physics3d.getAngularVelocity(id)mote.physics3d.getMass(id)mote.physics3d.getPosition(id)mote.physics3d.getRotation(id)mote.physics3d.getVelocity(id)mote.physics3d.isBody(v)mote.physics3d.jointForce(jid)mote.physics3d.moveCharacter(id, dx, dy, dz, dt)mote.physics3d.newVehicle(chassis, cfg?)mote.physics3d.pollBreaks()mote.physics3d.pollContacts()mote.physics3d.pollTriggers()mote.physics3d.quatAxes(x, y, z, w)mote.physics3d.ragdoll(o)mote.physics3d.raycast(ox, oy, oz, dx, dy, dz, max)mote.physics3d.remove(id)mote.physics3d.removeField(id)mote.physics3d.removeJoint(jid)mote.physics3d.removeVehicle(vid)mote.physics3d.setBuoyancy(id, cfg?)mote.physics3d.setCcd(id, on)mote.physics3d.setContactEvents(id, th?)mote.physics3d.setDamping(id, lin, ang?)mote.physics3d.setGravity(x, y, z)mote.physics3d.setGroups(id, m, f, solver?)mote.physics3d.setJointBreak(jid, force, torque?)mote.physics3d.setJointLimits(jid, mn, mx, axis?)mote.physics3d.setJointMotor(jid, o)mote.physics3d.setMass(id, kg)mote.physics3d.setPosition(id, x, y, z)mote.physics3d.setRotation(id, x, y, z, w4)mote.physics3d.setVelocity(id, vx, vy, vz)mote.physics3d.setWater(arg)mote.physics3d.sphereCast(ox, oy, oz, r, dx, dy, dz, max)mote.physics3d.submersion(id)mote.physics3d.update(dt)mote.physics3d.vehicleControl(vid, cfg)mote.physics3d.vehicleState(vid)mote.physics3d.vehicleWheel(vid, i)mote.physics3d.wake(id)mote.physics3d.waterHeight(x, z)mote.physics#
2D physics
mote.physics.addBox(kind, x, y, w0, h0, rest?, fric?)mote.physics.addCapsule(kind, x, y, hh, r, rest?, fric?)mote.physics.addCircle(kind, x, y, r, rest?, fric?)mote.physics.addConvex(kind, x, y, vflat, rest?, fric?)mote.physics.addFixedJoint(a, b)mote.physics.addGround(y)mote.physics.addHeightfield(x, y, heights, width, fric?)mote.physics.addPolyline(kind, x, y, vflat, fric?)mote.physics.addRevoluteJoint(a, b, ax, ay, bx, by)mote.physics.addRopeJoint(a, b, max_len)mote.physics.addSensorBox(x, y, w0, h0)mote.physics.addSensorCircle(x, y, r)mote.physics.addSpringJoint(a, b, rest, stiff, damp)mote.physics.addTrimesh(x, y, vflat, iflat, fric?)mote.physics.applyForce(id, fx, fy)mote.physics.applyForceAtPoint(id, fx, fy, px, py)mote.physics.applyImpulse(id, ix, iy)mote.physics.getPosition(id)mote.physics.getTransform(id)mote.physics.getVelocity(id)mote.physics.pollTriggers()mote.physics.raycast(ox, oy, dx, dy, max)mote.physics.remove(id)mote.physics.setGravity(x, y)mote.physics.setGroups(id, membership, filter)mote.physics.setPosition(id, x, y)mote.physics.setVelocity(id, vx, vy)mote.physics.update(dt)mote.level#
levels exported from Blender
mote.level.behavior(name, def)mote.level.load(path, opts)mote.character#
mote.character.clearCache()mote.character.data(modelPath, model)mote.character.load(modelPath, opts)mote.character.new(model, data, opts)mote.loader#
background loading
mote.loader.idle()mote.loader.image(path, cb)mote.loader.level(path, opts, cb)mote.loader.model(path, cb)mote.loader.progress()mote.loader.update()mote.terrain#
terrain
mote.terrain.new(cfg?)mote.terrain.preset(name)mote.terrain.presets()mote.scatter#
vegetation and object scattering
mote.scatter.new(cfg?)mote.sky#
sky and clouds
mote.sky.cloud(x, y, z, radius, opts?)mote.sky.cloudCarve(x, y, z, radius)mote.sky.cloudPreset(name, coverage?)mote.sky.clouds(t)mote.sky.cloudsOff()mote.sky.cloudWeather(img?)mote.sky.enable(on)mote.sky.getClouds()mote.sky.setParams(t)mote.sky.setSun(az, elev)mote.sky.setTime(t)mote.water#
water
mote.water.disturb(x, z, radius, strength, body?)mote.water.foam(x, z, radius, amount, body?)mote.water.impact(x, z, radius, speed, body?)mote.water.splash(x, z, radius, strength, body?)mote.ruin#
destruction
mote.ruin.box(opts)mote.ruin.convex(opts)mote.ruin.materials()mote.ruin.mesh(opts)mote.ruin.model(model, opts?)mote.gui#
retained-mode interface
mote.gui.new(cfg)mote.ui#
immediate-mode interface
mote.ui.bar(x, y, w, h, value, c)mote.ui.begin()mote.ui.beginScroll(id, x, y, w, h, contentH, contentW)mote.ui.button(id, str, x, y, w, h)mote.ui.captured()mote.ui.checkbox(id, str, x, y, checked)mote.ui.defer(fn)mote.ui.dropdown(id, x, y, w, items, index)mote.ui.endScroll()mote.ui.finish()mote.ui.focused()mote.ui.input(id, x, y, w, value, placeholder)mote.ui.isHot()mote.ui.label(str, x, y, scale, c)mote.ui.panel(x, y, w, h, c)mote.ui.scale()mote.ui.scrollTo(id, y)mote.ui.separator(x, y, w)mote.ui.setReference(w, h)mote.ui.slider(id, x, y, w, value, min, max)mote.ui.tabs(id, x, y, w, names, index)mote.ui.window(id, title, x, y, w, h)mote.text#
text layout
mote.text.printAligned(str, x, y, boxW, scale, align)mote.text.printWrapped(str, x, y, maxWidth, scale, lineHeight)mote.text.rich(str, x, y, scale, default)mote.text.richDraw(str, x, y, opts)mote.text.richDrawLayout(lay, x, y, k, alpha, color)mote.text.richLayout(str, maxW, opts)mote.text.width(str, scale)mote.text.wrap(str, maxWidth, scale)mote.audio#
audio
mote.audio.addEffect(name, e)mote.audio.addReverbZone(t)mote.audio.bus(name, parent?)mote.audio.buses()mote.audio.clearReverbZones()mote.audio.duck(target, trigger, amount?, t?)mote.audio.fade(id, to, time)mote.audio.getBus(name)mote.audio.getEnvironment()mote.audio.getListener()mote.audio.isPlaying(id)mote.audio.level()mote.audio.load(src)mote.audio.micActive()mote.audio.micLevel()mote.audio.micSamples(n?)mote.audio.micSpectrum(bands?)mote.audio.musicId()mote.audio.pause(id)mote.audio.pauseAll()mote.audio.pauseMusic()mote.audio.play(src, a2, pitch?, looped?)mote.audio.playAt(src, x, y, z, a5, looped?)mote.audio.playMusic(path, vol?, looped?, xf?, bus?)mote.audio.removeReverbZone(id)mote.audio.resume(id)mote.audio.resumeAll()mote.audio.resumeMusic()mote.audio.reverbPresets()mote.audio.set(id, k, v?)mote.audio.setAutoListener(on)mote.audio.setBus(name, t)mote.audio.setBusVolume(name, v)mote.audio.setCone(id, dx, dy, dz, inner?, outer?, g?)mote.audio.setDefaults(t)mote.audio.setDopplerScale(v)mote.audio.setEffect(name, which, key, v)mote.audio.setEffects(name, list?)mote.audio.setLimiter(on)mote.audio.setListener(x, y, z, fx?, fy?, fz?, ux?, uy?, uz?)mote.audio.setListenerVelocity(x, y, z)mote.audio.setMasterVolume(v)mote.audio.setMaxVoices(n)mote.audio.setMusicVolume(v)mote.audio.setPosition(id, x, y, z)mote.audio.setReverb(v, lowpass?)mote.audio.setSpeedOfSound(v)mote.audio.setTimeScale(v)mote.audio.setVelocity(id, x, y, z)mote.audio.spectrum(bands?, n?)mote.audio.startMic()mote.audio.stats()mote.audio.stop(id, fade?)mote.audio.stopAll(fade?)mote.audio.stopBus(name, fade?)mote.audio.stopMic()mote.audio.stopMusic(fade?)mote.audio.synth(what, seed?)mote.audio.synthParams(name, seed?)mote.audio.synthPresets()mote.audio.tell(id)mote.audio.unduck(target, trigger)mote.audio.unload(src)mote.audio.waveform(n?)mote.keyboard#
keyboard
mote.keyboard.getText()mote.keyboard.isDown(name)mote.keyboard.wasPressed(name)mote.keyboard.wasReleased(name)mote.mouse#
mouse
mote.mouse.getDelta()mote.mouse.getPosition()mote.mouse.getWheel()mote.mouse.getX()mote.mouse.getY()mote.mouse.isDown(button)mote.mouse.setGrabbed(v)mote.mouse.setVisible(v)mote.mouse.wasPressed(button)mote.mouse.wasReleased(button)mote.gamepad#
gamepads
mote.gamepad.count()mote.gamepad.getAxis(idx, axis)mote.gamepad.isConnected(idx)mote.gamepad.isDown(idx, btn)mote.gamepad.wasPressed(idx, btn)mote.gamepad.wasReleased(idx, btn)mote.touch#
touch
mote.touch.count()mote.touch.getTouches()mote.window#
window
mote.window.getHeight()mote.window.getSize()mote.window.getWidth()mote.window.setFullscreen(on)mote.window.setMode(width, height, opts?)mote.window.setResizable(on)mote.window.setSize(width, height)mote.window.setTitle(title)mote.window.setVsync(on)mote.net#
multiplayer
mote.net.allEntities()mote.net.call(name, ...)mote.net.callAll(name, ...)mote.net.callTo(clientId, name, ...)mote.net.connect(host, port, opts)mote.net.despawn(netId)mote.net.enableLagComp(seconds, fields)mote.net.entity(netId)mote.net.getSync(key)mote.net.hitscan(clientId, origin, dir, opts)mote.net.isClient()mote.net.isServer()mote.net.onConnect(fn)mote.net.onDespawn(fn)mote.net.onDisconnect(fn)mote.net.onEvent(fn)mote.net.onInput(fn)mote.net.onReady(fn)mote.net.onServerTick(fn)mote.net.onSpawn(fn)mote.net.ownedEntity(clientId)mote.net.rewindTo(clientId, fn)mote.net.role()mote.net.rpc(name, fn)mote.net.sendEvent(name, data)mote.net.sendEventTo(clientId, name, data)mote.net.setInputSampler(fn)mote.net.setInterest(opts)mote.net.setOwner(netId, clientId)mote.net.setPredict(fn)mote.net.shutdown()mote.net.spawn(etype, fields)mote.net.startServer(port, opts)mote.net.sync(key, value)mote.net.update(dt)mote.network#
network transport
mote.network.address(id?)mote.network.broadcast(msg, ch?)mote.network.clientCount()mote.network.clients()mote.network.connect(host, port, opts?)mote.network.disconnect(id?)mote.network.discover(port, game?)mote.network.host(port, opts?)mote.network.isClient()mote.network.isConnected()mote.network.isServer()mote.network.ping(id?)mote.network.send(msg, ch?)mote.network.sendTo(id, msg, ch?)mote.network.servers()mote.network.setTimeout(secs)mote.network.simulate(t?)mote.network.stats(id?)mote.network.stopDiscovery()mote.network.transport()mote.locale#
localization
mote.locale.add(lang, t)mote.locale.date(t, pattern)mote.locale.get()mote.locale.languages()mote.locale.load(lang, path)mote.locale.money(v, currency)mote.locale.number(n, decimals)mote.locale.onChange(fn)mote.locale.set(lang)mote.locale.t(key, args)mote.juice#
game feel
mote.juice.applyCamera(fov)mote.juice.flash(r, g, b, a, seconds)mote.juice.fov(base, target, speed)mote.juice.hitStop(seconds)mote.juice.impulse(amount, cfg)mote.juice.shake()mote.juice.shake2d(maxPixels)mote.juice.slowMo(scale, seconds)mote.juice.timeScale()mote.juice.trauma()mote.juice.update(dt)mote.skeleton2d#
2D skeletal animation
mote.skeleton2d.loadSpine(path, opts)mote.skeleton2d.new(spec)mote.action#
mote.action.add(name, keys)mote.action.axis(negName, posName)mote.action.bind(name, keys)mote.action.down(name)mote.action.keys(name)mote.action.pressed(name)mote.ai#
mote.ai.agent(o)mote.ai.astar(sx, sy, gx, gy, walkable)mote.ai.blackboard()mote.ai.canSee(fromPos, forward, target, opts, blocked)mote.ai.fsm(initial)mote.ai.goap(opts)mote.ai.goapAgent(cfg)mote.ai.gridGraph(o)mote.ai.gridPath(graph, sx, sy, gx, gy)mote.ai.inFov(fromPos, forward, target, halfAngle, range)mote.ai.lineOfSight(fromPos, target, blocked, step)mote.ai.rvo(agent, neighbors, vpref, opts)mote.ai.utility(actions)mote.ai.bt#
mote.ai.bt.action(fn)mote.ai.bt.condition(fn)mote.ai.bt.invert(child)mote.ai.bt.repeatN(child, n)mote.ai.bt.selector(children)mote.ai.bt.sequence(children)mote.anim#
mote.anim.animator(model)mote.anim.blendTree1d(model, param)mote.anim.build(model, data)mote.anim.controller(model)mote.anim.frames(images, frameTime, loop)mote.anim.grid(image, frameW, frameH)mote.anim.new(grid, frames, frameTime, loop)mote.anim.path(points, duration, loop)mote.anim.skeleton()mote.anim.spline(points, t)mote.anim.sprite2d(grid)mote.anim.timeline()mote.assets#
mote.assets.clearImages()mote.assets.imageCount()mote.assets.read(path)mote.assets.unloadImage(path)mote.async#
mote.async.all(list)mote.async.any(list)mote.async.await(x)mote.async.clear()mote.async.count()mote.async.delay(sec)mote.async.mapLimit(items, limit, fn)mote.async.now()mote.async.race(list)mote.async.retry(n, fn, delay)mote.async.run(fn, ...)mote.async.step()mote.async.stop(t)mote.async.timeout(sec, x)mote.async.toTask(x)mote.async.try(x)mote.async.update(dt)mote.async.wait(sec)mote.async.waitUntil(pred)mote.autotile#
mote.autotile.draw(cfg)mote.autotile.mask4(solid, x, y)mote.autotile.mask8(solid, x, y)mote.build#
packaging
mote.build.exe(out?)mote.build.lpak(out?)mote.build.verify(name?)mote.cam2d#
mote.cam2d.new(opts)mote.cam3d#
mote.cam3d.new(opts)mote.cam3d.set(ex, ey, ez, tx, ty, tz, fov)mote.camera#
mote.camera.getShake()mote.camera.shake(intensity, duration)mote.camera2d#
mote.camera2d.controller(o)mote.camera2d.follower(opts)mote.camera2d.getMouseWorld()mote.camera2d.reset()mote.camera2d.set(x, y, zoom?, rot?)mote.camera2d.toScreen(wx, wy)mote.camera2d.toWorld(sx, sy)mote.camera3d#
mote.camera3d.fps(x, y, z, yaw, pitch)mote.camera3d.lookAt(ex, ey, ez, tx, ty, tz)mote.camera3d.orbit(tx, ty, tz, dist, yaw, pitch)mote.camera3d.setFov(f)mote.cloth#
mote.cloth.new(cfg)mote.collide#
mote.collide.aabb(a, b)mote.collide.move(box, vx, vy, solids)mote.collide.resolve(box, other)mote.collide.sweep(box, vx, vy, other)mote.crowd#
mote.crowd.new(opts)mote.curve#
mote.curve.bezier(p0, p1, p2, p3, segments)mote.curve.catmullRom(points, perSeg)mote.curve.cubic(p0, p1, p2, p3, t)mote.curve.length(pts)mote.curve.pointAt(pts, u)mote.curve.quad(p0, p1, p2, t)mote.data#
mote.data.base64Decode(s)mote.data.base64Encode(s)mote.data.djb2(s)mote.data.fnv1a(s)mote.data.hashId(s)mote.data.rleDecode(s)mote.data.rleEncode(s)mote.debug#
mote.debug.circle(x, y, r)mote.debug.collider(cam, shape)mote.debug.cross(x, y, s)mote.debug.line(x1, y1, x2, y2)mote.debug.off()mote.debug.on()mote.debug.path(cam, pts)mote.debug.point(x, y, s)mote.debug.ray(cam, ox, oy, dx, dy, len)mote.debug.rect(x, y, w, h)mote.debug.setColor(r, g, b, a)mote.debug.text(str, x, y, sc)mote.debug.toggle()mote.debug.waabb(cam, x, y, w, h)mote.debug.wcircle(cam, x, y, r)mote.debug.wline(cam, x1, y1, x2, y2)mote.debug.wpoint(cam, x, y, s)mote.devtools#
mote.devtools.brushLeaks()mote.devtools.enable(on)mote.devtools.trackBrush(on)mote.devtools.watch(name, fn)mote.ease#
mote.ease.get(name)mote.ease.inBack(t)mote.ease.inBounce(t)mote.ease.inCirc(t)mote.ease.inCubic(t)mote.ease.inElastic(t)mote.ease.inExpo(t)mote.ease.inOutBack(t)mote.ease.inOutBounce(t)mote.ease.inOutCubic(t)mote.ease.inOutExpo(t)mote.ease.inOutQuad(t)mote.ease.inOutQuart(t)mote.ease.inOutSine(t)mote.ease.inQuad(t)mote.ease.inQuart(t)mote.ease.inSine(t)mote.ease.linear(t)mote.ease.outBack(t)mote.ease.outBounce(t)mote.ease.outCirc(t)mote.ease.outCubic(t)mote.ease.outElastic(t)mote.ease.outExpo(t)mote.ease.outQuad(t)mote.ease.outQuart(t)mote.ease.outSine(t)mote.ecs#
mote.ecs.world()mote.editor#
mote.editor.add(kind)mote.editor.build()mote.editor.drawGizmos()mote.editor.drawOverlay()mote.editor.drawScene()mote.editor.duplicate(i)mote.editor.editable()mote.editor.enable(opts)mote.editor.levels()mote.editor.load(name)mote.editor.path()mote.editor.push()mote.editor.remove(i)mote.editor.render()mote.editor.save(name)mote.editor.say(m)mote.editor.serialize()mote.editor.toggle()mote.editor.undo()mote.editor.update(dt)mote.events#
mote.events.clear(name)mote.events.emit(name, ...)mote.events.off(h)mote.events.on(name, fn)mote.events.once(name, fn)mote.flipbook#
mote.flipbook.new(cfg)mote.fn#
mote.fn.after(n, fn)mote.fn.bind(obj, name)mote.fn.compose(...)mote.fn.constant(v)mote.fn.curry(fn, arity)mote.fn.debounce(sec, fn)mote.fn.gather(fn)mote.fn.identity(v)mote.fn.limit(n, fn)mote.fn.memoize(fn, keyFn)mote.fn.method(name, ...)mote.fn.negate(pred)mote.fn.noop()mote.fn.now()mote.fn.once(fn)mote.fn.partial(fn, ...)mote.fn.partialRight(fn, ...)mote.fn.pipe(...)mote.fn.prop(path)mote.fn.safe(fn, fallback)mote.fn.spread(fn)mote.fn.tap(fn)mote.fn.throttle(sec, fn, opts)mote.font#
mote.font.count()mote.font.load(path)mote.font.metrics(id, px)mote.font.name(id)mote.game#
mote.game.ability(opts)mote.game.actor(opts)mote.game.interactable(x, y, z, radius, onUse)mote.game.interactAt(px, py, pz)mote.game.inventory(opts)mote.game.moveInteractable(id, x, y, z)mote.game.removeInteractable(id)mote.game.spawner(points)mote.game.use(id, ...)mote.game.weapon(opts)mote.gamestate#
mote.gamestate.current()mote.gamestate.draw()mote.gamestate.emit(name, ...)mote.gamestate.pop(...)mote.gamestate.push(state, ...)mote.gamestate.switch(state, ...)mote.gamestate.update(dt)mote.geom#
mote.geom.area(poly)mote.geom.centroid(poly)mote.geom.convexHull(poly)mote.geom.fill(poly)mote.geom.pointInPoly(px, py, poly)mote.geom.segIntersect(x1, y1, x2, y2, x3, y3, x4, y4)mote.geom.triangulate(poly)mote.gfx#
mote.gfx.apply(x, y)mote.gfx.arc(mode, cx, cy, r, a0, a1, seg)mote.gfx.circle(mode, cx, cy, r, segments)mote.gfx.gradientRect(x, y, w, h, c1, c2, horizontal, bands)mote.gfx.image(img, x, y, r, sx, sy, ox, oy)mote.gfx.ngon(mode, cx, cy, r, n, rot)mote.gfx.origin()mote.gfx.polygon(mode, pts)mote.gfx.polyline(width, pts)mote.gfx.pop()mote.gfx.print(text, x, y, scale)mote.gfx.push()mote.gfx.rect(mode, x, y, w, h)mote.gfx.reset()mote.gfx.rotate(t)mote.gfx.roundrect(mode, x, y, w, h, r, seg)mote.gfx.scale(sx, sy)mote.gfx.shear(kx, ky)mote.gfx.star(mode, cx, cy, outer, inner, points, rot)mote.gfx.translate(x, y)mote.gpu#
mote.gpu.burst(n)mote.gpu.set(def)mote.gpu.setRate(r)mote.gpu.step(dt)mote.gpu.stop()mote.gpu.system(def)mote.hotreload#
mote.hotreload.disable()mote.hotreload.enable(opts)mote.hotreload.tick()mote.hotreload.unwatch(path)mote.hotreload.watch(path, onChange)mote.input#
mote.input.axis(opts)mote.input.button(sources)mote.input.new(opts)mote.input.vector(opts)mote.json#
mote.json.decode(s)mote.json.encode(v)mote.light#
mote.light.clear()mote.light.emit()mote.light.move(id, x, y, z)mote.light.point(opts)mote.light.remove(id)mote.light.setColor(id, r, g, b)mote.light.setHaze(opts)mote.light.setIntensity(id, i)mote.light.setRange(id, r)mote.light.sun(dir, color, intensity)mote.light2d#
mote.light2d.new(o)mote.mixer#
mote.mixer.bus(name, volume, parent)mote.mixer.effects(name, list)mote.mixer.getVolume(name)mote.mixer.music(name, path, volume, loop, crossfade)mote.mixer.mute(name, on)mote.mixer.play(name, path, volume, pitch, loop)mote.mixer.playAt(name, path, x, y, z, volume, loop)mote.mixer.setMaster(v)mote.mixer.setVolume(name, v)mote.mixer.stopBus(name, fade)mote.mixer.stopMusic(_, fade)mote.mixer.update()mote.nineslice#
mote.nineslice.new(cfg)mote.noise#
mote.noise.fbm(x, y, opts)mote.noise.fbm3(x, y, z, opts)mote.noise.perlin(x, y)mote.noise.perlin01(x, y)mote.noise.perlin3(x, y, z)mote.noise.perlin301(x, y, z)mote.noise.ridged(x, y, opts)mote.noise.seed(s)mote.noise.worley(x, y)mote.parallax#
mote.parallax.new()mote.particle#
mote.particle.new(cfg)mote.particle2d#
mote.particle2d.new(cfg)mote.particles#
mote.particles.explosion(x, y, power)mote.particles.fire(x, y)mote.particles.fire3d(x, y, z)mote.particles.magicTrail(x, y, z)mote.particles.new()mote.particles.new3d()mote.particles.smoke(x, y)mote.particles.smoke3d(x, y, z)mote.particles.sparks(x, y)mote.particles.sparks3d(x, y, z, power)mote.particles.trail3d()mote.particles.water(x, y)mote.particles.water3d(x, y, z)mote.plugins#
mote.plugins.draw()mote.plugins.each(fn)mote.plugins.get(name)mote.plugins.has(name)mote.plugins.list()mote.plugins.register(nameOrTable, tbl)mote.plugins.update(dt)mote.pool#
mote.pool.new(factory, reset)mote.profile#
profiling
mote.profile.callsite(level?)mote.profile.enable(on?)mote.profile.gc()mote.profile.lua(on?)mote.profile.luaFrame()mote.profile.luaReport(n?)mote.profile.luaReset()mote.profile.scope(name, f, args)mote.profile.stats()mote.project#
mote.project.dir()mote.project.exists(rel)mote.project.list(sub?, ext?)mote.project.read(rel)mote.project.write(rel, data)mote.reactive#
mote.reactive.batch(fn)mote.reactive.bind(src, obj, key)mote.reactive.computed(fn)mote.reactive.effect(fn)mote.reactive.isRef(v)mote.reactive.ref(v)mote.reactive.watch(src, cb, opts)mote.rng#
mote.rng.new(seed)mote.rope#
mote.rope.new(cfg)mote.save#
mote.save.autosave(slot, interval, dataFn)mote.save.delete(slot)mote.save.dir()mote.save.exists(slot)mote.save.list()mote.save.read(slot, opts)mote.save.setIdentity(name)mote.save.slot(name)mote.save.write(slot, data, opts)mote.scene#
mote.scene.count()mote.scene.current()mote.scene.find(name)mote.scene.findWithTag(tag)mote.scene.load(name)mote.scene.newObject(name?)mote.scene.switch(name)mote.scene.unload(name)mote.screen#
mote.screen.draw()mote.screen.fade(duration, dir, cb)mote.screen.flash(r, g, b, duration, a)mote.screen.offset()mote.screen.shake(intensity, duration)mote.screen.update(dt)mote.shapes#
mote.shapes.capsule(x, y, z, r, h, seg)mote.shapes.cone(x, y, z, r, h, seg)mote.shapes.cylinder(x, y, z, r, h, seg)mote.shapes.disc(x, y, z, r, seg)mote.shapes.grid(nx, nz, spacing, y, fn)mote.shapes.prism(x, y, z, r, h, sides)mote.shapes.pyramid(x, y, z, base, h, sides)mote.shapes.ring(count, radius, y, fn)mote.shapes.scatter(count, area, seed, fn)mote.shapes.spiral(count, radius, rise, turns, fn)mote.shapes.torus(x, y, z, ringR, tubeR, seg, sides)mote.shapes.tube(x, y, z, r, h, thick, seg)mote.shapes.wedge(x, y, z, w, h, d)mote.softbody#
mote.softbody.box(cx, cy, cz, size)mote.softbody.new(cfg)mote.spatial#
mote.spatial.new(cell)mote.textfx#
mote.textfx.rainbow(text, x, y, scale, t, speed)mote.textfx.shake(text, x, y, scale, intensity)mote.textfx.typewriter(text, x, y, scale, count)mote.textfx.wave(text, x, y, scale, t, amp, freq, speed)mote.tiled#
mote.tiled.load(path, opts)mote.tilemap#
mote.tilemap.new(o)mote.timer#
mote.timer.getTime()mote.trigger#
mote.trigger.clear(id)mote.trigger.on(id, onEnter, onExit)mote.trigger.update(world)mote.vehicle#
mote.vehicle.new(cfg)mote.vfx#
mote.vfx.alphaOverLife(ramp)mote.vfx.attract(cx, cy, strength)mote.vfx.collision(opt)mote.vfx.colorOverLife(grad)mote.vfx.curl2(x, y)mote.vfx.curlNoise(scale, strength)mote.vfx.drag(coef)mote.vfx.fbm2(x, y, oct)mote.vfx.force(field)mote.vfx.gradient(points)mote.vfx.gravity(gx, gy, gz)mote.vfx.noise2(x, y)mote.vfx.radial(cx, cy, strength)mote.vfx.ramp(points)mote.vfx.rand(seed)mote.vfx.repel(cx, cy, strength)mote.vfx.sizeOverLife(ramp)mote.vfx.system(def)mote.vfx.turbulence(scale, strength)mote.vfx.vortex(cx, cy, strength)mote.vfx.wind(dx, dy, dz)mote.vfx.emit#
mote.vfx.emit.circle(cx, cy, r, filled)mote.vfx.emit.fromParticles(other)mote.vfx.emit.line(x1, y1, x2, y2)mote.vfx.emit.point(x, y, z)mote.vfx.emit.polygon(pts)mote.vfx.emit.rect(x, y, w, h)mote.vfx.render#
mote.vfx.render.circle(r)mote.vfx.render.cube(sz)mote.vfx.render.custom(fn)mote.vfx.render.point(size)mote.vfx.render.sphere(r)mote.vfx.render.sprite(image, imgW, imgH, size)mote.vfx.render.streak(len)mote.vfx.render.text(str, scale)mote.vr#
mote.vr.getController(idx)mote.vr.getHeadPose()mote.vr.isActive()mote.vr.isAvailable()mote.vr.recenter()mote.vr.setActive(on)mote.vr.vibrate(idx, amp, dur?)Agent methods#
agent:addForce(f, w)agent:align(neighbors, radius, w)agent:arrive(target, slow, w)agent:arrived()agent:avoid(obstacles, w, lookAhead)agent:canSee(x, y, z, fov, range, ignoreBody)agent:cohere(neighbors, radius, w)agent:evade(target, targetVel, w)agent:flee(target, w)agent:flock(neighbors, opts)agent:follow(target, stopAt)agent:followPath(path, w, arrive)agent:heading()agent:moveTo(x, y, z)agent:patrol(pathName, wait)agent:position()agent:pursue(target, targetVel, w)agent:seek(target, w)agent:separate(neighbors, radius, w)agent:speed()agent:stop()agent:update(dt)agent:wander(w, jitter)Async methods#
handle:error()handle:ready()handle:result()Body methods#
body:draw(opts)body:isValid()body:move(dx, dy, dz, dt)body:remove()Buffer methods#
buffer:id()buffer:set(t, off?)buffer:size()C methods#
c:apply()c:forward()c:getPosition()c:pan(right, forward)c:right()c:rotate(dx, dy)c:setAngles(yaw, pitch)c:setDistance(d)c:setFocus(x, y, z)c:setFov(f)c:setOffset(x, y, z)c:setSmoothing(pos, look, fov)c:setTarget(t)c:shake(intensity, duration)c:update(dt)c:zoom(dz)C2 methods#
c2:apply()c2:follow(t)c2:setBounds(b)c2:setRotation(r)c2:setZoom(z)c2:shake(i, d)c2:update(dt)Cam methods#
cam:apply()cam:clearBounds()cam:getPosition()cam:setBounds(x, y, w, h)cam:setRoom(x, y, w, h, snap)cam:setTarget(x, y)cam:setZoom(z)cam:shake(amp, dur)cam:snap()cam:toScreen(wx, wy)cam:toWorld(sx, sy)cam:update(dt)Char methods#
char:addLayer(name, opts)char:clip()char:clips()char:die(opts)char:draw(x, y, z, yaw, scale)char:duration(clip)char:flinch(impulse, bone, amount)char:footIK(opts)char:footIKWeight(w)char:get(name)char:getUp(secs)char:isDead()char:isRagdoll()char:layer(name)char:layerPlay(name, clip, opts)char:layerStop(name, secs)char:layerWeight(name, w, secs)char:on(name, fn)char:onPose(fn)char:onState(fn)char:play(name, fade)char:ragdollBody(bone)char:ragdollPosition()char:rootMotion(on, bone)char:set(name, value)char:setSpeed(s)char:state()char:states()char:takeRootMotion(yaw, scale)char:trigger(name)char:update(dt)Convex methods#
convex:add(kind, x, y, z, rest?, fric?)convex:addAnimated(fric?)convex:bone(i)convex:count()convex:hullMesh(i)convex:info()ConvexRig methods#
convexrig:count()convexrig:hullMesh(i)convexrig:ids()convexrig:remove()convexrig:sync(anim, time, x, y, z, scale?)Crowd methods#
crowd:add(m)crowd:arrived(m, eps)crowd:setGoal(m, gx, gy, gz)crowd:update(dt)Def methods#
def:addAnimation(name, a)def:instance()FB methods#
fb:clip(name, def)fb:draw(x, y, r, sx, sy, ox, oy)fb:isPlaying(name)fb:onEnd(fn)fb:pause()fb:play(name, force)fb:resume()fb:update(dt)Follower methods#
follower:setBounds(b)follower:setZoom(z)follower:snap(tx, ty)follower:update(dt, tx, ty)G methods#
g:clear()g:insert(id, x, y, r)g:overlaps(x, y, r)g:query(x, y, r)g:queryRect(x, y, w, h)IM methods#
im:add(name, act)im:bindings(name)im:disable()im:down(name)im:enable()im:pressed(name)im:rebind(name, index, source)im:released(name)im:setActive(b)im:setGamepad(idx)im:update()im:value(name)im:vector(name)Image methods#
image:draw(x, y, r?, sx?, sy?, ox?, oy?)image:drawRegion(qx, qy, qw, qh, x, y, r?, sx?, sy?, ox?, oy?)image:getDimensions()image:getHeight()image:getWidth()ImageData methods#
imagedata:circle(mode, x, y, r, c, lw?, c2)imagedata:clear(r?, g?, b?, a?)imagedata:clone()imagedata:ellipse(mode, x, y, rx, ry, c, lw?, c2)imagedata:flip(dir?)imagedata:getDimensions()imagedata:getHeight()imagedata:getPixel(x, y)imagedata:getWidth()imagedata:gradient(args)imagedata:line(x1, y1, x2, y2, c, w?)imagedata:mapPixel(f, x0?, y0?, w?, h?)imagedata:noise(scale, seed?, oct?, c0, c1)imagedata:outline(c, t?)imagedata:paste(src, x, y, a?)imagedata:polygon(mode, pts, c, lw?, c2)imagedata:rect(mode, x, y, w, h, c, r?, lw?, c2)imagedata:setPixel(x, y, r, g, b, a?)imagedata:toImage()Inst methods#
inst:boneWorld(name)inst:current(track)inst:draw(x, y, opts)inst:play(name, opts)inst:setAttachment(slotName, attName)inst:setBone(name, o)inst:setIK(name, x, y, mix)inst:stop(track)inst:update(dt)Level methods#
level:agent(obj, opts)level:applyWorld()level:attach(obj, name)level:byBody(id)level:characters()level:clipTime(name)level:draw(opts)level:drawLights()level:each(fn)level:find(name)level:isPlaying(name)level:nearestUsable(x, y, z, range, dx, dy, dz)level:path(name)level:pathPoint(name, dist)level:play(name, opts)level:reload()level:remove(obj)level:setClipTime(name, t)level:setPosition(obj, x, y, z)level:setRotation(obj, qx, qy, qz, qw)level:spawn(template, x, y, z)level:spawnPoints(tag)level:stop(name)level:update(dt)level:use(obj, who)level:useCamera(name)level:withTag(tag)Map methods#
map:autotile(li, filled, tiles)map:draw(cam, camY, zoom)map:drawLayer(name)map:get(li, tx, ty)map:isSolid(tx, ty)map:load(li, data)map:loadCSV(li, csv)map:objects(layerName)map:pixelSize()map:rectSolid(x, y, w, h)map:set(li, tx, ty, id)map:setSize(w, h)map:setSolid(id, on)map:tileAt(layerName, tx, ty)map:tileToWorld(tx, ty)map:worldToTile(wx, wy)Model methods#
model:animations()model:autoConvex(opts?)model:bones()model:draw(x, y, z, scale? | x, y, z, opts | transform, opts?)model:drawAnimated(anim, time, x, y, z, scale?)model:drawAnimatedFps(anim, time, off_x, off_y, off_z, pitch, yaw, roll, scale?)model:drawAnimatedFull(anim, time, x, y, z, pitch, yaw, roll, scale?)model:drawAnimatedRot(anim, time, x, y, z, rot_y, scale?)model:drawAt(x, y, z, rx?, ry?, rz?, sx?, sy?, sz?)model:drawBlended(a, ta, b, tb, w, x, y, z, scale?)model:drawBlendedFps(a, ta, b, tb, w, off_x, off_y, off_z, pitch, yaw, roll, scale?)model:drawBlendedRot(a, ta, b, tb, w, x, y, z, rot_y, scale?)model:drawFps(off_x, off_y, off_z, pitch, yaw, roll, scale?)model:drawFull(x, y, z, pitch, yaw, roll, scale?)model:drawRot(x, y, z, rot_y, scale?)model:duration(anim)model:pose()model:rootBone()model:rootMotion(anim, t0, t1, bone?)model:triangles()model:vertices()NM methods#
nm:blockAt(x, z)nm:blockCircle(x, z, radius)nm:contains(x, y, z)nm:findPath(sx, sy, sz, gx, gy, gz)nm:sampleHeight(x, z)nm:unblockAll()NS methods#
ns:draw(x, y, w, h)Obj methods#
obj:children()obj:forward()obj:getParent()obj:getPosition()obj:getQuat()obj:getRotation()obj:hide()obj:isPlaying(name)obj:lookAt(x, y, z)obj:move(dx, dy, dz)obj:moveLocal(dx, dy, dz)obj:play(name, opts)obj:right()obj:rotate(rx, ry, rz)obj:rotateWorld(rx, ry, rz)obj:setParent(p, keepWorld)obj:setPosition(x, y, z)obj:setQuat(x, y, z, w)obj:setRotation(rx, ry, rz)obj:setVisible(on)obj:show()obj:stop()obj:toLocal(x, y, z)obj:toWorld(x, y, z)obj:up()Object methods#
object:addTag(tag)object:childCount()object:destroy()object:exists()object:getChild(index)object:getName()object:getPosition()object:getWorldPosition()object:hasTag(tag)object:id()object:isActive()object:setActive(active)object:setName(name)object:setParent(v)object:setPosition(x, y, z?)object:setRotation(rx, ry?, rz?)object:setScale(sx, sy?, sz?)P methods#
p:draw(camX, camY)p:layer(image, factor, opts)Particles methods#
particles:burst(count)particles:count()particles:emit(x, y, count?)particles:setAdditive(on)particles:setColors(r1, g1, b1, a1, r2, g2, b2, a2)particles:setDamping(d)particles:setDirection(dir, spread?)particles:setGravity(x, y)particles:setLife(min, max?)particles:setMax(n)particles:setPosition(x, y)particles:setRadial(a)particles:setRate(r)particles:setShape(kind, a?, b?)particles:setSize(start, finish?)particles:setSpeed(min, max?)particles:setSpin(min, max?)particles:setTangential(a)particles:setTexture(ud)particles:setTurbulence(t)particles:start()particles:stop()Pool methods#
pool:countLive()pool:each(fn)pool:free(obj)pool:freeAll()pool:get()Pose methods#
pose:bind()pose:blend(a, ta, b, tb, w)pose:blendToward(anim, time, w)pose:boneAxis(name, ax?, ay?, az?)pose:bones()pose:boneWorld(name)pose:clone()pose:draw(x, y, z, scale?)pose:drawRot(x, y, z, rot_y, scale?)pose:footIK(opts?)pose:hasBone(name)pose:ikTwoBone(root, mid, end, tx, ty, tz, px?, py?, pz?)pose:layer(anim, time, w, opts?)pose:legs()pose:lookAt(name, tx, ty, tz, ax?, ay?, az?)pose:ragdoll(cfg?)pose:resetBone(name)pose:rotateBone(name, x, y, z)pose:sample(anim, time)pose:setBonePosition(name, x, y, z)pose:setBoneQuat(name, x, y, z, w)pose:setBoneRotation(name, x, y, z)pose:setBoneScale(name, sx, sy?, sz?)pose:setRootMotion(v)pose:setWorld(x, y, z, rot_y?, scale?)Q methods#
q:all(pred)q:any(pred)q:average(fn)q:chunk(n)q:concat(other)q:contains(target)q:count(pred)q:distinct(keyFn)q:each(fn)q:first(pred)q:flatMap(fn)q:flatten(depth)q:groupBy(keyFn)q:having(name)q:iter()q:join(sep, fn)q:last()q:map(fn)q:max(fn)q:maxBy(keyFn)q:min(fn)q:minBy(keyFn)q:none(pred)q:nth(i)q:partition(pred)q:pluck(name)q:reduce(fn, init)q:reject(pred)q:reverse()q:shuffle()q:skip(n)q:skipWhile(pred)q:sort(cmp)q:sortBy(keyFn, desc)q:sum(fn)q:take(n)q:takeWhile(pred)q:tap(fn)q:toMap(keyFn, valFn)q:toTable()q:where(pred)q:window(n)q:withIndex()q:zip(other, fn)RNG methods#
rng:bool(p)rng:dice(n, sides)rng:float(a, b)rng:gaussian(mu, sigma)rng:inCircle(r)rng:int(a, b)rng:next()rng:pick(t)rng:reseed(seed)rng:shuffle(t)rng:sign()rng:weighted(map)Ragdoll methods#
ragdoll:amount()ragdoll:apply(pose, dt?)ragdoll:blend(v)ragdoll:bodies()ragdoll:bodyFor(name)ragdoll:capture(pose)ragdoll:destroy()ragdoll:draw()ragdoll:go(secs?)ragdoll:impulse(part, ix, iy, iz)ragdoll:isActive()ragdoll:isSettled()ragdoll:position()ragdoll:push(x, y, z, bone?)ragdoll:recover(secs?)ragdoll:remove()ragdoll:setStiff(on, stiffness)ragdoll:setVelocity(x, y, z)ragdoll:update(dt)Root methods#
root:blur()root:draw()root:get(id)root:hasFocus()root:isHovered()root:setReference(w, h)root:update(dt)Ruin methods#
ruin:damage(x, y, z, radius, amount)ruin:draw()ruin:events()ruin:explode(x, y, z, radius, power)ruin:impact(x, y, z, dx, dy, dz, power)ruin:info()ruin:loose()ruin:owns(id)ruin:raycast(ox, oy, oz, dx, dy, dz, max?)ruin:remove()ruin:reset()ruin:update(dt)Scatter methods#
scatter:add(cfg)scatter:clear()scatter:config(cfg)scatter:draw()scatter:mesh(id, verts)scatter:remove(i)scatter:set(i, cfg)scatter:stats()scatter:update(ground, x, z)Scene methods#
scene:addPolygon(pts)scene:addRect(x, y, w, h)scene:addSegment(x1, y1, x2, y2)scene:begin()scene:cast(lx, ly, cam)scene:clear()Shader methods#
shader:id()shader:send(key, a?, b?, c?, d?)Soft methods#
soft:links()soft:pin(i, pinned)soft:point(i)soft:points()soft:update(dt)Surface methods#
surface:getParallax()surface:getQuality()surface:getShading()surface:getTiling()surface:hasLayer()surface:setAntiTile(a, scale?, blend?)surface:setColor(r, g, b)surface:setDetail(mult, strength, fade?)surface:setLayerEnabled(on)surface:setLayerRange(lo, hi)surface:setMaterial(m, r?)surface:setNormalStrength(s)surface:setParallax(depth, shadow?)surface:setProjection(x, y, z, yaw?)surface:setShading(name, param?)surface:setSharpness(s)surface:setSpecularAA(k)surface:setTiling(t)System3D methods#
system3d:burst(count)system3d:count()system3d:emit(x, y, z, count?)system3d:onDeath(child, count)system3d:setAdditive(on)system3d:setColorRamp(r1, g1, b1, a1, r2, g2, b2, a2, r3, g3, b3, a3)system3d:setColors(r1, g1, b1, a1, r2, g2, b2, a2)system3d:setDamping(d)system3d:setDirection(x, y, z, cone?)system3d:setGravity(x, y, z)system3d:setLife(min, max?)system3d:setMax(n)system3d:setMeshShape(kind)system3d:setMode(mode)system3d:setPosition(x, y, z)system3d:setRate(r)system3d:setShape(kind, a?, b?, c?)system3d:setSize(a, b?)system3d:setSpeed(min, max?)system3d:setSpin(min, max?)system3d:setStretch(s)system3d:setTexture(ud)system3d:setTurbulence(t)system3d:start()system3d:stop()Target methods#
target:id()target:setSize(a, b?)Task methods#
task:cancel()task:isDone()task:isRunning()task:onDone(cb)task:result()Terrain methods#
terrain:color(x, z)terrain:draw(x, z)terrain:height(x, z)terrain:normal(x, z)terrain:physics(opts?)terrain:physicsTiles()terrain:raycast(ox, oy, oz, dx, dy, dz, maxd?, step?)terrain:rebuild()terrain:set(cfg)terrain:slope(x, z)terrain:stats()terrain:updatePhysics(x, z)Trail3D methods#
trail3d:setAdditive(on)trail3d:setColors(r1, g1, b1, a1, r2, g2, b2, a2)trail3d:setLifetime(l)trail3d:setMaxPoints(n)trail3d:setPosition(x, y, z)trail3d:setTexture(ud)trail3d:setWidth(w)Transform methods#
transform:copy()transform:forward()transform:getName()transform:getParent()transform:getPosition()transform:getQuat()transform:getRotation()transform:getScale()transform:getWorldPosition()transform:getWorldQuat()transform:getWorldRotation()transform:localMatrix()transform:lookAt(x, y, z, ux?, uy?, uz?)transform:matrix()transform:move(x, y, z)transform:moveLocal(x, y, z)transform:right()transform:rotate(rx, ry, rz)transform:rotateWorld(rx, ry, rz)transform:set(o)transform:setName(n)transform:setParent(p, keep?)transform:setPosition(x, y, z)transform:setQuat(x, y, z, w)transform:setRotation(rx, ry, rz)transform:setScale(x, y?, z?)transform:setWorldMatrix(a)transform:setWorldPosition(x, y, z)transform:setWorldQuat(x, y, z, w)transform:setWorldRotation(rx, ry, rz)transform:toLocal(x, y, z)transform:toWorld(x, y, z)transform:up()W methods#
w:animate(o)w:build(spec)w:button(p)w:checkbox(p)w:column(p)w:getValue()w:grid(p)w:hide(o)w:image(p)w:label(p)w:panel(p)w:progress(p)w:row(p)w:scroll(p)w:setEnabled(b)w:setText(s)w:setValue(v)w:setVisible(b)w:show(o)w:slider(p)w:spacer(p)w:textField(p)World methods#
world:add(e, name, data)world:alive(e)world:count(name)world:destroy(e)world:each(name, fn)world:entity()world:get(e, name)world:has(e, name)world:remove(e, name)world:removeSystem(fn)world:system(fn)world:update(dt)world:view(...)a methods#
a:drawFps(offX, offY, offZ, pitch, yaw, roll, scale)computedMethods methods#
computedmethods:peek()computedmethods:stop()effectMethods methods#
effectmethods:run()effectmethods:stop()refMethods methods#
refmethods:freeze()refmethods:peek()refmethods:touch()vec2mt methods#
vec2mt:angle()vec2mt:clone()vec2mt:distance(o)vec2mt:dot(o)vec2mt:length()vec2mt:length2()vec2mt:lerp(o, t)vec2mt:normalize()vec2mt:rotate(a)vec2mt:unpack()vec3mt methods#
vec3mt:cross(o)vec3mt:distance(o)vec3mt:dot(o)vec3mt:length()vec3mt:lerp(o, t)vec3mt:normalize()vec3mt:unpack()