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

diamon-engine

v0.1.3

Published

Diamon 3D engine runtime and editor workbench.

Readme

Diamon

Diamon 是一个以 3D 为主的 Web 游戏引擎原型。当前阶段只做 3D 引擎和编辑器本身,聚焦运行时架构、资源管理、保存加载、性能诊断和压力测试,不做任何用 Diamon 制作出来的游戏,也不保留 2D 引擎代码。

当前能力

3D 引擎

  • Engine3D:WebGL 渲染、主循环、固定逻辑步长、窗口自适应、渲染统计、自适应画质、阴影开关和像素比例控制
  • Scene3D:Three.js 场景封装、透视相机、3D 实体管理、逐帧更新调度
  • Entity3D:位置、旋转、缩放、标签、组件挂载
  • Component3D:生命周期、逐帧更新、固定步更新、销毁清理
  • MeshPrimitive3D:盒子、球、圆柱、圆锥、圆环、平面、基础几何体和材质复用
  • PrimitiveBatch3D:按几何体和材质自动合批到 InstancedMesh,降低大量同类静态对象的 Draw Call
  • WorldPartition3D:按格子追踪对象,并按相机视锥和距离做低频可见性裁剪
  • DistanceLod3D:按相机距离切换近中远三档对象,远处可降为低模或点云
  • ResourceManager3D:贴图和 GLB/glTF 加载缓存、引用释放和统一销毁
  • MemoryDiagnostics3D:扫描场景里的 Mesh、实例化 Mesh、几何体、材质、贴图和重复资源
  • PerformanceBenchmark3D:生成自动合批、LOD 和内存诊断基准场景
  • PerformanceGuard3D:持续监控 FPS、画质比例和平均帧耗时,在危险区触发自动降载或切换防线
  • ShapeAutoScaler3D:自动识别基础形状、实例化对象、点云和模型,并按统一倍率扩大目标对象
  • Light3D:环境光、方向光、点光源
  • Input3D:键盘、鼠标拖动、滚轮缩放
  • OrbitCameraController:可拖动旋转、滚轮远近调整的 3D 相机

引擎编辑器

  • 默认加载 3D 编辑器场景
  • 支持添加基础对象:立方体、球体、圆柱、圆锥、圆环
  • 支持场景树、属性面板、资源面板、预制体面板
  • 支持对象选择、复制、粘贴、删除、批量选择、分组、图层
  • 支持关键编辑操作的撤销和重做
  • 支持场景 JSON 保存、加载、下载和本地缓存
  • 支持模型、贴图、材质、音频资源导入记录,GLB/glTF 模型可导入场景
  • 支持基础预制体保存和复用
  • 显示对象数量、可见对象、Draw Calls、三角面、FPS、帧耗时、几何体、贴图、内存、合批、裁剪、固定步、诊断和慢系统提示
  • 支持 10000 实例化对象、20000 自动合批对象、5000 普通对象、500 万增量压力、50 亿目标和 100 亿目标压力测试
  • FPS 面板会按引擎帧耗时判断 60 FPS 目标承受能力,避免测试浏览器刷新调度把结果压低
  • 静态对象默认不进入逐帧更新队列,性能面板降频刷新,降低编辑器自身开销
  • 大型压力测试时场景树会限制一次渲染的行数,避免编辑器列表本身造成卡顿
  • 500 万、50 亿和 100 亿压力测试会合并到单一超大压力层,并使用代表点 LOD;50 亿以上目标会切换到更轻的 8000 代表点,验证引擎在极端数量下的调度、资源和渲染承受能力
  • 综合基准会同时启用自动合批、LOD、空间裁剪和内存诊断,用接近真实游戏项目的方式检查引擎承压能力
  • 能量保险模式会先用主防线承载 100 亿逻辑冲击;当 FPS、画质或帧耗时进入危险区时切到 500 亿后备防线;后备仍危险时启用 1000 亿隐形保险,并用更少代表点维持运行可控
  • 智能扩大模式会自动识别场景内的盒子、球、圆柱、圆锥、圆环、实例化对象、点云和模型,再把识别到的对象统一放大一遍
  • 保留网格、世界坐标轴、环境光、方向光和编辑相机

运行

npm install
npm run dev

验证

npm run check
npm run build
npm run pack:dry

作为包给其他游戏使用

Diamon 现在可以作为 diamon-engine 包被其他游戏引用。当前包导出三个入口:

  • diamon-engine:默认 3D 运行时入口
  • diamon-engine/engine3d:明确的 3D 运行时入口
  • diamon-engine/workbench:编辑器工作台入口

本地开发中的游戏可以先用本地路径安装:

npm install ../yuyu自制引擎

游戏项目里直接引用:

import { Engine3D, Entity3D, MeshPrimitive3D, Scene3D } from "diamon-engine";

需要编辑器样式时再引入:

import "diamon-engine/styles.css";

发布包前先构建并做干跑检查:

npm run build
npm run pack:dry

3D 最小用法

import { Engine3D, Entity3D, MeshPrimitive3D, Scene3D } from "diamon-engine";

const engine = new Engine3D({ canvas: document.querySelector("canvas")! });
const scene = new Scene3D("Demo");

const box = new Entity3D("Box");
box.addComponent(
  new MeshPrimitive3D({
    kind: "box",
    width: 1,
    height: 1,
    depth: 1,
    color: "#1ec7a6"
  })
);

scene.add(box);
engine.setScene(scene);
engine.start();

目标文档

下一步适合做的引擎能力

  1. 碰撞体、触发器和后续刚体物理
  2. 动画状态机和 GLB/glTF 动画混合
  3. 贴图压缩、材质质量档位和更细的显存统计
  4. 插件式导入器和编辑器扩展流程