@pinkaphant/kolmo 0.4.4 → 0.4.6
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.
- package/AGENTS.md +29 -0
- package/CLAUDE.md +8 -0
- package/README.md +67 -8
- package/bin/kolmo.mjs +456 -16
- package/dist/engine/index.d.ts +2 -0
- package/dist/engine/index.js +7 -5
- package/dist/engine/kolmoActions.js +24 -9
- package/dist/engine/kolmoActions.js.map +1 -1
- package/dist/engine/kolmoActor.js +19 -31
- package/dist/engine/kolmoActor.js.map +1 -1
- package/dist/engine/kolmoActorHelpers.d.ts +24 -0
- package/dist/engine/kolmoActorHelpers.js +64 -0
- package/dist/engine/kolmoActorHelpers.js.map +1 -0
- package/dist/engine/kolmoGame.js +4 -1
- package/dist/engine/kolmoGame.js.map +1 -1
- package/dist/engine/kolmoHud.js +34 -15
- package/dist/engine/kolmoHud.js.map +1 -1
- package/dist/engine/kolmoInput.d.ts +2 -0
- package/dist/engine/kolmoInput.js +12 -12
- package/dist/engine/kolmoInput.js.map +1 -1
- package/dist/engine/kolmoLongDrive.d.ts +1 -1
- package/dist/engine/kolmoLongDrive.js +10 -8
- package/dist/engine/kolmoLongDrive.js.map +1 -1
- package/dist/engine/kolmoPilotMesh.js +189 -48
- package/dist/engine/kolmoPilotMesh.js.map +1 -1
- package/dist/engine/kolmoTouchOverlay.d.ts +21 -0
- package/dist/engine/kolmoTouchOverlay.js +326 -0
- package/dist/engine/kolmoTouchOverlay.js.map +1 -0
- package/dist/engine/kolmoTouchState.d.ts +50 -0
- package/dist/engine/kolmoTouchState.js +210 -0
- package/dist/engine/kolmoTouchState.js.map +1 -0
- package/dist/engine/kolmoVehicleConfig.d.ts +2 -0
- package/dist/engine/kolmoVehicleConfig.js +8 -4
- package/dist/engine/kolmoVehicleConfig.js.map +1 -1
- package/dist/engine/kolmoVehicleDriver.d.ts +1 -0
- package/dist/engine/kolmoVehicleDriver.js +26 -50
- package/dist/engine/kolmoVehicleDriver.js.map +1 -1
- package/dist/engine/kolmoVehicleInner.js +31 -19
- package/dist/engine/kolmoVehicleInner.js.map +1 -1
- package/dist/engine/kolmoWorld.js +6 -2
- package/dist/engine/kolmoWorld.js.map +1 -1
- package/dist/engine/longDriveKit.d.ts +6 -1
- package/dist/engine/longDriveKit.js +8 -5
- package/dist/engine/longDriveKit.js.map +1 -1
- package/dist/engine/macroCellBuilder.d.ts +10 -0
- package/dist/engine/macroCellBuilder.js +101 -18
- package/dist/engine/macroCellBuilder.js.map +1 -1
- package/dist/engine/mainlandMacroCell.js +18 -9
- package/dist/engine/mainlandMacroCell.js.map +1 -1
- package/dist/importer/DomainWorkshopPanel.d.ts +3 -3
- package/dist/importer/DomainWorkshopPanel.js +148 -44
- package/dist/importer/DomainWorkshopPanel.js.map +1 -1
- package/dist/importer/GateHudBar.d.ts +2 -0
- package/dist/importer/GateHudBar.js +113 -35
- package/dist/importer/GateHudBar.js.map +1 -1
- package/dist/importer/GlbImportGate.js +16 -3
- package/dist/importer/GlbImportGate.js.map +1 -1
- package/dist/importer/LiveDrivePads.js +5 -3
- package/dist/importer/LiveDrivePads.js.map +1 -1
- package/dist/importer/Step1CalibrationPlinth.js +2 -2
- package/dist/importer/WheelRingHandles3D.js +2 -1
- package/dist/importer/WheelRingHandles3D.js.map +1 -1
- package/dist/importer/chopShopActions.js +20 -16
- package/dist/importer/chopShopActions.js.map +1 -1
- package/dist/importer/chopShopHandlers.js +16 -9
- package/dist/importer/chopShopHandlers.js.map +1 -1
- package/dist/importer/chopShopIoActions.d.ts +2 -0
- package/dist/importer/chopShopIoActions.js +33 -2
- package/dist/importer/chopShopIoActions.js.map +1 -1
- package/dist/importer/cylinderBooleanSlice.js.map +1 -1
- package/dist/importer/fusedWheelDetect.d.ts +2 -2
- package/dist/importer/fusedWheelDetect.js +227 -106
- package/dist/importer/fusedWheelDetect.js.map +1 -1
- package/dist/importer/fusedWheelFit.d.ts +6 -0
- package/dist/importer/fusedWheelFit.js +82 -1
- package/dist/importer/fusedWheelFit.js.map +1 -1
- package/dist/importer/gateStore.d.ts +2 -2
- package/dist/importer/gateStore.js +4 -3
- package/dist/importer/gateStore.js.map +1 -1
- package/dist/importer/glbNormalizer.js +5 -0
- package/dist/importer/glbNormalizer.js.map +1 -1
- package/dist/importer/importerWebMcpTools.js +3 -2
- package/dist/importer/importerWebMcpTools.js.map +1 -1
- package/dist/importer/index.d.ts +4 -2
- package/dist/importer/index.js +7 -3
- package/dist/importer/khrCarGeometryMass.d.ts +20 -0
- package/dist/importer/khrCarGeometryMass.js +125 -0
- package/dist/importer/khrCarGeometryMass.js.map +1 -0
- package/dist/importer/khrCarPlanHelpers.js +12 -22
- package/dist/importer/khrCarPlanHelpers.js.map +1 -1
- package/dist/importer/khrCarPlanner.js +52 -85
- package/dist/importer/khrCarPlanner.js.map +1 -1
- package/dist/importer/proceduralC12AndCraft.d.ts +18 -0
- package/dist/importer/proceduralC12AndCraft.js +302 -0
- package/dist/importer/proceduralC12AndCraft.js.map +1 -0
- package/dist/importer/proceduralDomainBuilders.d.ts +10 -0
- package/dist/importer/proceduralDomainBuilders.js +346 -0
- package/dist/importer/proceduralDomainBuilders.js.map +1 -0
- package/dist/importer/proceduralPersonAndProp.d.ts +8 -0
- package/dist/importer/proceduralPersonAndProp.js +303 -0
- package/dist/importer/proceduralPersonAndProp.js.map +1 -0
- package/dist/importer/starterScene.d.ts +3 -1
- package/dist/importer/starterScene.js +69 -13
- package/dist/importer/starterScene.js.map +1 -1
- package/dist/importer/universalGateBake.js +43 -11
- package/dist/importer/universalGateBake.js.map +1 -1
- package/dist/importer/useChopShopController.d.ts +3 -1
- package/dist/importer/useChopShopController.js +33 -18
- package/dist/importer/useChopShopController.js.map +1 -1
- package/dist/importer/useChopShopState.d.ts +1 -1
- package/dist/importer/useChopShopState.js +35 -9
- package/dist/importer/useChopShopState.js.map +1 -1
- package/dist/importer/wheelCutterHelpers.d.ts +7 -4
- package/dist/importer/wheelCutterHelpers.js +58 -28
- package/dist/importer/wheelCutterHelpers.js.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.js +20 -7
- package/dist/junk/DestructibleTarget.js +9 -3
- package/dist/junk/DestructibleTarget.js.map +1 -1
- package/dist/junk/ShardPieces.js +10 -2
- package/dist/junk/ShardPieces.js.map +1 -1
- package/dist/junk/index.d.ts +1 -0
- package/dist/junk/index.js +2 -1
- package/dist/junk/junkProceduralScenes.d.ts +12 -0
- package/dist/junk/junkProceduralScenes.js +220 -0
- package/dist/junk/junkProceduralScenes.js.map +1 -0
- package/dist/sand3d/KolmoSand3D.d.ts +19 -0
- package/dist/sand3d/KolmoSand3D.js +92 -0
- package/dist/sand3d/KolmoSand3D.js.map +1 -0
- package/dist/sand3d/Sand3dWorkshopSection.d.ts +8 -0
- package/dist/sand3d/Sand3dWorkshopSection.js +117 -0
- package/dist/sand3d/Sand3dWorkshopSection.js.map +1 -0
- package/dist/sand3d/gateBakeHelpers.d.ts +21 -0
- package/dist/sand3d/gateBakeHelpers.js +225 -0
- package/dist/sand3d/gateBakeHelpers.js.map +1 -0
- package/dist/sand3d/gateDoorwayBake.d.ts +12 -0
- package/dist/sand3d/gateDoorwayBake.js +203 -0
- package/dist/sand3d/gateDoorwayBake.js.map +1 -0
- package/dist/sand3d/index.d.ts +3 -0
- package/dist/sand3d/index.js +4 -0
- package/dist/sand3d/index.js.map +1 -0
- package/dist/sand3d/sand3dAssetLoader.d.ts +28 -0
- package/dist/sand3d/sand3dAssetLoader.js +177 -0
- package/dist/sand3d/sand3dAssetLoader.js.map +1 -0
- package/dist/suika/KolmoSuikaOrb.d.ts +33 -0
- package/dist/suika/KolmoSuikaOrb.js +375 -0
- package/dist/suika/KolmoSuikaOrb.js.map +1 -0
- package/dist/suika/index.d.ts +4 -0
- package/dist/suika/index.js +5 -0
- package/dist/suika/index.js.map +1 -0
- package/dist/suika/suikaArbiter.d.ts +60 -0
- package/dist/suika/suikaArbiter.js +265 -0
- package/dist/suika/suikaArbiter.js.map +1 -0
- package/dist/suika/suikaGeometry.d.ts +10 -0
- package/dist/suika/suikaGeometry.js +251 -0
- package/dist/suika/suikaGeometry.js.map +1 -0
- package/dist/suika/suikaTypes.d.ts +74 -0
- package/dist/suika/suikaTypes.js +196 -0
- package/dist/suika/suikaTypes.js.map +1 -0
- package/dist/world/index.d.ts +1 -1
- package/dist/world/index.js +2 -2
- package/dist/world/worldTypes.d.ts +4 -0
- package/dist/world/worldTypes.js +21 -1
- package/dist/world/worldTypes.js.map +1 -1
- package/docs/api-reference.md +82 -125
- package/package.json +22 -11
- package/skills/kolmo-engine/SKILL.md +111 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: kolmo-engine
|
|
3
|
+
description: Build, extend, calibrate, and network 3D games on @pinkaphant/kolmo (Kolmogorov Game Engine) using declarative R3F entities (<Game>, <Vehicle>, <Actor>, <Island>, <LongDrive>, <Sand3D>, <Junk>, <SuikaSystem>), Koota SoA ECS, @khr3/* physics/C12 packages, WebMCP asset tools, and PartyServer + PartySocket Cloudflare Durable Object co-op rooms.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Kolmo Game Engine Skill (`@pinkaphant/kolmo`)
|
|
7
|
+
|
|
8
|
+
Use this skill whenever building or extending a game, vehicle, C12 world, `.glb`/`.usd`/`.sand3d` asset pipeline, WebMCP integration, or 1–8 player co-op room with `@pinkaphant/kolmo`.
|
|
9
|
+
|
|
10
|
+
## 1. Quick Scaffold & Pinned `package.json`
|
|
11
|
+
|
|
12
|
+
Scaffold a fresh project in one command:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npx @pinkaphant/kolmo create my-game --template game # game | longline | dust | garage
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Keep physics and Three.js singletons pinned in `package.json` and `vite.config.ts`:
|
|
19
|
+
|
|
20
|
+
```json
|
|
21
|
+
{
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@dimforge/rapier3d-compat": "0.19.2",
|
|
24
|
+
"@pinkaphant/ecctrl": "2.0.4-beta.4",
|
|
25
|
+
"@pinkaphant/kolmo": "^0.4.5",
|
|
26
|
+
"koota": "^0.6.6",
|
|
27
|
+
"three": "0.184.0"
|
|
28
|
+
},
|
|
29
|
+
"overrides": {
|
|
30
|
+
"@dimforge/rapier3d-compat": "0.19.2",
|
|
31
|
+
"@pinkaphant/ecctrl": "2.0.4-beta.4",
|
|
32
|
+
"three": "0.184.0"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
import react from "@vitejs/plugin-react";
|
|
39
|
+
import { defineConfig } from "vite";
|
|
40
|
+
import { KOLMO_ROLLDOWN_BUILD, KOLMO_SINGLETON_DEDUPE, externalizeRapierWasm } from "@pinkaphant/kolmo/vite";
|
|
41
|
+
|
|
42
|
+
export default defineConfig({
|
|
43
|
+
plugins: [react(), externalizeRapierWasm()],
|
|
44
|
+
resolve: { dedupe: KOLMO_SINGLETON_DEDUPE },
|
|
45
|
+
build: KOLMO_ROLLDOWN_BUILD,
|
|
46
|
+
});
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## 2. Declarative Entities That Take Care of Everything
|
|
50
|
+
|
|
51
|
+
Mount self-contained entities inside `<Game>`:
|
|
52
|
+
|
|
53
|
+
```tsx
|
|
54
|
+
import { Actor, Game, Hud, Island, Junk, MobileTouchOverlay, Sand3D, SuikaSystem, Vehicle } from "@pinkaphant/kolmo";
|
|
55
|
+
|
|
56
|
+
export function App() {
|
|
57
|
+
return (
|
|
58
|
+
<Game retro="dreamcast" skybox="day">
|
|
59
|
+
<Island seed={77} size={960} settlementTier="town" />
|
|
60
|
+
{/* Drop any raw or KHR-rigged .glb URL/bytes — Kolmo auto-scales SI meters, cores wheels, and solves SI corner-load suspension! */}
|
|
61
|
+
<Vehicle src="/cars/rally_coupe.glb" horsepower={320} piloted />
|
|
62
|
+
<Sand3D recipe="hinged_ammo_chest" position={[4.5, 1.2, 6]} />
|
|
63
|
+
<Junk id="crate_01" position={[-4.5, 1.2, 6]} />
|
|
64
|
+
<SuikaSystem />
|
|
65
|
+
<Actor />
|
|
66
|
+
<Hud />
|
|
67
|
+
<MobileTouchOverlay />
|
|
68
|
+
</Game>
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
- **`<Vehicle>`**: Accepts `preset` (`PAPER_SHELL_PRESETS`), `src` (URL), `rawGlbBytes`, or `bundle`. Uncalibrated 1-mesh car `.glb` files are automatically normalized to SI meters (`+Y` up, `+Z` forward, `[1, 1, 1]` scale), wheel-cored, and tuned with Pacejka curves + SI corner-load suspension (`solveWheelLoads` on `@pinkaphant/ecctrl@2.0.4-beta.4`) via `loadOrAutoCompileVehicleGlb`.
|
|
74
|
+
- **`<Sand3D>`**: Compiles `.sand3d` Code-CAD scripts, `SAND3D_RECIPES`, OpenUSD, or `.glb` files and mounts `<KolmoVehicle>` (if wheels/propellers exist) or `<KolmoProp>` (for articulated KHR joints).
|
|
75
|
+
- **`<Actor>` + `<Hud>` + `<MobileTouchOverlay />`**: Provides `Ecctrl` character movement, `[F]` vehicle boarding/exiting (`PilotLink`), 60 Hz DOM-ref HUD telemetry, and `0.08`-deadzone mobile landscape controls.
|
|
76
|
+
|
|
77
|
+
## 3. Imperative R3F + Koota SoA ECS Pattern
|
|
78
|
+
|
|
79
|
+
- **Mutate via `useRef` + `useFrame`**: Reuse module-level `THREE.Vector3` / `Quaternion` / `Matrix4` objects inside `useFrame((_, delta) => ...)`. Read `rapierWorld.timestep` when syncing with Rapier.
|
|
80
|
+
- **Koota SoA Fast Path**: Write continuous entity kinematics directly into Koota's typed arrays with `{ changeDetection: "never" }` or `writeEntityKinematics`:
|
|
81
|
+
|
|
82
|
+
```ts
|
|
83
|
+
import { PositionTrait, VelocityTrait } from "./traits";
|
|
84
|
+
|
|
85
|
+
world.query(PositionTrait, VelocityTrait).updateEach(
|
|
86
|
+
([pos, vel]) => {
|
|
87
|
+
pos.x += vel.vx * dt;
|
|
88
|
+
pos.y += vel.vy * dt;
|
|
89
|
+
pos.z += vel.vz * dt;
|
|
90
|
+
},
|
|
91
|
+
{ changeDetection: "never" },
|
|
92
|
+
);
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
- **Exact 3.0 m C12 Instancing**: Place modular walls, floors, foundations, doorways, and roofs using `@khr3/c12` (`yaw12` `0..11` `30°` steps in `Z[1/2, sqrt(3)]`) and batch into single draw calls with `instanceBatches(pieces)`.
|
|
96
|
+
|
|
97
|
+
## 4. Shared Human + AI Agency via WebMCP (`@pinkaphant/kolmo/importer`)
|
|
98
|
+
|
|
99
|
+
When `<GlbImportGate enableWebMcp />` is mounted, browser agents access `navigator.modelContext` (or invoke `createImporterWebMcpTools` directly in tests/automation):
|
|
100
|
+
|
|
101
|
+
1. `importer_state` / `importer_capture_view` — Inspect bounds, wheel count, calibration lock, and viewport PNG.
|
|
102
|
+
2. `importer_list_models` / `importer_load` — Browse catalog or load any `.glb` URL / vault key.
|
|
103
|
+
3. `importer_set_kind` / `importer_orient` / `importer_scale` — Choose domain (`vehicle | c12 | launcher | person | prop | junk | suika`), rotate in exact 90° turns, and normalize to SI meters (`Y = 0` ground contact).
|
|
104
|
+
4. `importer_pop_wheels` / `importer_cut_part` / `importer_set_points` — Detect axles, peel hinged doors/hoods/trunks, and stamp `seat`, `muzzle`, `grip_primary`, or `thruster` sockets.
|
|
105
|
+
5. `importer_export` — Bake compliant `KHR_physics_rigid_bodies` `.glb` bytes or spawn straight into the live `<Game>` world (`{ spawnInWorld: true }`).
|
|
106
|
+
|
|
107
|
+
## 5. Co-op Room Multiplayer (1–8 Players, Hibernating Cloudflare DO)
|
|
108
|
+
|
|
109
|
+
For Valheim/Grounded-style peer-simulated co-op rooms by room code:
|
|
110
|
+
- **Server (`partyserver`)**: Subclass `Server` with `static options = { hibernate: true }`, assign a server-generated connection ID on upgrade, persist compact per-peer state (`pos`, `quat`, `vehicleId`, `callsign`, C12/world deltas `<= 2 KB`) via `conn.serializeAttachment(...)` / `conn.setState(...)`, rehydrate open sockets on wake via `deserializeAttachment()`, and broadcast room events to the 1–8 peers.
|
|
111
|
+
- **Client (`partysocket` + Koota)**: Connect by room code (`room: code`), throttle outbound local Koota `TransformTrait` / `PilotLink` snapshots to `15–20 Hz`, and interpolate remote peer entities in `useFrame` with `1 - Math.exp(-12 * dt)` damping.
|