@vib3code/sdk 2.0.1 → 2.0.3-canary.0a63e71
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/CHANGELOG.md +36 -0
- package/DOCS/AGENT_HARNESS_ARCHITECTURE.md +245 -0
- package/DOCS/ANDROID_DEPLOYMENT.md +59 -0
- package/DOCS/ARCHITECTURE.md +1 -0
- package/DOCS/CI_TESTING.md +2 -0
- package/DOCS/CLI_ONBOARDING.md +3 -1
- package/DOCS/CONTROL_REFERENCE.md +2 -0
- package/DOCS/CROSS_SITE_DESIGN_PATTERNS.md +119 -0
- package/DOCS/ENV_SETUP.md +2 -0
- package/DOCS/EPIC_SCROLL_EVENTS.md +775 -0
- package/DOCS/EXPANSION_DESIGN.md +979 -0
- package/DOCS/EXPANSION_DESIGN_ULTRA.md +389 -0
- package/DOCS/EXPORT_FORMATS.md +2 -0
- package/DOCS/GPU_DISPOSAL_GUIDE.md +2 -0
- package/DOCS/HANDOFF_LANDING_PAGE.md +156 -0
- package/DOCS/HANDOFF_SDK_DEVELOPMENT.md +495 -0
- package/DOCS/LICENSING_TIERS.md +2 -0
- package/DOCS/MASTER_PLAN_2026-01-31.md +4 -2
- package/DOCS/MULTIVIZ_CHOREOGRAPHY_PATTERNS.md +939 -0
- package/DOCS/OBS_SETUP_GUIDE.md +2 -0
- package/DOCS/OPTIMIZATION_PLAN_MATH.md +119 -0
- package/DOCS/PRODUCT_STRATEGY.md +65 -0
- package/DOCS/PROJECT_SETUP.md +2 -0
- package/DOCS/README.md +105 -0
- package/DOCS/REFERENCE_SCROLL_ANALYSIS.md +99 -0
- package/DOCS/RENDERER_LIFECYCLE.md +2 -0
- package/DOCS/REPO_MANIFEST.md +2 -0
- package/DOCS/ROADMAP.md +113 -0
- package/DOCS/SCROLL_TIMELINE_v3.md +271 -0
- package/DOCS/SITE_REFACTOR_PLAN.md +102 -0
- package/DOCS/STATUS.md +26 -0
- package/DOCS/SYSTEM_INVENTORY.md +37 -32
- package/DOCS/TELEMETRY_EXPORTS.md +2 -0
- package/DOCS/VISUAL_ANALYSIS_CLICKERSS.md +87 -0
- package/DOCS/VISUAL_ANALYSIS_FACETAD.md +135 -0
- package/DOCS/VISUAL_ANALYSIS_SIMONE.md +97 -0
- package/DOCS/VISUAL_ANALYSIS_TABLESIDE.md +88 -0
- package/DOCS/WEBGPU_STATUS.md +121 -38
- package/DOCS/XR_BENCHMARKS.md +2 -0
- package/DOCS/archive/BLUEPRINT_EXECUTION_PLAN_2026-01-07.md +1 -0
- package/DOCS/archive/DEV_TRACK_ANALYSIS.md +1 -0
- package/DOCS/archive/DEV_TRACK_PLAN_2026-01-07.md +1 -0
- package/DOCS/archive/SESSION_014_PLAN.md +1 -0
- package/DOCS/archive/SESSION_LOG_2026-01-07.md +1 -0
- package/DOCS/archive/STRATEGIC_BLUEPRINT_2026-01-07.md +1 -0
- package/DOCS/archive/SYSTEM_AUDIT_2026-01-30.md +1 -0
- package/DOCS/archive/WEBGPU_STATUS_2026-02-15_STALE.md +1 -0
- package/DOCS/{DEV_TRACK_SESSION_2026-01-31.md → dev-tracks/DEV_TRACK_SESSION_2026-01-31.md} +3 -1
- package/DOCS/dev-tracks/DEV_TRACK_SESSION_2026-02-06.md +233 -0
- package/DOCS/dev-tracks/DEV_TRACK_SESSION_2026-02-13.md +129 -0
- package/DOCS/dev-tracks/DEV_TRACK_SESSION_2026-02-15.md +144 -0
- package/DOCS/dev-tracks/DEV_TRACK_SESSION_2026-02-16.md +110 -0
- package/DOCS/dev-tracks/PERF_UPGRADE_2026-02-16.md +310 -0
- package/DOCS/dev-tracks/README.md +12 -0
- package/README.md +26 -13
- package/cpp/CMakeLists.txt +236 -0
- package/cpp/bindings/embind.cpp +269 -0
- package/cpp/build.sh +129 -0
- package/cpp/geometry/Crystal.cpp +103 -0
- package/cpp/geometry/Fractal.cpp +136 -0
- package/cpp/geometry/GeometryGenerator.cpp +262 -0
- package/cpp/geometry/KleinBottle.cpp +71 -0
- package/cpp/geometry/Sphere.cpp +134 -0
- package/cpp/geometry/Tesseract.cpp +94 -0
- package/cpp/geometry/Tetrahedron.cpp +83 -0
- package/cpp/geometry/Torus.cpp +65 -0
- package/cpp/geometry/WarpFunctions.cpp +238 -0
- package/cpp/geometry/Wave.cpp +85 -0
- package/cpp/include/vib3_ffi.h +238 -0
- package/cpp/math/Mat4x4.cpp +409 -0
- package/cpp/math/Mat4x4.hpp +209 -0
- package/cpp/math/Projection.cpp +142 -0
- package/cpp/math/Projection.hpp +148 -0
- package/cpp/math/Rotor4D.cpp +322 -0
- package/cpp/math/Rotor4D.hpp +204 -0
- package/cpp/math/Vec4.cpp +303 -0
- package/cpp/math/Vec4.hpp +225 -0
- package/cpp/src/vib3_ffi.cpp +607 -0
- package/cpp/tests/Geometry_test.cpp +213 -0
- package/cpp/tests/Mat4x4_test.cpp +494 -0
- package/cpp/tests/Projection_test.cpp +298 -0
- package/cpp/tests/Rotor4D_test.cpp +423 -0
- package/cpp/tests/Vec4_test.cpp +489 -0
- package/docs/webgpu-live.html +1 -1
- package/package.json +41 -30
- package/src/agent/index.js +1 -3
- package/src/agent/mcp/MCPServer.js +1220 -144
- package/src/agent/mcp/index.js +1 -1
- package/src/agent/mcp/stdio-server.js +264 -0
- package/src/agent/mcp/tools.js +498 -31
- package/src/cli/index.js +431 -47
- package/src/core/CanvasManager.js +97 -204
- package/src/core/ErrorReporter.js +1 -1
- package/src/core/Parameters.js +1 -1
- package/src/core/VIB3Engine.js +93 -4
- package/src/core/VitalitySystem.js +53 -0
- package/src/core/index.js +18 -0
- package/src/core/renderers/FacetedRendererAdapter.js +10 -9
- package/src/core/renderers/HolographicRendererAdapter.js +13 -9
- package/src/core/renderers/QuantumRendererAdapter.js +11 -7
- package/src/creative/AestheticMapper.js +628 -0
- package/src/creative/ChoreographyPlayer.js +481 -0
- package/src/creative/index.js +11 -0
- package/src/experimental/GameLoop.js +72 -0
- package/src/experimental/LatticePhysics.js +100 -0
- package/src/experimental/LiveDirector.js +143 -0
- package/src/experimental/PlayerController4D.js +154 -0
- package/src/experimental/VIB3Actor.js +138 -0
- package/src/experimental/VIB3Compositor.js +117 -0
- package/src/experimental/VIB3Link.js +122 -0
- package/src/experimental/VIB3Orchestrator.js +146 -0
- package/src/experimental/VIB3Universe.js +109 -0
- package/src/experimental/demos/CrystalLabyrinth.js +202 -0
- package/src/export/TradingCardManager.js +3 -4
- package/src/export/index.js +11 -1
- package/src/faceted/FacetedSystem.js +260 -394
- package/src/games/glyph-war/GlyphWarVisualizer.js +641 -0
- package/src/geometry/generators/Crystal.js +2 -2
- package/src/geometry/warp/HypersphereCore.js +53 -24
- package/src/holograms/HolographicVisualizer.js +84 -98
- package/src/holograms/RealHolographicSystem.js +194 -43
- package/src/math/Mat4x4.js +308 -105
- package/src/math/Rotor4D.js +124 -40
- package/src/math/Vec4.js +200 -103
- package/src/math/index.js +7 -7
- package/src/polychora/PolychoraSystem.js +77 -0
- package/src/quantum/QuantumEngine.js +103 -66
- package/src/quantum/QuantumVisualizer.js +31 -22
- package/src/reactivity/index.js +3 -5
- package/src/render/LayerPresetManager.js +372 -0
- package/src/render/LayerReactivityBridge.js +344 -0
- package/src/render/LayerRelationshipGraph.js +610 -0
- package/src/render/MultiCanvasBridge.js +148 -25
- package/src/render/ShaderLoader.js +38 -0
- package/src/render/ShaderProgram.js +4 -4
- package/src/render/UnifiedRenderBridge.js +4 -1
- package/src/render/backends/WebGPUBackend.js +8 -4
- package/src/render/index.js +27 -2
- package/src/scene/Node4D.js +74 -24
- package/src/scene/index.js +4 -4
- package/src/shaders/common/geometry24.glsl +65 -0
- package/src/shaders/common/geometry24.wgsl +54 -0
- package/src/shaders/common/rotation4d.glsl +4 -4
- package/src/shaders/common/rotation4d.wgsl +2 -2
- package/src/shaders/common/uniforms.wgsl +15 -8
- package/src/shaders/faceted/faceted.frag.glsl +220 -80
- package/src/shaders/faceted/faceted.frag.wgsl +144 -90
- package/src/shaders/holographic/holographic.frag.glsl +28 -9
- package/src/shaders/holographic/holographic.frag.wgsl +112 -41
- package/src/shaders/quantum/quantum.frag.glsl +1 -0
- package/src/shaders/quantum/quantum.frag.wgsl +6 -4
- package/src/testing/ParallelTestFramework.js +2 -2
- package/src/ui/adaptive/renderers/webgpu/WebGPURenderer.ts +2 -2
- package/src/viewer/GalleryUI.js +17 -0
- package/src/viewer/ViewerPortal.js +2 -2
- package/src/viewer/index.js +1 -1
- package/tools/headless-renderer.js +258 -0
- package/tools/shader-sync-verify.js +14 -8
- package/tools/site-analysis/all-reports.json +32 -0
- package/tools/site-analysis/combined-analysis.md +50 -0
- package/tools/site-analyzer.mjs +779 -0
- package/tools/visual-catalog/capture.js +276 -0
- package/tools/visual-catalog/composite.js +138 -0
- package/types/adaptive-sdk.d.ts +204 -5
- package/types/agent/cli.d.ts +78 -0
- package/types/agent/index.d.ts +18 -0
- package/types/agent/mcp.d.ts +87 -0
- package/types/agent/telemetry.d.ts +190 -0
- package/types/core/VIB3Engine.d.ts +26 -0
- package/types/core/index.d.ts +261 -0
- package/types/creative/AestheticMapper.d.ts +72 -0
- package/types/creative/ChoreographyPlayer.d.ts +96 -0
- package/types/creative/index.d.ts +17 -0
- package/types/export/index.d.ts +243 -0
- package/types/geometry/index.d.ts +164 -0
- package/types/math/index.d.ts +214 -0
- package/types/render/LayerPresetManager.d.ts +78 -0
- package/types/render/LayerReactivityBridge.d.ts +85 -0
- package/types/render/LayerRelationshipGraph.d.ts +174 -0
- package/types/render/index.d.ts +3 -0
- package/types/scene/index.d.ts +204 -0
- package/types/systems/index.d.ts +244 -0
- package/types/variations/index.d.ts +62 -0
- package/types/viewer/index.d.ts +225 -0
- package/DOCS/BLUEPRINT_EXECUTION_PLAN_2026-01-07.md +0 -34
- package/DOCS/DEV_TRACK_ANALYSIS.md +0 -77
- package/DOCS/DEV_TRACK_PLAN_2026-01-07.md +0 -42
- package/DOCS/SESSION_014_PLAN.md +0 -195
- package/DOCS/SESSION_LOG_2026-01-07.md +0 -56
- package/DOCS/STRATEGIC_BLUEPRINT_2026-01-07.md +0 -72
- package/DOCS/SYSTEM_AUDIT_2026-01-30.md +0 -738
- /package/src/viewer/{ReactivityManager.js → ViewerInputHandler.js} +0 -0
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* VIB3Orchestrator - The Core of the VIB3 Universe
|
|
3
|
+
*
|
|
4
|
+
* Manages the lifecycle and coordination of multiple VIB3+ entities (visualizers).
|
|
5
|
+
* Implements the "Universe" concept where multiple instances share a clock,
|
|
6
|
+
* physics, and event bus.
|
|
7
|
+
*
|
|
8
|
+
* @experimental
|
|
9
|
+
*/
|
|
10
|
+
export class VIB3Orchestrator {
|
|
11
|
+
constructor() {
|
|
12
|
+
this.entities = new Map(); // id -> Entity
|
|
13
|
+
this.nextEntityId = 1;
|
|
14
|
+
|
|
15
|
+
// Master Clock
|
|
16
|
+
this.time = 0;
|
|
17
|
+
this.lastFrameTime = 0;
|
|
18
|
+
this.paused = false;
|
|
19
|
+
|
|
20
|
+
// Systems
|
|
21
|
+
this.eventBus = new EventTarget();
|
|
22
|
+
|
|
23
|
+
// Bind loop
|
|
24
|
+
this.tick = this.tick.bind(this);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Start the universe simulation loop.
|
|
29
|
+
*/
|
|
30
|
+
start() {
|
|
31
|
+
if (this.running) return;
|
|
32
|
+
this.running = true;
|
|
33
|
+
this.lastFrameTime = performance.now();
|
|
34
|
+
requestAnimationFrame(this.tick);
|
|
35
|
+
console.log('VIB3Orchestrator: Universe started.');
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Stop the universe simulation loop.
|
|
40
|
+
*/
|
|
41
|
+
stop() {
|
|
42
|
+
this.running = false;
|
|
43
|
+
console.log('VIB3Orchestrator: Universe stopped.');
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Spawn a new VIB3 entity.
|
|
48
|
+
* @param {string} type - 'actor', 'prop', 'environment'
|
|
49
|
+
* @param {object} config - Configuration for the entity
|
|
50
|
+
* @returns {string} Entity ID
|
|
51
|
+
*/
|
|
52
|
+
spawn(type, config = {}) {
|
|
53
|
+
const id = `vib3_entity_${this.nextEntityId++}`;
|
|
54
|
+
|
|
55
|
+
// In a real implementation, this would instantiate VIB3Actor or VIB3Prop
|
|
56
|
+
// For now, we store a mock object representing the entity state
|
|
57
|
+
const entity = {
|
|
58
|
+
id,
|
|
59
|
+
type,
|
|
60
|
+
config,
|
|
61
|
+
position: config.position || { x: 0, y: 0, z: 0 },
|
|
62
|
+
rotation: config.rotation || { x: 0, y: 0, z: 0, w: 0 }, // 4D rotation
|
|
63
|
+
active: true,
|
|
64
|
+
|
|
65
|
+
// Mock VIB3Engine interface
|
|
66
|
+
engine: {
|
|
67
|
+
setParameter: (k, v) => console.log(`[${id}] set ${k}=${v}`),
|
|
68
|
+
getParameter: (k) => 0
|
|
69
|
+
},
|
|
70
|
+
|
|
71
|
+
update: (dt) => {
|
|
72
|
+
// Default update logic
|
|
73
|
+
// e.g., apply basic physics or script behavior
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
this.entities.set(id, entity);
|
|
78
|
+
this.emit('entitySpawned', { id, type });
|
|
79
|
+
console.log(`VIB3Orchestrator: Spawned ${type} (${id})`);
|
|
80
|
+
|
|
81
|
+
return id;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Remove an entity from the universe.
|
|
86
|
+
* @param {string} id
|
|
87
|
+
*/
|
|
88
|
+
kill(id) {
|
|
89
|
+
if (this.entities.has(id)) {
|
|
90
|
+
const entity = this.entities.get(id);
|
|
91
|
+
// Cleanup logic (e.g., destroy VIB3Engine instance)
|
|
92
|
+
if (entity.destroy) entity.destroy();
|
|
93
|
+
|
|
94
|
+
this.entities.delete(id);
|
|
95
|
+
this.emit('entityDespawned', { id });
|
|
96
|
+
console.log(`VIB3Orchestrator: Killed entity ${id}`);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* The main simulation loop.
|
|
102
|
+
* Prioritizes Physics -> Narrative -> Visuals.
|
|
103
|
+
* @param {number} timestamp
|
|
104
|
+
*/
|
|
105
|
+
tick(timestamp) {
|
|
106
|
+
if (!this.running) return;
|
|
107
|
+
|
|
108
|
+
const dt = (timestamp - this.lastFrameTime) / 1000;
|
|
109
|
+
this.lastFrameTime = timestamp;
|
|
110
|
+
this.time += dt;
|
|
111
|
+
|
|
112
|
+
// 1. Physics / Logic Update
|
|
113
|
+
this.entities.forEach(entity => {
|
|
114
|
+
if (entity.active && entity.update) {
|
|
115
|
+
entity.update(this.time, dt);
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
// 2. Event Processing (Mock)
|
|
120
|
+
// Check for collisions, triggers, etc.
|
|
121
|
+
|
|
122
|
+
// 3. Visual Sync (Mock)
|
|
123
|
+
// Ensure all entities are rendering the current frame
|
|
124
|
+
|
|
125
|
+
requestAnimationFrame(this.tick);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Emit a global universe event.
|
|
130
|
+
* @param {string} name
|
|
131
|
+
* @param {object} detail
|
|
132
|
+
*/
|
|
133
|
+
emit(name, detail) {
|
|
134
|
+
const event = new CustomEvent(name, { detail });
|
|
135
|
+
this.eventBus.dispatchEvent(event);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Listen for global universe events.
|
|
140
|
+
* @param {string} name
|
|
141
|
+
* @param {function} callback
|
|
142
|
+
*/
|
|
143
|
+
on(name, callback) {
|
|
144
|
+
this.eventBus.addEventListener(name, (e) => callback(e.detail));
|
|
145
|
+
}
|
|
146
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* VIB3Universe - High-Level Entry Point for VIB3+ Ultra
|
|
3
|
+
*
|
|
4
|
+
* Combines Orchestrator (Logic) and Compositor (Visuals) into a single API.
|
|
5
|
+
* Manages the "World" where multiple VIB3+ instances coexist.
|
|
6
|
+
*
|
|
7
|
+
* @experimental
|
|
8
|
+
*/
|
|
9
|
+
import { VIB3Orchestrator } from './VIB3Orchestrator.js';
|
|
10
|
+
import { VIB3Compositor } from './VIB3Compositor.js';
|
|
11
|
+
import { VIB3Actor } from './VIB3Actor.js';
|
|
12
|
+
import { VIB3Engine } from '../core/VIB3Engine.js';
|
|
13
|
+
|
|
14
|
+
export class VIB3Universe {
|
|
15
|
+
/**
|
|
16
|
+
* @param {string} containerId - DOM ID for the universe container
|
|
17
|
+
*/
|
|
18
|
+
constructor(containerId = 'vib3-universe') {
|
|
19
|
+
this.orchestrator = new VIB3Orchestrator();
|
|
20
|
+
this.compositor = new VIB3Compositor(containerId);
|
|
21
|
+
this.actors = new Map(); // id -> VIB3Actor
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Start the universe simulation.
|
|
26
|
+
*/
|
|
27
|
+
start() {
|
|
28
|
+
this.orchestrator.start();
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Stop the universe simulation.
|
|
33
|
+
*/
|
|
34
|
+
stop() {
|
|
35
|
+
this.orchestrator.stop();
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Spawn a new actor into the universe.
|
|
40
|
+
* @param {object} config
|
|
41
|
+
* @param {string} config.personality - Actor personality profile
|
|
42
|
+
* @param {string} config.system - Visualization system ('quantum', 'faceted', 'holographic')
|
|
43
|
+
* @param {number} config.geometry - Initial geometry index
|
|
44
|
+
* @param {object} config.layer - Layer options { zIndex, blendMode, opacity, position }
|
|
45
|
+
* @returns {Promise<VIB3Actor>} The spawned actor
|
|
46
|
+
*/
|
|
47
|
+
async spawnActor(config = {}) {
|
|
48
|
+
const actorId = `actor_${Date.now()}_${Math.floor(Math.random() * 1000)}`;
|
|
49
|
+
|
|
50
|
+
// 1. Create a container for this actor's engine
|
|
51
|
+
const container = document.createElement('div');
|
|
52
|
+
container.id = `container_${actorId}`;
|
|
53
|
+
container.style.width = '100%';
|
|
54
|
+
container.style.height = '100%';
|
|
55
|
+
container.style.pointerEvents = 'none'; // Default to pass-through events
|
|
56
|
+
|
|
57
|
+
// 2. Add to compositor (visual layer)
|
|
58
|
+
this.compositor.addInstance(actorId, container, config.layer || {});
|
|
59
|
+
|
|
60
|
+
// 3. Initialize VIB3 Engine
|
|
61
|
+
const engine = new VIB3Engine({
|
|
62
|
+
system: config.system || 'holographic',
|
|
63
|
+
preferWebGPU: true // Ultra tier defaults to high perf
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
// Initialize engine within the container
|
|
67
|
+
// Note: VIB3Engine.initialize expects a container ID
|
|
68
|
+
await engine.initialize(container.id);
|
|
69
|
+
|
|
70
|
+
// Set initial state
|
|
71
|
+
if (config.geometry !== undefined) {
|
|
72
|
+
engine.setParameter('geometry', config.geometry);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// 4. Wrap in Actor (logic layer)
|
|
76
|
+
const actor = new VIB3Actor(engine, config.personality || 'neutral');
|
|
77
|
+
actor.id = actorId;
|
|
78
|
+
|
|
79
|
+
// 5. Register with Orchestrator (simulation loop)
|
|
80
|
+
this.orchestrator.entities.set(actorId, actor);
|
|
81
|
+
this.actors.set(actorId, actor);
|
|
82
|
+
|
|
83
|
+
console.log(`VIB3Universe: Spawned actor ${actorId}`);
|
|
84
|
+
return actor;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Remove an actor from the universe.
|
|
89
|
+
* @param {string} actorId
|
|
90
|
+
*/
|
|
91
|
+
despawnActor(actorId) {
|
|
92
|
+
const actor = this.actors.get(actorId);
|
|
93
|
+
if (actor) {
|
|
94
|
+
// Remove from logic
|
|
95
|
+
this.orchestrator.kill(actorId);
|
|
96
|
+
|
|
97
|
+
// Cleanup engine
|
|
98
|
+
if (actor.engine && actor.engine.destroy) {
|
|
99
|
+
actor.engine.destroy();
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// Remove from visuals
|
|
103
|
+
this.compositor.removeInstance(actorId);
|
|
104
|
+
this.actors.delete(actorId);
|
|
105
|
+
|
|
106
|
+
console.log(`VIB3Universe: Despawned actor ${actorId}`);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CrystalLabyrinth.js - Vertical Slice Demo
|
|
3
|
+
*
|
|
4
|
+
* Implements the full "Ultra" stack:
|
|
5
|
+
* - VIB3Universe (Multi-instance)
|
|
6
|
+
* - VIB3Orchestrator (Game Loop)
|
|
7
|
+
* - VIB3Compositor (Visuals)
|
|
8
|
+
* - LatticePhysics (4D Collision)
|
|
9
|
+
* - PlayerController4D (Input)
|
|
10
|
+
* - LiveDirector (AI Pacing)
|
|
11
|
+
*
|
|
12
|
+
* @experimental
|
|
13
|
+
*/
|
|
14
|
+
import { VIB3Universe } from '../VIB3Universe.js';
|
|
15
|
+
import { GameLoop } from '../GameLoop.js';
|
|
16
|
+
import { LatticePhysics } from '../LatticePhysics.js';
|
|
17
|
+
import { PlayerController4D } from '../PlayerController4D.js';
|
|
18
|
+
import { LiveDirector } from '../LiveDirector.js';
|
|
19
|
+
|
|
20
|
+
class CrystalLabyrinthGame {
|
|
21
|
+
constructor() {
|
|
22
|
+
this.universe = new VIB3Universe('vib3-universe');
|
|
23
|
+
this.physics = new LatticePhysics();
|
|
24
|
+
this.director = new LiveDirector(this.universe);
|
|
25
|
+
|
|
26
|
+
// Game State
|
|
27
|
+
this.score = 0;
|
|
28
|
+
this.health = 100;
|
|
29
|
+
this.isPlaying = false;
|
|
30
|
+
|
|
31
|
+
// Entities
|
|
32
|
+
this.player = null; // The "Camera"
|
|
33
|
+
this.crystals = [];
|
|
34
|
+
this.shadows = [];
|
|
35
|
+
|
|
36
|
+
// UI
|
|
37
|
+
this.ui = {
|
|
38
|
+
score: document.getElementById('score'),
|
|
39
|
+
health: document.getElementById('health'),
|
|
40
|
+
overlay: document.getElementById('overlay'),
|
|
41
|
+
startBtn: document.getElementById('start-btn')
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
// Bind input
|
|
45
|
+
this.controller = new PlayerController4D(document.body, {
|
|
46
|
+
setParameter: (k, v) => this.updatePlayerView(k, v)
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
// Setup Loop
|
|
50
|
+
this.loop = new GameLoop(
|
|
51
|
+
(dt) => this.update(dt),
|
|
52
|
+
(alpha) => this.render(alpha)
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
this.init();
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
async init() {
|
|
59
|
+
// Create the "World" (Background Layer)
|
|
60
|
+
// A deep, slow-moving Holographic system representing the void
|
|
61
|
+
const world = await this.universe.spawnActor({
|
|
62
|
+
personality: 'neutral',
|
|
63
|
+
system: 'holographic',
|
|
64
|
+
geometry: 11, // Hypersphere
|
|
65
|
+
layer: { zIndex: 0, opacity: 0.4 }
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
// Setup UI listeners
|
|
69
|
+
this.ui.startBtn.addEventListener('click', () => this.start());
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
start() {
|
|
73
|
+
this.isPlaying = true;
|
|
74
|
+
this.ui.overlay.classList.add('hidden');
|
|
75
|
+
|
|
76
|
+
// Start Systems
|
|
77
|
+
this.universe.start();
|
|
78
|
+
this.loop.start();
|
|
79
|
+
this.director.start();
|
|
80
|
+
|
|
81
|
+
// Spawn Level
|
|
82
|
+
this.spawnLevel();
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
async spawnLevel() {
|
|
86
|
+
// Spawn 5 Crystals (Pickups)
|
|
87
|
+
for (let i = 0; i < 5; i++) {
|
|
88
|
+
const crystal = await this.universe.spawnActor({
|
|
89
|
+
personality: 'heroic', // Bright, positive
|
|
90
|
+
system: 'faceted',
|
|
91
|
+
geometry: 7, // Crystal
|
|
92
|
+
layer: { zIndex: 10, blendMode: 'screen', opacity: 0.9 }
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
// Random position in 4D space (mock)
|
|
96
|
+
crystal.physics = {
|
|
97
|
+
pos: {
|
|
98
|
+
x: (Math.random() - 0.5) * 20,
|
|
99
|
+
y: (Math.random() - 0.5) * 5,
|
|
100
|
+
z: (Math.random() - 0.5) * 20
|
|
101
|
+
},
|
|
102
|
+
vel: { x: 0, y: 0, z: 0 },
|
|
103
|
+
acc: { x: 0, y: 0, z: 0 }
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
this.crystals.push(crystal);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Spawn 3 Shadows (Enemies)
|
|
110
|
+
for (let i = 0; i < 3; i++) {
|
|
111
|
+
const shadow = await this.universe.spawnActor({
|
|
112
|
+
personality: 'glitch', // Chaotic, negative
|
|
113
|
+
system: 'quantum',
|
|
114
|
+
geometry: 16, // Spiky
|
|
115
|
+
layer: { zIndex: 5, blendMode: 'multiply', opacity: 0.7 }
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
shadow.physics = {
|
|
119
|
+
pos: { x: 0, y: 0, z: -30 }, // Start far away
|
|
120
|
+
vel: { x: 0, y: 0, z: 0 },
|
|
121
|
+
acc: { x: 0, y: 0, z: 0 }
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
this.shadows.push(shadow);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Physics Update (Fixed Timestep)
|
|
130
|
+
*/
|
|
131
|
+
update(dt) {
|
|
132
|
+
if (!this.isPlaying) return;
|
|
133
|
+
|
|
134
|
+
// 1. Update Player Controls
|
|
135
|
+
this.controller.update(dt);
|
|
136
|
+
|
|
137
|
+
// 2. Update Physics World
|
|
138
|
+
// Sync player controller state to physics engine?
|
|
139
|
+
// For now, controller handles movement directly.
|
|
140
|
+
|
|
141
|
+
// 3. AI Logic (Shadows hunt player)
|
|
142
|
+
this.shadows.forEach(shadow => {
|
|
143
|
+
// Move towards player (0,0,0 relative to camera)
|
|
144
|
+
// In a real engine, we'd have absolute coordinates.
|
|
145
|
+
// Here, we simulate relative motion by updating parameters
|
|
146
|
+
|
|
147
|
+
// Mock: Oscillate shadow intensity based on "proximity"
|
|
148
|
+
shadow.emote('panic', 0.5);
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
// 4. Check Collisions (Mock)
|
|
152
|
+
// If player is close to a crystal -> Collect
|
|
153
|
+
if (Math.random() < 0.005 && this.crystals.length > 0) {
|
|
154
|
+
this.collectCrystal(this.crystals.pop());
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Render Update (Variable Timestep)
|
|
160
|
+
*/
|
|
161
|
+
render(alpha) {
|
|
162
|
+
// Visual interpolation could happen here
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
updatePlayerView(key, value) {
|
|
166
|
+
// Broadcast player view changes to the World actor
|
|
167
|
+
// This makes the world rotate around the player
|
|
168
|
+
const world = this.universe.actors.get(this.universe.orchestrator.entities.keys().next().value);
|
|
169
|
+
if (world && world.engine) {
|
|
170
|
+
world.engine.setParameter(key, value);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
collectCrystal(actor) {
|
|
175
|
+
this.score++;
|
|
176
|
+
this.ui.score.innerText = this.score;
|
|
177
|
+
|
|
178
|
+
// FX
|
|
179
|
+
actor.emote('joy', 1.0, 500);
|
|
180
|
+
setTimeout(() => {
|
|
181
|
+
this.universe.despawnActor(actor.id);
|
|
182
|
+
}, 500);
|
|
183
|
+
|
|
184
|
+
if (this.score >= 5) {
|
|
185
|
+
this.win();
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
win() {
|
|
190
|
+
this.isPlaying = false;
|
|
191
|
+
this.ui.overlay.innerHTML = `
|
|
192
|
+
<h1 style="color: #0f0; text-shadow: 0 0 20px #0f0;">SECTOR STABILIZED</h1>
|
|
193
|
+
<p>The lattice is secure.</p>
|
|
194
|
+
<button onclick="location.reload()">Re-enter</button>
|
|
195
|
+
`;
|
|
196
|
+
this.ui.overlay.classList.remove('hidden');
|
|
197
|
+
this.loop.stop();
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// Start Game
|
|
202
|
+
new CrystalLabyrinthGame();
|
|
@@ -57,10 +57,9 @@ export class TradingCardManager {
|
|
|
57
57
|
|
|
58
58
|
// Dynamic import based on system - USE EXACT GENERATORS THAT MATCH ENGINE VISUALS
|
|
59
59
|
const generatorMap = {
|
|
60
|
-
'faceted': () => import('./
|
|
61
|
-
'quantum': () => import('./
|
|
62
|
-
'holographic': () => import('./
|
|
63
|
-
'polychora': () => import('./PolychoraCardGenerator.js')
|
|
60
|
+
'faceted': () => import('./FacetedCardGenerator.js'),
|
|
61
|
+
'quantum': () => import('./QuantumCardGenerator.js'),
|
|
62
|
+
'holographic': () => import('./HolographicCardGenerator.js')
|
|
64
63
|
};
|
|
65
64
|
|
|
66
65
|
const importFunction = generatorMap[system];
|
package/src/export/index.js
CHANGED
|
@@ -8,7 +8,17 @@ export { exportSVG, downloadSVG } from './SVGExporter.js';
|
|
|
8
8
|
export { exportCSS, downloadCSS, toStyleObject } from './CSSExporter.js';
|
|
9
9
|
export { exportLottie, downloadLottie } from './LottieExporter.js';
|
|
10
10
|
|
|
11
|
-
//
|
|
11
|
+
// Core managers
|
|
12
12
|
export { ExportManager } from './ExportManager.js';
|
|
13
13
|
export { CardGeneratorBase } from './CardGeneratorBase.js';
|
|
14
14
|
export { TradingCardManager } from './TradingCardManager.js';
|
|
15
|
+
|
|
16
|
+
// Shader & package exporters
|
|
17
|
+
export { ShaderExporter } from './ShaderExporter.js';
|
|
18
|
+
export { VIB3PackageExporter, VIB3_PACKAGE_VERSION, createVIB3Package } from './VIB3PackageExporter.js';
|
|
19
|
+
export { TradingCardGenerator } from './TradingCardGenerator.js';
|
|
20
|
+
|
|
21
|
+
// Per-system card generators
|
|
22
|
+
export { TradingCardSystemFaceted } from './systems/TradingCardSystemFaceted.js';
|
|
23
|
+
export { TradingCardSystemHolographic } from './systems/TradingCardSystemHolographic.js';
|
|
24
|
+
export { TradingCardSystemQuantum } from './systems/TradingCardSystemQuantum.js';
|