murow 0.0.72 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/README.md +15 -1
  2. package/dist/cjs/core/binary-codec/binary-codec.js +1 -1
  3. package/dist/cjs/core/driver/driver.js +1 -1
  4. package/dist/cjs/core/driver/drivers/immediate.js +1 -1
  5. package/dist/cjs/core/driver/drivers/raf.js +1 -1
  6. package/dist/cjs/core/driver/drivers/timeout.js +1 -1
  7. package/dist/cjs/core/input/index.js +1 -1
  8. package/dist/cjs/core/input/mouse-look/index.js +1 -0
  9. package/dist/cjs/core/input/mouse-look/mouse-look.js +1 -0
  10. package/dist/cjs/core/input/scroll-zoom/index.js +1 -0
  11. package/dist/cjs/core/input/scroll-zoom/scroll-zoom.js +1 -0
  12. package/dist/cjs/core/sparse-batcher/sparse-batcher.js +1 -1
  13. package/dist/cjs/ecs/component.js +1 -1
  14. package/dist/cjs/ecs/system-builder.js +1 -1
  15. package/dist/cjs/ecs/world.js +1 -1
  16. package/dist/cjs/game/loop/loop.js +1 -1
  17. package/dist/cjs/net/adapters/bun-websocket.js +1 -1
  18. package/dist/cjs/renderer/base/renderer-3d.js +1 -1
  19. package/dist/cjs/renderer/prefab-bucket/concrete.js +1 -1
  20. package/dist/cjs/renderer/prefab-bucket/index.js +1 -1
  21. package/dist/cjs/renderer/prefab-bucket/parsers.js +1 -1
  22. package/dist/cjs/renderer/prefab-bucket/specs.js +1 -1
  23. package/dist/esm/core/binary-codec/binary-codec.js +1 -1
  24. package/dist/esm/core/driver/drivers/immediate.js +1 -1
  25. package/dist/esm/core/driver/drivers/raf.js +1 -1
  26. package/dist/esm/core/driver/drivers/timeout.js +1 -1
  27. package/dist/esm/core/input/index.js +1 -1
  28. package/dist/esm/core/input/mouse-look/index.js +1 -0
  29. package/dist/esm/core/input/mouse-look/mouse-look.js +1 -0
  30. package/dist/esm/core/input/scroll-zoom/index.js +1 -0
  31. package/dist/esm/core/input/scroll-zoom/scroll-zoom.js +1 -0
  32. package/dist/esm/core/sparse-batcher/sparse-batcher.js +1 -1
  33. package/dist/esm/ecs/component.js +1 -1
  34. package/dist/esm/ecs/system-builder.js +1 -1
  35. package/dist/esm/ecs/world.js +1 -1
  36. package/dist/esm/game/loop/loop.js +1 -1
  37. package/dist/esm/net/adapters/bun-websocket.js +1 -1
  38. package/dist/esm/renderer/base/renderer-3d.js +1 -1
  39. package/dist/esm/renderer/prefab-bucket/concrete.js +1 -1
  40. package/dist/esm/renderer/prefab-bucket/index.js +1 -1
  41. package/dist/esm/renderer/prefab-bucket/parsers.js +1 -1
  42. package/dist/netcode/cjs/index.js +1552 -0
  43. package/dist/netcode/esm/index.js +1530 -0
  44. package/dist/netcode/types/client/game-client.d.ts +125 -0
  45. package/dist/netcode/types/client/index.d.ts +1 -0
  46. package/dist/netcode/types/client/interpolation-buffer.d.ts +37 -0
  47. package/dist/netcode/types/client/interpolation-buffer.test.d.ts +1 -0
  48. package/dist/netcode/types/codec/delta-codec.d.ts +17 -0
  49. package/dist/netcode/types/codec/delta-codec.test.d.ts +1 -0
  50. package/dist/netcode/types/codec/index.d.ts +1 -0
  51. package/dist/netcode/types/components/index.d.ts +1 -0
  52. package/dist/netcode/types/components/sync-spec.d.ts +43 -0
  53. package/dist/netcode/types/components/sync-spec.test.d.ts +1 -0
  54. package/dist/netcode/types/ctx.d.ts +105 -0
  55. package/dist/netcode/types/ctx.test.d.ts +1 -0
  56. package/dist/netcode/types/handlers/define-handlers.d.ts +47 -0
  57. package/dist/netcode/types/handlers/index.d.ts +1 -0
  58. package/dist/netcode/types/index.d.ts +11 -0
  59. package/dist/netcode/types/integration.test.d.ts +1 -0
  60. package/dist/netcode/types/intents/define-intents.d.ts +53 -0
  61. package/dist/netcode/types/intents/define-intents.test.d.ts +1 -0
  62. package/dist/netcode/types/intents/index.d.ts +1 -0
  63. package/dist/netcode/types/network/base.d.ts +120 -0
  64. package/dist/netcode/types/network/index.d.ts +2 -0
  65. package/dist/netcode/types/network/transport.d.ts +1 -0
  66. package/dist/netcode/types/packets/convergence.test.d.ts +1 -0
  67. package/dist/netcode/types/packets/harness.d.ts +103 -0
  68. package/dist/netcode/types/packets/index.d.ts +2 -0
  69. package/dist/netcode/types/packets/intermittent-intents.test.d.ts +1 -0
  70. package/dist/netcode/types/packets/pathological.test.d.ts +1 -0
  71. package/dist/netcode/types/packets/peer-interpolation.test.d.ts +1 -0
  72. package/dist/netcode/types/packets/reordering.test.d.ts +1 -0
  73. package/dist/netcode/types/packets/virtual-network.d.ts +65 -0
  74. package/dist/netcode/types/predictions/define-predictions.d.ts +45 -0
  75. package/dist/netcode/types/predictions/define-predictions.test.d.ts +1 -0
  76. package/dist/netcode/types/predictions/index.d.ts +1 -0
  77. package/dist/netcode/types/reconciliation.test.d.ts +1 -0
  78. package/dist/netcode/types/rpcs/define-rpcs.d.ts +44 -0
  79. package/dist/netcode/types/rpcs/define-rpcs.test.d.ts +1 -0
  80. package/dist/netcode/types/rpcs/index.d.ts +1 -0
  81. package/dist/netcode/types/server/game-server.d.ts +77 -0
  82. package/dist/netcode/types/server/index.d.ts +2 -0
  83. package/dist/netcode/types/server/plugins/aoi-grid.d.ts +34 -0
  84. package/dist/netcode/types/server/plugins/index.d.ts +3 -0
  85. package/dist/netcode/types/server/plugins/lag-compensation.d.ts +34 -0
  86. package/dist/netcode/types/server/plugins/plugin.d.ts +24 -0
  87. package/dist/netcode/types/tick-rate.test.d.ts +1 -0
  88. package/dist/netcode/types/transports/index.d.ts +1 -0
  89. package/dist/netcode/types/transports/memory-transport.d.ts +51 -0
  90. package/dist/netcode/types/types.test.d.ts +1 -0
  91. package/dist/types/core/binary-codec/binary-codec.d.ts +89 -31
  92. package/dist/types/core/driver/driver.d.ts +8 -8
  93. package/dist/types/core/driver/drivers/immediate.d.ts +4 -4
  94. package/dist/types/core/driver/drivers/raf.d.ts +17 -6
  95. package/dist/types/core/driver/drivers/timeout.d.ts +4 -4
  96. package/dist/types/core/input/index.d.ts +2 -0
  97. package/dist/types/core/input/mouse-look/index.d.ts +1 -0
  98. package/dist/types/core/input/mouse-look/mouse-look.d.ts +139 -0
  99. package/dist/types/core/input/scroll-zoom/index.d.ts +1 -0
  100. package/dist/types/core/input/scroll-zoom/scroll-zoom.d.ts +38 -0
  101. package/dist/types/ecs/component.d.ts +67 -11
  102. package/dist/types/ecs/entity-handle.d.ts +5 -5
  103. package/dist/types/ecs/system-builder.d.ts +13 -0
  104. package/dist/types/ecs/world.d.ts +72 -4
  105. package/dist/types/game/loop/loop.d.ts +21 -2
  106. package/dist/types/net/adapters/bun-websocket.d.ts +19 -3
  107. package/dist/types/renderer/base/renderer-3d.d.ts +1 -1
  108. package/dist/types/renderer/prefab-bucket/concrete.d.ts +42 -2
  109. package/dist/types/renderer/prefab-bucket/index.d.ts +12 -2
  110. package/dist/types/renderer/prefab-bucket/specs.d.ts +46 -3
  111. package/dist/types/renderer/types.d.ts +5 -3
  112. package/dist/webgpu/cjs/index.js +591 -40
  113. package/dist/webgpu/esm/index.js +591 -40
  114. package/dist/webgpu/types/3d/renderer.d.ts +111 -5
  115. package/package.json +6 -1
@@ -1 +1 @@
1
- import{EventSystem as n}from"../../core/events";class o{constructor(e,t={}){this.pending=[];this.pendingIds=new Set;this.prefabs=null;this.mode=e,this.parsers=t,this.events=new n({events:["clips-changed"]})}add(e){if(this.prefabs)throw new Error("PrefabBucket: cannot add after load() \u2014 bucket is frozen");if(this.pendingIds.has(e.id))throw new Error(`PrefabBucket: duplicate id '${e.id}'`);return this.pending.push(e),this.pendingIds.add(e.id),this}addAll(e){if(this.prefabs)throw new Error("PrefabBucket: cannot add after load() \u2014 bucket is frozen");const t=new Set;for(const r of e){if(this.pendingIds.has(r.id)||t.has(r.id))throw new Error(`PrefabBucket: duplicate id '${r.id}'`);t.add(r.id)}for(const r of e)this.pending.push(r),this.pendingIds.add(r.id);return this}async load(){if(this.prefabs)return;const e={events:this.events},t=await Promise.all(this.pending.map(a=>{const s=this.parsers[a.type];if(!s)throw new Error(`PrefabBucket: no parser registered for type '${a.type}'`);return s(a,e)})),r=new Map;for(const a of t)r.set(a.id,a);this.prefabs=r,this.pending=[],this.pendingIds.clear()}get(e){if(!this.prefabs)throw new Error(`PrefabBucket: get('${e}') called before load()`);const t=this.prefabs.get(e);if(!t)throw new Error(`PrefabBucket: unknown prefab id '${e}'`);return t}get loaded(){return this.prefabs!==null}get size(){return this.prefabs?this.prefabs.size:this.pending.length}entries(){if(!this.prefabs)throw new Error("PrefabBucket: entries() called before load()");return Array.from(this.prefabs.values())}getAllByType(e){if(!this.prefabs)throw new Error(`PrefabBucket: getAllByType('${e}') called before load()`);const t=[];for(const r of this.prefabs.values())r.type===e&&t.push(r);return t}resetAnimations(){if(this.prefabs)for(const e of this.prefabs.values())e.resetAnimations?.()}}export{o as BasePrefabBucket};
1
+ import{EventSystem as n}from"../../core/events";class o{constructor(e,t={}){this.pending=[];this.pendingIds=new Set;this.prefabs=null;this.groups=new Map;this.mode=e,this.parsers=t,this.events=new n({events:["clips-changed"]})}add(e){if(e.id.includes("."))throw new Error(`PrefabBucket: id '${e.id}' is invalid - '.' is reserved for group paths`);return this.addUnchecked(e)}addUnchecked(e){if(this.prefabs)throw new Error("PrefabBucket: cannot add after load() - bucket is frozen");if(this.pendingIds.has(e.id))throw new Error(`PrefabBucket: duplicate id '${e.id}'`);return this.pending.push(e),this.pendingIds.add(e.id),this}addAll(e){if(this.prefabs)throw new Error("PrefabBucket: cannot add after load() \u2014 bucket is frozen");const t=new Set;for(const r of e){if(r.id.includes("."))throw new Error(`PrefabBucket: id '${r.id}' is invalid - '.' is reserved for group paths`);if(this.pendingIds.has(r.id)||t.has(r.id))throw new Error(`PrefabBucket: duplicate id '${r.id}'`);t.add(r.id)}for(const r of e)this.pending.push(r),this.pendingIds.add(r.id);return this}async load(){if(this.prefabs)return;const e={events:this.events},t=await Promise.all(this.pending.map(a=>{const s=this.parsers[a.type];if(!s)throw new Error(`PrefabBucket: no parser registered for type '${a.type}'`);return s(a,e)})),r=new Map;for(const a of t)r.set(a.id,a);this.prefabs=r,this.pending=[],this.pendingIds.clear()}get(e){if(!this.prefabs)throw new Error(`PrefabBucket: get('${e}') called before load()`);const t=this.prefabs.get(e);if(!t)throw new Error(`PrefabBucket: unknown prefab id '${e}'`);return t}get loaded(){return this.prefabs!==null}get size(){return this.prefabs?this.prefabs.size:this.pending.length}entries(){if(!this.prefabs)throw new Error("PrefabBucket: entries() called before load()");return Array.from(this.prefabs.values())}getAllByType(e){if(!this.prefabs)throw new Error(`PrefabBucket: getAllByType('${e}') called before load()`);const t=[];for(const r of this.prefabs.values())r.type===e&&t.push(r);return t}resetAnimations(){if(this.prefabs)for(const e of this.prefabs.values())e.resetAnimations?.()}}export{o as BasePrefabBucket};
@@ -1 +1 @@
1
- import{parseGltf as w}from"../gltf/parser";import{parseSpritesheet as y}from"../spritesheet/parser";const v={gltf:async(n,l)=>{if(n.type!=="gltf")throw new Error("gltf parser given non-gltf spec");const t=await w(n.src,{animations:n.animations!==void 0?[...n.animations]:void 0,freezeAnimations:n.freezeAnimations===!0}),c=t.primitives.filter(o=>o.skinned).length,u=t.skin?.data.jointCount??0;let g=0;for(const o of t.primitives)g+=o.positions.length/3;const i={type:"gltf",id:n.id,parsed:t,skinnedPartCount:c,jointCount:u,totalVertexCount:g,metadata:n.metadata??{}},p=n.animations!==void 0?[...n.animations]:t.skin?.animClips.map(o=>o.name)??[];if(p.length>0){const o={};for(const d of p)o[d]=d;i.animations=o,i.animationList=p}if(n.freezeAnimations!==!0){i.loadAnimations=async d=>{const a=t.skin,f=t.source;if(!a||!f)throw new Error(`loadAnimations: prefab '${n.id}' has no source \u2014 was the model skinned and not frozen?`);const m=new Set(a.animClips.map(r=>r.name)),e=[];for(const r of d){if(m.has(r))continue;const s=f.decodeAnimation(r);s&&(a.animClips.push(s),m.add(r),e.push(r))}if(e.length>0){i.animationList||(i.animationList=[]),i.animations||(i.animations={});const r=i.animationList,s=i.animations;for(const h of e)r.push(h),s[h]=h;l.events.emit("clips-changed",{prefabId:n.id,added:e,removed:[]})}},i.unloadAnimations=d=>{const a=t.skin;if(!a)return;const f=new Set(d),m=[];if(a.animClips=a.animClips.filter(e=>f.has(e.name)?(m.push(e.name),!1):!0),m.length>0){const e=i.animationList;if(e)for(let s=e.length-1;s>=0;s--)f.has(e[s])&&e.splice(s,1);const r=i.animations;if(r)for(const s of m)delete r[s];l.events.emit("clips-changed",{prefabId:n.id,added:[],removed:m})}};const o=new Set(p);i.resetAnimations=()=>{const d=t.skin;if(!d)return;const a=[];for(const f of d.animClips)o.has(f.name)||a.push(f.name);a.length>0&&i.unloadAnimations(a)}}return i},grid:n=>{if(n.type!=="grid")throw new Error("grid parser given non-grid spec");return{type:"grid",id:n.id,size:n.size,step:n.step,lineWidth:n.lineWidth,metadata:n.metadata??{}}}},k={spritesheet:async(n,l)=>{if(n.type!=="spritesheet")throw new Error("spritesheet parser given non-spritesheet spec");const t=await y({image:n.src,frameWidth:n.frameWidth,frameHeight:n.frameHeight,data:n.data});return{type:"spritesheet",id:n.id,parsed:t,frameCount:t.uvs.length,width:t.width,height:t.height,metadata:n.metadata??{}}}};export{k as parsers2d,v as parsers3d};
1
+ import{parseGltf as y}from"../gltf/parser";import{parseSpritesheet as b}from"../spritesheet/parser";const v={gltf:async(t,h)=>{if(t.type!=="gltf")throw new Error("gltf parser given non-gltf spec");const i=await y(t.src,{animations:t.animations!==void 0?[...t.animations]:void 0,freezeAnimations:t.freezeAnimations===!0}),l=i.primitives.filter(o=>o.skinned).length,u=i.skin?.data.jointCount??0;let g=0;for(const o of i.primitives)g+=o.positions.length/3;const n={type:"gltf",id:t.id,parsed:i,skinnedPartCount:l,jointCount:u,totalVertexCount:g,metadata:t.metadata??{}},p=t.animations!==void 0?[...t.animations]:i.skin?.animClips.map(o=>o.name)??[];if(p.length>0){const o={};for(const d of p)o[d]=d;n.animations=o,n.animationList=p}if(t.freezeAnimations!==!0){n.loadAnimations=async d=>{const a=i.skin,m=i.source;if(!a||!m)throw new Error(`loadAnimations: prefab '${t.id}' has no source \u2014 was the model skinned and not frozen?`);const f=new Set(a.animClips.map(r=>r.name)),e=[];for(const r of d){if(f.has(r))continue;const s=m.decodeAnimation(r);s&&(a.animClips.push(s),f.add(r),e.push(r))}if(e.length>0){n.animationList||(n.animationList=[]),n.animations||(n.animations={});const r=n.animationList,s=n.animations;for(const c of e)r.push(c),s[c]=c;h.events.emit("clips-changed",{prefabId:t.id,added:e,removed:[]})}},n.unloadAnimations=d=>{const a=i.skin;if(!a)return;const m=new Set(d),f=[];if(a.animClips=a.animClips.filter(e=>m.has(e.name)?(f.push(e.name),!1):!0),f.length>0){const e=n.animationList;if(e)for(let s=e.length-1;s>=0;s--)m.has(e[s])&&e.splice(s,1);const r=n.animations;if(r)for(const s of f)delete r[s];h.events.emit("clips-changed",{prefabId:t.id,added:[],removed:f})}};const o=new Set(p);n.resetAnimations=()=>{const d=i.skin;if(!d)return;const a=[];for(const m of d.animClips)o.has(m.name)||a.push(m.name);a.length>0&&n.unloadAnimations(a)}}return n},grid:t=>{if(t.type!=="grid")throw new Error("grid parser given non-grid spec");return{type:"grid",id:t.id,size:t.size,step:t.step,lineWidth:t.lineWidth,metadata:t.metadata??{}}},cube:t=>{if(t.type!=="cube")throw new Error("cube parser given non-cube spec");return{type:"cube",id:t.id,size:t.size??1,metadata:t.metadata??{}}},composite:t=>{if(t.type!=="composite")throw new Error("composite parser given non-composite spec");return{type:"composite",id:t.id,parts:t.parts,metadata:t.metadata??{}}}},k={spritesheet:async(t,h)=>{if(t.type!=="spritesheet")throw new Error("spritesheet parser given non-spritesheet spec");const i=await b({image:t.src,frameWidth:t.frameWidth,frameHeight:t.frameHeight,data:t.data});return{type:"spritesheet",id:t.id,parsed:i,frameCount:i.uvs.length,width:i.width,height:i.height,metadata:t.metadata??{}}}};export{k as parsers2d,v as parsers3d};