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

miaoda-game-path-core

v0.3.1

Published

Engine-agnostic path-following core: waypoint polylines, Catmull-Rom splines and cubic beziers, an arc-length 'baking' engine for constant-speed travel, and a PathFollower with tangent-facing rotation and perpendicular sine sway. No rendering, no engine d

Readme

miaoda-game-path-core

Use this package for scripted continuous movement along waypoints, Catmull-Rom splines, or cubic Bezier curves. It bakes curve length for approximately constant-speed travel and provides tangent-facing rotation, loop/ping-pong modes, and optional sine sway.

This is path following, not pathfinding. Use grid-core to find a route around obstacles, shooter-core for free-moving bullets, and combat2d-core for hits.

Install and follow a path

pnpm add miaoda-game-path-core
import { BakedPath, PathFollower, SplinePath } from 'miaoda-game-path-core';

const path = new SplinePath([
  { x: 900, y: 700 },
  { x: 500, y: 620 },
  { x: 220, y: 520 },
  { x: 480, y: 420 },
]);
const follower = new PathFollower(new BakedPath(path), {
  speed: 260,
  mode: 'clamp',
  sway: { amplitude: 18, frequency: 1.2 },
});

const sample = follower.tick(dtSeconds);
moveActor(sample.pos.x, sample.pos.y);
faceActor(sample.angleDeg);
if (sample.done) beginCombatAI();

speed is world units per second and tick receives seconds. Angles are degrees with 0 along +X; the renderer decides whether increasing Y appears up or down.

Choose path geometry

| Path | Use it for | | --- | --- | | PolylinePath | Exact straight segments and hard waypoint corners | | SplinePath | Smooth curves that pass through authored waypoints | | BezierPath | Explicit cubic handles for loops, hairpins, and controlled S-curves |

Raw curve parameter t is not proportional to distance. Wrap geometry in BakedPath and query by distance to avoid actors slowing on bends and accelerating on straights. Increase samplesPerSegment for tighter curves; rebuild when geometry changes.

Follower behavior

  • clamp stops at the end and reports done.
  • loop wraps to the start.
  • pingpong reflects at both ends.
  • sway adds perpendicular sine movement without changing the reported tangent heading.

Use seek to jump to a distance and setSpeed to change travel speed. The core returns desired transforms only; rendering, collision, pausing, and handing control to another movement system remain game-owned.