npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@umicat/three-sdk

v1.68.0

Published

Three.js runtime for Umicat games: the scene3d design format, its loader with physics, a kinematic character controller, and the Umicat platform via @umicat/platform-sdk.

Readme

@umicat/three-sdk

The three.js runtime for Umicat games, per ADR-033. Platform services come from @umicat/platform-sdk untouched; what lives here is the engine layer we own.

Status: published and in use. @umicat/three-sdk is on npm; Balaboo (a tower defence that ships from woodland/) is built on it, and every new 3D project is forked from umicat-template's template-3d branch — which is what gitManager.createGameFromFork actually clones. (Not umicat-template-3d: that was the scratch repo the template was developed in, and it has been archived since 2026-09-11 precisely because two copies of a template is how someone eventually edits the wrong one. This line named it for two weeks after that, which is the same failure the note below describes.)

What it has: the scene3d format and loader, physics wiring, a character controller and animator, an input layer that mounts on-screen controls on touch devices and binds keys everywhere, bone sockets, swappable skins and attachments, hit tints, audio, the editor's screenshot/video-capture protocol, and a read-and-write design view (EditorDesignPlayer3D: click-to-pick, drag-to-move, a host→iframe patch channel the platform Inspector drives, drag-and-drop model placement — umicat:editor:dropModel3d in, umicat:editor:modelDropped3d out — which raycasts the drop point against the ground plane and fetches the GLB straight from its CDN url, no manifest entry required — and a full Roblox/Unity-style 3-axis Move/Rotate/Scale gizmo on the selected entity, mode switched via umicat:editor:setGizmoMode3d, posting dragEnd3d/rotateEnd3d/scaleEnd3d on release — plus Delete (umicat:editor:deleteEntity3d) and transform-only undo (Ctrl/Cmd+Z; the undo stack itself lives on the host, this player only replays a patchEntity3d restore)). The desktop camera matches Roblox Studio: left-click/drag selects and manipulates (entities, the gizmo), right-drag looks around, WASD flies, Q/E move straight down/up, Shift speeds up — touch is untouched (still orbit/ pinch-zoom via OrbitControls, which mouse input no longer reaches at all). What it still does not have: undo of entity creation/deletion, multi-select, a local/global axis toggle (the gizmo is local-space only), middle-mouse pan, F-to-focus, or Studio's comma/period ring-rotate.

This paragraph said "seed, not a product — no input system, no character controller, no audio, and no published package" for ten minor versions after each of those arrived. A status line is the first thing anyone reads and the last thing anyone updates.

Multiplayer is in the layer below, and it has rules worth reading before you design anything around it — the room type is always 'lobby', and the server is authoritative about identity and ownership rather than about your game's rules (so shared, contended state has no referee, and secret state is not possible yet). It is written up in @umicat/platform-sdk's README, under "rooms: what the server guarantees, and what it does not". A 3D game shipped the wrong room type because that write-up used to live only in the Phaser SDK's guide, which nothing here points at.

@umicat/platform-sdk        identity · saves · gameData · rooms · ai · voice · dialogue
        ▲                              (shared with @umicat/phaser-sdk)
        │
@umicat/three-sdk       ThreeUmicat · scene3d · loadScene3D · physics · Input3D
                        CharacterController3D · CharacterAnimator · GameAudio
                        sockets · skins · attachments · tints
                        setupScreenshotListener/setupRecordingListener
        ▲
   your game            gameplay

Effects — @umicat/three-sdk/vfx (format v2 since 1.36.0)

Plays .vfx.json effects made in the VFX Editor. A separate entry point that imports three and nothing else, so the editor and any game can use it without the physics or platform layers.

import { loadVfx } from '@umicat/three-sdk/vfx';
const fire = await loadVfx('uploaded/campfire.vfx.json'); // + every image it names
const fx = fire.spawn();                                   // many copies share the images
scene.add(fx.root);
// each frame: fx.update(dt);   one-shot: if (fx.finished) fx.dispose();
// a looping effect (a status aura): fx.stop() when it should end -- it plays its `close` clip or drains, then fx.finished

An effect has two kinds of layer. Emitters are particle systems modelled on Godot's ParticleProcessMaterial (umicat-design ADR-054): an emission shape (point, sphere, box, ring), a direction cone, random ranges, gravity / damping / radial / tangential / orbit motion, curves and gradients over each particle's life, a look (soft dot, glow, star, an image or a sprite sheet) facing the camera, stretched along its motion or flat on the ground, bursts, and sub-emitters. Simulation is seeded, fixed-step and on the CPU; each layer draws as one instanced quad mesh. Flipbooks are a sprite sheet played frame by frame on one quad. Images are named by bare filename; loadVfx resolves them beside the effect file and rejects, naming the image, if one cannot load.

parseVfx accepts version-1 documents (1.35's upward-firing disc) and upgrades them to the v2 emitter that plays the same, and fills every emitter field a document leaves out from emitterDefaults().

The effect material (version 3, 1.37.0, ADR-055). look: { type: 'material', material } draws a particle with up to three masks — procedural noise (perlin / value / cellular / cell edges, fbm / ridged / ping-pong, domain warp; generated in the browser and tileable), a gradient, a shape or an image — each scaled, scrolled, spun, optionally polar, reshaped (levels) and offset, combined with Binbun's twelve blend modes; then dissolve, an alpha ramp, a gradient map for colour, an optional glowing edge, and HDR emission. dissolve, threshold, opacity, emission and each mask's strength / offset are a number or { overLife: Curve }. See src/vfx/material.ts.

Meshes (version 4, 1.38.0, ADR-055 step 2). meshes: [...] places Godot's primitive meshes (quad, plane, sphere, cylinder/cone, torus, box, flat ring) in the effect, each shown for a start/life window of the cycle with scale, colour and alpha over that life and drawn with a material; emitter.mesh draws every particle as such a mesh (size scales it; it stands on its velocity with align: velocity). Materials gained rim (fresnel), displacement, a cutout threshold and a band gradient; emitters gained per-axis sizeOverLifeXYZ. Meshes draw before particles.

Lights and scale (version 5, 1.39.0, ADR-055 step 3). lights: [...] (at most 2 point lights: position, colour, candela intensity, range, a start/life window, intensity over life, flicker). They are created once and dimmed to 0 when off, because adding or removing a three.js light recompiles every lit material in the scene; new VfxInstance(doc, { lights: false }) or effect.spawn({ lights: false }) builds none. An effect placed at a scale scales everything: world-space particles take it in speed and size, and a light's range follows it.

Trails (version 6, 1.40.0, ADR-055 step 4). emitter.trail: { length, width, widthOverTrail?, material? }: each particle keeps up to 16 points of where it has been and draws a ribbon turned to the viewer in the vertex shader (no camera needed). u runs from the particle (0) to the tail end (1); without a material the trail takes the particle's colour and fades out. At most 8000 trail points per effect, checked at parse.

stop() (1.41.0, ADR-056). Ends an effect the way it was meant to end: emission stops, particles alive finish their lives, a looping sprite sheet finishes its cycle, a mesh layer or light with a window plays it out and a whole-cycle one goes out; then finished turns true. Works on every format version, which is how a game ends a looping effect.

Tracks and clips (version 7, 1.42.0, ADR-056 step 2). Godot's AnimationPlayer for an effect. A track animates one value of one layer: { target: 'meshes.ring.scale', keys: [[0, [0, 0, 0]], [.4, [1, 1, 1], .5]], interp? }. A target is <emitters|meshes|lights|flipbooks>.<id>.<field> and may go deeper (emitters.core.look.material.dissolve, meshes.ring.material.masks.1.strength). Numbers, vectors, #rrggbb colours (blended in linear space) and enabled (always stepped) can be animated; a Range field takes a plain number while a track drives it. A mesh's shape, a material's structure, curves, gradients and ids cannot, and the parser says so by name. A key is [time, value, ease?], ease being Godot's transition exponent as-is (2 in, 0.5 out, negative in-out, 0 hold); interp: smooth is Godot's cubic.

Without clips, a top-level tracks list plays over duration (the clip main). With clips: [{ name, duration, loop, next?, tracks }] (and startClip), each clip is a cycle of its own: emitter windows and bursts, mesh and light windows and track times count from the clip's start; a clip with next hands over when it ends; one with neither loop nor next ends the effect. A field a clip does not animate holds the last value it was given, as in Godot -- an idle with no tracks keeps a portal open. fx.play('idle') switches at once, fx.clip / fx.clipTime say where it is, fx.stop() plays the clip named close when there is one, and fx.seek(t, clip?) replays to that moment at the fixed step (a clip reached by next is played through its predecessors).

Parameters and bindings (version 8, 1.43.0, ADR-056 step 4). params: [{ name: 'open', value: 1, min: 0, max: 1 }] are named numbers a game sets (fx.set('open', 0.4), fx.get('open'), fx.paramNames) and tracks can animate (params.open). bindings: [{ param: 'open', target: 'lights.glow.range', map? }] write a parameter into a layer's number or vector (every component) after the tracks, every step -- so one number can open a portal's light, particles and material together, which Godot's packs do with a controller script. map is a Curve sampled at the parameter's place in its range (0 at min, 1 at max). animatableTargets(doc) lists every target the parser accepts; timelineWarnings(doc) names a field that is both keyed and bound (the binding wins).

Linear blending (1.52.0, ADR-059). Render through LinearOutput so transparency blends in linear light (as Godot does and the VFX editor previews):

import { LinearOutput } from '@umicat/three-sdk';
const out = new LinearOutput(renderer, scene, camera);   // once
out.render();                                             // each frame, instead of renderer.render(scene, camera)

One extra full-screen pass and a half-float target; out.addPass(bloom) adds post-processing before the final encode. Additive effect layers no longer clip colour x emission at 1 before alpha (premultiplied in the shader).

Portals (version 15, 1.50.0, ADR-058). Four general capabilities:

  • material.refract: { amount, mode: 'zoom' | 'offset', tint, mix } bends the opaque scene behind a layer. It needs the scene's colour: new VfxDepth(renderer, { color: true }) (a full draw of the opaque scene per frame instead of depth only); without it the material draws as usual.
  • material.layers: { count, depth, fade, shrink, phase } repeats the mask stack deeper into a mesh layer along the view direction -- a parallax tunnel.
  • meshes[i].stencil: { ref } turns a mesh layer into an invisible stencil mask. Mark the game objects that should show only through it: material.stencilWrite = true; material.stencilFunc = T.EqualStencilFunc; material.stencilRef = ref; and create the renderer with stencil: true.
  • emitter shape: { type: 'mesh', mesh, normal } emits from a mesh surface, area-weighted; normal aims the cone along the surface normal (a negative speed pulls inward).

Beams (version 14, 1.49.0). A track or binding target may name one axis of a vector (meshes.core.scale.y, emitters.sparks.shapeOffset.z); a binding may drive an on/off field (enabled: on at a mapped value of 0.5 or more) and may take mode: 'multiply' | 'add' (one plain set per field, then the others in order, each pass starting from the field's own value that step -- a multiply never compounds). A beam: length sets its long axis, open multiplies it. Build beams along +Z and aim one from the game:

fx.aimAt(target.position, 'length');   // turns +Z at the target, sets `length` to the distance
fx.set('open', 0.5);                    // set() applies tracks and bindings at once

Decals (version 13, 1.48.0). decals: [decalLayer('scorch', 'scorch.png', { glow: { texture: 'embers.png', energy: 4 }, size: [3, 1, 3] })] -- an image laid onto the ground under the effect (at most 4), with a modulate color, opacity, an optional additive glow, a time window and curves over it, all keyable. With a VfxDepth it is PROJECTED onto whatever is there (a slope, a step, a rock); without one it is a flat quad on the ground plane. The image covers and the glow adds, in one premultiplied pass.

Material idioms (version 12, 1.47.0). A mask may take wave { amount, frequency, speed } -- u += amount x sin(2 pi (frequency x v - speed x time)), before its scale and scroll; and a material may take hueShift { amount, mask? } -- a turn of the hue wheel (-1..1), the whole colour or, with mask, amount x (that mask's value x 2 - 1) per pixel. Both turn the MATERIAL's colour (its gradient map), before the particle colour multiplies it. Stepped colours need no field: repeat a gradient stop's t for a hard edge.

Soft particles (version 11, 1.46.0, ADR-057). proximityFade (metres, 0.01-10) on an emitter (its trail and second pass follow), a mesh layer or a flipbook fades it out as it nears the opaque scene behind it, as Godot's proximity fade (Binbun's flames and smoke use 0.2-0.5). It needs the scene's depth, which only the game can render:

import { VfxDepth, useVfxDepth } from '@umicat/three-sdk/vfx';
const depth = new VfxDepth(renderer);   // once; { scale: 1 } for full resolution (default 0.5)
useVfxDepth(depth);                     // instances created after this fade; spawn({ depth: null }) opts one out
// every frame:
depth.update(scene, camera);            // the OPAQUE scene's depth (effects and transparent things left out)
renderer.render(scene, camera);

Without a VfxDepth the field does nothing. Nothing wires it for a game: a game that shows no effects should not pay the extra depth pass.

Particle extras (version 10, 1.45.0). Each optional on an emitter, from Godot's ParticleProcessMaterial: preprocess (seconds simulated at start and on reset(), so a looping smoke starts full; clips and tracks do not move), hue (Range, turns of the hue wheel per particle) + hueOverLife, turbulence { scale, speed, evolve, influence, influenceOverLife? } (Godot's numbers and defaults: 9, [0,0,0], 0.2, 0.1; it steers and never brakes), directionalVelocity { speed, x?, y?, z? } (curves over life along the emitter's own axes), radialSpeedOverLife, spinOverLife, sizeOverSpeed { speed: [low, high], curve }, linearAccel + linearAccelOverLife, and secondPass { look, mesh?, blend } -- the same particles drawn again (a core and its glow), sharing the first pass's per-particle buffers. Mesh shapes gain capsule { radius, height }. Any of them makes a document version 10.

Draw order (version 9, 1.44.0). Any emitter, mesh layer or flipbook may set drawOrder, a whole number -10..10: higher draws on top. Absent means 0, which keeps the default -- meshes under particles (an effect's cores and ground rings), each kind in list order, a trail under its own particles. A muzzle flash whose glow should sit over the flames sets drawOrder: 1 on the glow. The field's PRESENCE makes a document version 9, so leave it out rather than writing 0.

Write the lowest version. minimumVersion(doc) is 15 with refract, layers, a stencil or a mesh emission shape, 14 with a binding mode, a switch binding or an axis target, 13 with decals, 12 with a material's hueShift or a mask's wave, 11 with a layer's proximityFade, 10 with a particle extra or a capsule, 9 with a layer's drawOrder, 8 with parameters or bindings, 7 with tracks or clips, 6 with trails, 5 with lights, 4 with meshes, 3 with a material, else 2; the editor and the agent write that, so an effect that needs nothing new stays version 2 and keeps playing on 1.36.

What is proven, and by what

npm test runs a real three.js game in a real browser against a host speaking the real wire protocol. Only the host page and the backend behind it are mocked — every line of SDK is the shipped code.

| claim | test | |---|---| | a 3D game does the real handshake and gets identity | host is umicat-home-ui, not standalone | | cloud saves go over RPC, not to localStorage | round-trip, plus the host's RPC log | | runtime AI uses the same channel | ai.complete returns {ok, text} per the protocol | | scene3d builds the authored scene | entity count, parenting, the right clip playing | | physics runs | a crate dropped from y=6 settles on the ground and does not fall through | | design mode is render-only | same entities, zero mixers, zero bodies | | authoring mistakes fail loudly | duplicate ids and missing clips throw at load, naming the clips that exist | | music and effects are two volumes | the clip's gain hangs off sfxGain, not the master — audio-volume.test.mjs |

Eight suites, not one: the table above is the platform seam. The others cover the character controller, the animator, sockets, tints, input icons, the courtyard sample and the audio graph.

slice.png is the scene those assertions describe, rendered.

The scene3d format

src/scene3d.ts. It inherits ADR-021's answer to what does the editor edit — design data on disk, no save loaded — because that answer is engine-neutral. It does not inherit the 2D schema, which does not survive three dimensions.

Each rule is a decision:

  • Rotation is a quaternion, not Euler angles — those are order-dependent and interpolate badly, so an editor round-tripping them drifts.
  • Ids are authored and stable. The editor, the runtime and saves all refer to entities by id; regenerating them on load breaks every reference on first edit.
  • Transforms are local to parent. Storing world transforms makes reparenting a lie.
  • Assets are referenced by id, never by path — paths change on re-import.
  • Colliders are explicit. A render mesh used as a dynamic collider is the classic way to ship a game that is correct and unplayably slow.
  • Animation clips are mapped semantically per asset ({ walk: 'Walk' }). Guessing that every model calls its walk cycle Walk fails silently; an independent review's cross-rig retarget returned zero matched bones and zero tracks, which is the same class of failure, quieter.
  • What a character wears is authored on the entity (attachments: [{ modelAssetId: 'sword' }]). Because the character already says where its sockets are and the prop already says which one it belongs in, naming the prop is the whole declaration — a knight in armour is data, not equip code written once per game.
  • A prop declares which socket it belongs in (socket: 'hand-right' on the sword, sockets: { 'hand-right': {...} } on the character). Both halves are properties of the MODEL, not of any game — a cap goes on a head in every game there has ever been — so a game that owns a character pack does not also have to own a lookup table saying a cap is headwear.
  • Skins are declared per asset and chosen per entity (skins: { zombie: 'skins/zombieA.png' }, then skin: 'zombie'). A body and its wardrobe are separate files, so N bodies × M skins costs N + M assets rather than N × M baked glb files. It is authored data rather than a call a game makes, for the same reason the clip map is: a capability only reachable from code is one most games never find, and an editor cannot offer a list it cannot see.

validateScene refuses duplicate ids, dangling parents, entities that would render nothing, trimesh colliders on dynamic bodies, and malformed quaternions — at load, because every one of them otherwise appears as a blank screen later.

Solved: the character that disappeared once the camera moved

Worth keeping, because the symptom pointed everywhere except at the cause.

In the Courtyard sample the fox rendered at boot and was gone after walking, leaving flat ground. Every measurement said it should be visible: 18 draw calls and 5,042 triangles that frame, hero.visible === true, bones at sensible world positions, and three's own Vector3.project(camera) putting the character at NDC (0, 0) — dead centre — while the centre of the frame was a single flat colour. A canvas read-back agreed with the screenshot, so it was the render and not the capture.

It was the ground. makePrimitive laid the plane down with mesh.rotation.x = -Math.PI / 2, and applyTransform then set the object's quaternion from the entity's authored rotation — identity — discarding it. So every "ground" stood upright as a 40x40 wall. At boot the camera and the character were on the same side of it and the picture looked right, with the wall reading as ground. Walk past it and the camera is behind a wall, still pointing correctly at a character it can no longer see. A raycast through the frame centre said it in one line: ground at 9.79m, fox at 13.89m.

Fixed by rotating the geometry (PlaneGeometry(...).rotateX(-Math.PI/2)) rather than the object, so an entity's authored rotation is never overwritten. After the fix the same raycast returns fox at 13.89m then ground at 18.05m — which matches the hand-computed ground crossing exactly.

Two lessons kept deliberately. A correct-looking measurement can be measuring the right thing about the wrong scene: NDC (0,0) was true the whole time, the character was centred, behind a wall. And the first render looked fine, which is how a construction bug this total survived a screenshot.

One real bug was fixed while chasing it and is unrelated but worth having: a SkinnedMesh's bounding sphere comes from the bind pose and does not follow the bones, so three.js culls a character against a stale volume once it moves. loadScene3D sets frustumCulled = false on skinned meshes.

0.3.0 — actions, not just locomotion

CharacterAnimator owns the two things every game was writing by hand, and both are character behaviour rather than game logic (ADR-034).

Locomotion follows character.state, not the keys held — a clip chosen from input leaves a character walking in mid-air.

An action is a one-shot that interrupts and returns. Attacking is not a state you enter, it is a thing that happens: play('attack') runs the clip once, holds its last frame rather than snapping to the bind pose in the gap, and hands control back. busy is there so a game can refuse a second swing from one press — firing twice is the usual reason an attack feels broken.

Changing locomotion mid-action does not blend a walk cycle into the middle of a sword swing: the new locomotion clip is swapped in underneath at zero weight and faded up only when the action releases.

Names resolve through the manifest's map first (attack -> attack-melee-right) and then by raw clip name, so a game can reach a clip nobody mapped.

0.2.0 — the character's jump and controls belong to the platform

ADR-034 makes the platform the owner of the character, so two things that used to be each game's problem moved in here.

Jump (jumpSpeed, coyoteTime, jumpBuffer, jumpCut). 0.1.0 left jump to the game on the grounds that how it feels is a design decision. That is true right up until every game shares one character — then a badly-tuned jump is badly tuned everywhere. update(dt, dir, { jump }) takes the button's CURRENT state and the controller owns the timing: coyote time so a press a few frames late still counts, buffering so a press slightly early is not lost, and a cut on release so a tap hops and a hold arcs.

The cut applies once, on release. Applying it every airborne frame compounds (×0.45, ×0.2, ×0.09…) and swallows the jump entirely — caught by the release-before-landing test, not by reading the code.

state (idle | walk | jump | fall) so animation follows what the character is DOING rather than what was pressed; deriving it from input leaves a character walking in mid-air. teleport() is the respawn primitive, and it clears vertical velocity — without that, a character rescued from a long drop arrives still travelling at the speed it fell.

Touch (Input3D({ touch }), on by default for coarse-pointer devices). An on-screen thumbstick and jump button, merged into the same direction() and jump a keyboard feeds, so no game branches on input source. Before this, 3D was simply unplayable on a phone.

The controls mount to <body>, not the game's #hud: a game that writes hud.textContent = '...' wipes every child, and the controls vanish with no error at all. That happened. The HUD belongs to the game; this layer belongs to the platform.

What is deliberately missing

No character controller (Rapier's KinematicCharacterController is the intended basis), no input, no audio, no editor, no HUD, no asset pipeline integration, no published build. Those are the next slice's scope, and pretending otherwise would be a worse lie than the gap.

ThreeUmicat.dialogue has no default renderer: a game passes opts.renderer or it throws. A 3D dialogue box is a design question nobody has answered, and shipping a broken default would be worse than requiring an explicit one.

1.68.0 — a world made of pieces

loadScene3D gives you a world. world.add() puts another scene file's entities into it — the same render scene, the same physics — and hands back what takes them out again:

const world = await loadScene3D(main, manifest, { rapier: RAPIER });

const east = await world.add(await (await fetch('scenes3d/east.json')).json());
world.entities.get('east_gate');     // one map for the whole world
east.entities;                       // …and this piece's part of it
east.remove();                       // objects, bodies, mixers, water: gone

That is all a streamed map is: keep the pieces near the player, drop the ones behind. When to do which is the game's business — the SDK does not know where your player is or how your world is cut up.

  • Only the piece's entities are used. Sky, lights, gravity and camera belong to the scene the world was loaded from.
  • Entity ids are unique across the WHOLE world. A clash throws, naming the ids, before anything is fetched.
  • { offset } places a piece that was authored around its own origin.
  • A model is fetched once however many pieces use it, and released when the last entity using it is removed.
  • Shadow cameras are fitted to the first scene only.