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

@shapeshift-labs/frontier-lod

v0.1.2

Published

Patch-native level-of-detail and significance primitives for Frontier rendering and computation workloads.

Downloads

409

Readme

@shapeshift-labs/frontier-lod

Patch-native level-of-detail and significance primitives for Frontier rendering and computation workloads. The package stores LOD profiles and item state as JSON, accepts Frontier patch tuples for mutation, and keeps hot distance/significance state in typed-array caches.

API Shape

import {
  createLodBandFrame,
  createLodCompactFrame,
  createLodEngine,
  createLodMultiObserverFrame,
  createLodTransitionFrame,
  createLodWorkPlan,
  lodItem,
  lodLevel,
  lodProfile,
  materializeLodFrame,
  scheduleLodWork,
  setLodItemPositionPatch
} from '@shapeshift-labs/frontier-lod';

const profile = lodProfile('npc', [
  lodLevel('full', { maxDistance: 20, renderCost: 8, computeCost: 8, updateIntervalMs: 16, lane: 'near' }),
  lodLevel('sim', { maxDistance: 80, renderCost: 3, computeCost: 2, updateIntervalMs: 120, lane: 'mid' }),
  lodLevel('coarse', { maxDistance: 220, renderCost: 1, computeCost: 1, updateIntervalMs: 1000, lane: 'far' }),
  lodLevel('culled', { visible: false, renderCost: 0, computeCost: 0, updateIntervalMs: -1 })
]);

const lod = createLodEngine({
  profiles: [profile],
  items: [
    lodItem('npc:1', 0, 0, { profile: 'npc', radius: 1, priority: 2 }),
    lodItem('npc:2', 90, 0, { profile: 'npc', radius: 1 })
  ]
});

const frame = lod.evaluate({ x: 0, y: 0 }, {
  includeHidden: true,
  budget: { maxVisible: 2000, maxRenderCost: 8000, maxComputeCost: 5000 }
});

const materialized = materializeLodFrame(frame);
const workPlan = createLodWorkPlan(frame, { nowMs: performance.now() });
scheduleLodWork(scheduler, workPlan, (item) => updateNpc(item.id, item.levelId));

lod.commit(setLodItemPositionPatch(1, 40, 0), {
  origin: { actionId: 'npc.move', causeId: 'pathfinding.tick' }
});

const compact = lod.evaluateInto(createLodCompactFrame(lod.itemCount), { x: 0, y: 0 }, { mode: 'distance' });
const bands = lod.evaluateBandsInto(createLodBandFrame(lod.itemCount), { x: 0, y: 0 });
const transitions = lod.evaluateBandTransitionsInto(createLodTransitionFrame(lod.itemCount), { x: 0, y: 0 });
const sharedWorld = lod.evaluateMultiObserverInto(createLodMultiObserverFrame(lod.itemCount), [
  { x: 0, y: 0 },
  { x: 300, y: 0, qualityBias: 0.9 }
]);

Design Notes

frontier-lod deliberately does not own a renderer, virtualizer, scene graph, pathfinder, game loop, or scheduler. It produces JSON-shaped frames for inspection/persistence and typed-array frames for hot loops.

  • JSON snapshots are the durable LOD state.
  • Frontier patch tuples are the mutation format.
  • Item scalar changes update typed caches by exact item index.
  • Profiles support distance, screen-coverage, and priority/significance selection.
  • LOD levels carry render cost, compute cost, lane, update interval, visibility, and metadata.
  • Budgeted evaluation degrades lower-significance items when render/compute/visible budgets are exceeded.
  • evaluate(...) produces a serializable inspection/materialization frame.
  • evaluateInto(...) reuses typed buffers for per-frame distance/screen/priority loops.
  • evaluateBandsInto(...) is a distance-band-only hot path for very large homogeneous sets.
  • evaluateBandTransitionsInto(...) is a Unity CullingGroup-style event path: it keeps internal band state current but only materializes changed indexes, previous levels, and next levels.
  • evaluateMultiObserverInto(...) selects one shared LOD frame across several cameras, spectators, minimaps, AI-interest origins, or server-relevance observers without requiring separate full frames and a merge pass.
  • materializeLodFrame(...) exposes visible/hidden/by-level index lists for DOM, Canvas, WebGL, WebGPU, or game hosts.
  • createLodWorkPlan(...) converts levels and update intervals into scheduler-friendly compute tasks.
  • Scheduler integration is structural, so frontier-scheduler can queue work without becoming a dependency.
  • Scene/virtual/pathfinding integration stays data-shaped: scene graphs can feed world positions, virtualizers can materialize visible indexes, and pathfinding/game systems can lower update cadence for far or low-priority entities.

Related Packages

The published Frontier package family is generated from one shared package catalog so READMEs stay in sync across packages:

Package source repositories:

Install

npm install @shapeshift-labs/frontier-lod

Benchmarks

These are Frontier-only package measurements, not competitor comparisons.

Run package-local measurements:

npm run bench

The benchmark covers 100k-item distance, compact typed-array, distance-band, sparse transition, multi-observer, screen-coverage, priority budget, materialization, scheduler work-plan, and patch-routed position update fixtures.

Latest local package benchmark on Node v26.1.0, darwin arm64, 100k items and 30 rounds:

| Fixture | Median | p95 | | --- | ---: | ---: | | evaluate-bands-distance-100000 | 1.02 ms | 1.65 ms | | evaluate-band-transitions-static-100000 | 822.87 us | 1.26 ms | | evaluate-multi-observer-distance-100000 | 1.76 ms | 1.89 ms | | evaluate-compact-distance-100000 | 1.34 ms | 2.32 ms | | evaluate-distance-100000 | 5.10 ms | 6.08 ms | | evaluate-screen-100000 | 17.38 ms | 31.32 ms | | evaluate-budget-100000 | 21.76 ms | 30.00 ms | | materialize-frame-100000 | 1.13 ms | 1.68 ms | | work-plan-100000 | 12.61 ms | 16.18 ms | | patch-128-positions-100000 | 99.25 us | 175.62 us |