nova64 0.2.5 → 0.2.7

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 (185) hide show
  1. package/README.md +25 -8
  2. package/bin/nova64.js +165 -0
  3. package/dist/assets/console-CY_kygm3.js +14 -0
  4. package/dist/assets/console-CY_kygm3.js.map +1 -0
  5. package/dist/assets/main-l0sNRNKZ.js.map +1 -0
  6. package/dist/assets/sky/studio/nx.png +0 -0
  7. package/dist/assets/sky/studio/ny.png +0 -0
  8. package/dist/assets/sky/studio/nz.png +0 -0
  9. package/dist/assets/sky/studio/px.png +0 -0
  10. package/dist/assets/sky/studio/py.png +0 -0
  11. package/dist/assets/sky/studio/pz.png +0 -0
  12. package/dist/assets/vanilla-Dcuy32gi.js +2 -0
  13. package/dist/assets/vanilla-Dcuy32gi.js.map +1 -0
  14. package/dist/console.html +899 -0
  15. package/dist/docs/BENCHMARK.md +77 -0
  16. package/dist/docs/CHEATSHEET.md +255 -0
  17. package/dist/docs/EFFECTS_API_GUIDE.md +577 -0
  18. package/dist/docs/EFFECTS_QUICK_REFERENCE.md +331 -0
  19. package/dist/docs/FONT_CHARACTER_REFERENCE.md +219 -0
  20. package/dist/docs/FREE_GLB_ASSETS.md +330 -0
  21. package/dist/docs/FULLSCREEN_BUTTON_FEATURE.md +296 -0
  22. package/dist/docs/GAMEPAD_SUPPORT.md +348 -0
  23. package/dist/docs/GAME_IMPROVEMENTS.md +278 -0
  24. package/dist/docs/GAME_QUALITY_STATUS.md +300 -0
  25. package/dist/docs/MIGRATION_GUIDE.md +553 -0
  26. package/dist/docs/NOVA64_3D_API.md +356 -0
  27. package/dist/docs/NOVA64_API_REFERENCE.md +1406 -0
  28. package/dist/docs/NOVA64_UI_API.md +503 -0
  29. package/dist/docs/UI_SYSTEM_SUMMARY.md +445 -0
  30. package/dist/docs/VOXEL_ENGINE_GUIDE.md +662 -0
  31. package/dist/docs/VOXEL_QUICK_REFERENCE.md +386 -0
  32. package/dist/docs/api-3d.html +750 -0
  33. package/dist/docs/api-effects.html +385 -0
  34. package/dist/docs/api-improvements.md +121 -0
  35. package/dist/docs/api-skybox.html +407 -0
  36. package/dist/docs/api-sprites.html +321 -0
  37. package/dist/docs/api-voxel.html +337 -0
  38. package/dist/docs/api.html +543 -0
  39. package/dist/docs/assets.html +306 -0
  40. package/dist/docs/audio.html +340 -0
  41. package/dist/docs/blogs.html +286 -0
  42. package/dist/docs/collision.html +316 -0
  43. package/dist/docs/console.html +247 -0
  44. package/dist/docs/editor.html +297 -0
  45. package/dist/docs/font.html +247 -0
  46. package/dist/docs/framebuffer.html +247 -0
  47. package/dist/docs/fullscreen-button.html +297 -0
  48. package/dist/docs/gpu-systems.html +247 -0
  49. package/dist/docs/index.html +580 -0
  50. package/dist/docs/input.html +491 -0
  51. package/dist/docs/physics.html +311 -0
  52. package/dist/docs/screens.html +311 -0
  53. package/dist/docs/storage.html +311 -0
  54. package/dist/docs/textinput.html +332 -0
  55. package/dist/docs/ui.html +488 -0
  56. package/dist/examples/3d-advanced/code.js +695 -0
  57. package/dist/examples/adventure-comic-3d/code.js +342 -0
  58. package/dist/examples/audio-lab/code.js +150 -0
  59. package/dist/examples/boids-flocking/code.js +270 -0
  60. package/dist/examples/crystal-cathedral-3d/code.js +706 -0
  61. package/dist/examples/cyberpunk-city-3d/code.js +1383 -0
  62. package/dist/examples/demoscene/README.md +192 -0
  63. package/dist/examples/demoscene/code.js +1081 -0
  64. package/dist/examples/demoscene/meta.json +21 -0
  65. package/dist/examples/dungeon-crawler-3d/code.js +1117 -0
  66. package/dist/examples/f-zero-nova-3d/code.js +865 -0
  67. package/dist/examples/f-zero-nova-3d/code_old.js +1555 -0
  68. package/dist/examples/fps-demo-3d/code.js +744 -0
  69. package/dist/examples/game-of-life-3d/code.js +338 -0
  70. package/dist/examples/generative-art/code.js +632 -0
  71. package/dist/examples/hello-3d/code.js +325 -0
  72. package/dist/examples/hello-skybox/code.js +183 -0
  73. package/dist/examples/hello-world/code.js +19 -0
  74. package/dist/examples/input-showcase/code.js +109 -0
  75. package/dist/examples/instancing-demo/code.js +315 -0
  76. package/dist/examples/minecraft-demo/code.js +387 -0
  77. package/dist/examples/model-viewer-3d/code.js +114 -0
  78. package/dist/examples/mystical-realm-3d/code.js +1203 -0
  79. package/dist/examples/nature-explorer-3d/code.js +1318 -0
  80. package/dist/examples/particles-demo/code.js +522 -0
  81. package/dist/examples/pbr-showcase/code.js +140 -0
  82. package/dist/examples/physics-demo-3d/code.js +948 -0
  83. package/dist/examples/screen-demo/code.js +267 -0
  84. package/dist/examples/shooter-demo-3d/code.js +1286 -0
  85. package/dist/examples/space-combat-3d/IMPLEMENTATION_SUMMARY.md +109 -0
  86. package/dist/examples/space-combat-3d/README.md +135 -0
  87. package/dist/examples/space-combat-3d/code.js +1332 -0
  88. package/dist/examples/space-harrier-3d/code.js +923 -0
  89. package/dist/examples/star-fox-nova-3d/code.js +1116 -0
  90. package/dist/examples/star-fox-nova-3d/code_backup.js +410 -0
  91. package/dist/examples/star-fox-nova-3d/code_broken.js +1821 -0
  92. package/dist/examples/storage-quest/code.js +209 -0
  93. package/dist/examples/strider-demo-3d/IMPROVEMENT_OPTIONS.md +285 -0
  94. package/dist/examples/strider-demo-3d/cache-test.html +132 -0
  95. package/dist/examples/strider-demo-3d/code-fixed.js +582 -0
  96. package/dist/examples/strider-demo-3d/code-old.js +1537 -0
  97. package/dist/examples/strider-demo-3d/code.js +1462 -0
  98. package/dist/examples/strider-demo-3d/code.js.bak2 +1169 -0
  99. package/dist/examples/strider-demo-3d/fix-game.sh +53 -0
  100. package/dist/examples/super-plumber-64/README.md +128 -0
  101. package/dist/examples/super-plumber-64/code.js +1185 -0
  102. package/dist/examples/super-plumber-64/index.html +88 -0
  103. package/dist/examples/test-2d-overlay/code.js +32 -0
  104. package/dist/examples/test-font/code.js +51 -0
  105. package/dist/examples/test-minimal/code.js +21 -0
  106. package/dist/examples/ui-demo/code.js +306 -0
  107. package/dist/examples/wing-commander-space/README.md +180 -0
  108. package/dist/examples/wing-commander-space/code.js +1285 -0
  109. package/dist/examples/wizardry-3d/CHANGELOG.md +366 -0
  110. package/dist/examples/wizardry-3d/code.js +3928 -0
  111. package/dist/index.html +666 -0
  112. package/dist/os9-shell/assets/index-DIHfrTaW.css +1 -0
  113. package/dist/os9-shell/assets/index-KchE_ngx.js +483 -0
  114. package/dist/os9-shell/assets/index-KchE_ngx.js.map +1 -0
  115. package/dist/os9-shell/index.html +23 -0
  116. package/dist/os9-shell/nova-icon.svg +12 -0
  117. package/dist/runtime/api-2d.js +1158 -0
  118. package/dist/runtime/api-3d/camera.js +73 -0
  119. package/dist/runtime/api-3d/instancing.js +180 -0
  120. package/dist/runtime/api-3d/lights.js +51 -0
  121. package/dist/runtime/api-3d/materials.js +47 -0
  122. package/dist/runtime/api-3d/models.js +84 -0
  123. package/dist/runtime/api-3d/particles.js +296 -0
  124. package/dist/runtime/api-3d/pbr.js +113 -0
  125. package/dist/runtime/api-3d/primitives.js +304 -0
  126. package/dist/runtime/api-3d/scene.js +169 -0
  127. package/dist/runtime/api-3d/transforms.js +161 -0
  128. package/dist/runtime/api-3d.js +166 -0
  129. package/dist/runtime/api-effects.js +840 -0
  130. package/dist/runtime/api-gameutils.js +476 -0
  131. package/dist/runtime/api-generative.js +610 -0
  132. package/dist/runtime/api-presets.js +85 -0
  133. package/dist/runtime/api-skybox.js +232 -0
  134. package/dist/runtime/api-sprites.js +100 -0
  135. package/dist/runtime/api-voxel.js +712 -0
  136. package/dist/runtime/api.js +201 -0
  137. package/dist/runtime/assets.js +27 -0
  138. package/dist/runtime/audio.js +114 -0
  139. package/dist/runtime/collision.js +47 -0
  140. package/dist/runtime/console.js +101 -0
  141. package/dist/runtime/editor.js +233 -0
  142. package/dist/runtime/font.js +233 -0
  143. package/dist/runtime/framebuffer.js +28 -0
  144. package/dist/runtime/fullscreen-button.js +185 -0
  145. package/dist/runtime/gpu-canvas2d.js +47 -0
  146. package/dist/runtime/gpu-threejs.js +643 -0
  147. package/dist/runtime/gpu-webgl2.js +310 -0
  148. package/dist/runtime/index.d.ts +682 -0
  149. package/dist/runtime/index.js +22 -0
  150. package/dist/runtime/input.js +225 -0
  151. package/dist/runtime/logger.js +60 -0
  152. package/dist/runtime/physics.js +101 -0
  153. package/dist/runtime/screens.js +213 -0
  154. package/dist/runtime/storage.js +38 -0
  155. package/dist/runtime/store.js +151 -0
  156. package/dist/runtime/textinput.js +68 -0
  157. package/dist/runtime/ui/buttons.js +124 -0
  158. package/dist/runtime/ui/panels.js +105 -0
  159. package/dist/runtime/ui/text.js +86 -0
  160. package/dist/runtime/ui/widgets.js +141 -0
  161. package/dist/runtime/ui.js +111 -0
  162. package/index.html +6 -1
  163. package/package.json +9 -2
  164. package/public/assets/sky/studio/nx.png +0 -0
  165. package/public/assets/sky/studio/ny.png +0 -0
  166. package/public/assets/sky/studio/nz.png +0 -0
  167. package/public/assets/sky/studio/px.png +0 -0
  168. package/public/assets/sky/studio/py.png +0 -0
  169. package/public/assets/sky/studio/pz.png +0 -0
  170. package/public/os9-shell/assets/index-KchE_ngx.js +483 -0
  171. package/public/os9-shell/assets/index-KchE_ngx.js.map +1 -0
  172. package/public/os9-shell/index.html +10 -1
  173. package/runtime/api-2d.js +301 -21
  174. package/runtime/api-3d/pbr.js +45 -1
  175. package/runtime/api-3d.js +1 -0
  176. package/runtime/api-effects.js +90 -3
  177. package/runtime/api-gameutils.js +476 -0
  178. package/runtime/api-generative.js +610 -0
  179. package/runtime/api-skybox.js +54 -0
  180. package/runtime/api-voxel.js +139 -28
  181. package/runtime/gpu-threejs.js +13 -9
  182. package/runtime/ui.js +2 -2
  183. package/src/main.js +20 -0
  184. package/public/os9-shell/assets/index-B1Uvacma.js +0 -32825
  185. package/public/os9-shell/assets/index-B1Uvacma.js.map +0 -1
@@ -0,0 +1,356 @@
1
+ # 🎮 Nova64 Ultimate 3D Fantasy Console API
2
+
3
+ ## 🌟 **Revolutionary 3D Graphics System**
4
+
5
+ Nova64 delivers **spectacular Nintendo 64/PlayStation-style 3D graphics** with modern performance, featuring advanced materials, cinematic lighting, and 100% test coverage (35/35 tests passing).
6
+
7
+ ### 🚀 **What's New in v0.2.5**
8
+
9
+ - **New Primitives**: `createCone`, `createCapsule`, `createTorus` — expands the primitive library to 7 shapes
10
+ - **PBR Material Control**: `setPBRProperties(meshId, {metalness, roughness, envMapIntensity})` — tune materials at runtime
11
+ - **Image Skybox + IBL**: `createImageSkybox([6 urls])` — cube-map backgrounds with image-based lighting
12
+ - **Gradient & Solid Skyboxes**: `createGradientSkybox(top, bottom)`, `createSolidSkybox(color)`
13
+ - **Skybox Animation API**: `setSkyboxSpeed()`, `enableSkyboxAutoAnimate()`, `disableSkyboxAutoAnimate()`
14
+ - **`removeMesh` Alias**: `removeMesh()` is now identical to `destroyMesh()` — both work
15
+ - **Cylinder Fixed**: `createCylinder()` now correctly produces a cylinder, not a box
16
+
17
+ ### ✨ **Key Features**
18
+
19
+ - **🚀 Three.js Integration**: Hardware-accelerated 3D rendering with WebGL2
20
+ - **🎨 Advanced Materials**: Holographic, metallic, emissive, and animated surfaces
21
+ - **💡 Cinematic Lighting**: Multi-layered ambient, directional, and point lighting
22
+ - **🌫️ Atmospheric Effects**: Dynamic fog, volumetric lighting, particle systems
23
+ - **📐 High-Quality Shadows**: 4K shadow maps with soft shadow filtering
24
+ - **🎪 Post-Processing**: ACES tone mapping, bloom effects, motion blur
25
+
26
+ ## 🏗️ **Progressive Enhancement Architecture**
27
+
28
+ Nova64's intelligent renderer system ensures maximum compatibility:
29
+
30
+ 1. **🎯 Three.js** (Ultimate) - Complete 3D fantasy console with advanced effects
31
+ 2. **⚡ WebGL2** (Enhanced) - High-performance 2D with shader effects and tone mapping
32
+ 3. **🖼️ Canvas2D** (Compatible) - Universal 2D fallback for any device
33
+
34
+ **🔧 Renderer Control**: Use control panel dropdown or `localStorage.setItem('nova64-render-mode', 'threejs')`
35
+
36
+ ## 🎯 **Complete 3D API Reference** (35+ Functions)
37
+
38
+ ### 🎨 **Advanced Object Creation**
39
+
40
+ #### `createCube(size, color, position, options?)` ⭐
41
+
42
+ Creates a cube mesh.
43
+
44
+ - `size` (number): Cube side length (default: 1)
45
+ - `color` (hex): Colour, e.g. `0xff4488`
46
+ - `position` (array): `[x, y, z]` world position (default: `[0, 0, 0]`)
47
+ - `options` (object): Material options — see Material Options table
48
+ - **Returns**: mesh ID (number)
49
+
50
+ ```javascript
51
+ // Basic cube
52
+ const box = createCube(2, 0xff4488, [0, 1, 0]);
53
+
54
+ // Holographic cube
55
+ const holoCube = createCube(1.5, 0x00ff88, [3, 1, -3], {
56
+ material: 'holographic',
57
+ emissive: 0x004400,
58
+ metalness: 0.8,
59
+ roughness: 0.2,
60
+ });
61
+ ```
62
+
63
+ #### `createSphere(radius, color, position, options?)` ⭐
64
+
65
+ Creates a sphere mesh.
66
+
67
+ - `radius` (number): Sphere radius (default: 1)
68
+ - `color` (hex): Colour
69
+ - `position` (array): `[x, y, z]`
70
+ - `options` (object): Material options; also accepts `segments` (default: 8)
71
+ - **Returns**: mesh ID (number)
72
+
73
+ ```javascript
74
+ // Metallic planet
75
+ const planet = createSphere(2, 0x4488ff, [0, 2, -8], {
76
+ material: 'metallic',
77
+ metalness: 0.9,
78
+ roughness: 0.1,
79
+ });
80
+
81
+ // Low-poly N64 orb
82
+ const orb = createSphere(0.8, 0xffff00, [-4, 1, -5], {
83
+ material: 'emissive',
84
+ segments: 8,
85
+ });
86
+ ```
87
+
88
+ #### `createPlane(width, height, color, position, options?)` ⭐
89
+
90
+ Creates a flat plane — ground, walls, ceilings.
91
+
92
+ - `width, height` (numbers): Plane dimensions
93
+ - `color` (hex): Colour
94
+ - `position` (array): `[x, y, z]`
95
+ - `options` (object): Material options
96
+ - **Returns**: mesh ID (number)
97
+
98
+ ```javascript
99
+ // Ground plane
100
+ const ground = createPlane(100, 100, 0x228b22, [0, 0, 0]);
101
+
102
+ // Holographic wall
103
+ const wall = createPlane(8, 6, 0x00ffff, [5, 3, -10], {
104
+ material: 'holographic',
105
+ transparent: true,
106
+ opacity: 0.7,
107
+ });
108
+ ```
109
+
110
+ #### `loadModel(url, position, scale)` (async)
111
+
112
+ Loads GLTF/GLB 3D models with automatic N64-style material conversion.
113
+
114
+ - `url` (string): Path to .gltf or .glb file
115
+ - `position` (array): [x, y, z] position (default: [0, 0, 0])
116
+ - `scale` (number): Uniform scale factor (default: 1)
117
+ - Returns: Promise resolving to mesh ID
118
+
119
+ ```js
120
+ const spaceship = await loadModel('/assets/ship.glb', [0, 0, 0], 0.5);
121
+ ```
122
+
123
+ ### Object Manipulation
124
+
125
+ #### `setPosition(meshId, x, y, z)`
126
+
127
+ Sets absolute position of a 3D object.
128
+
129
+ ```js
130
+ setPosition(cube, 5, 2, -3);
131
+ ```
132
+
133
+ #### `setRotation(meshId, x, y, z)`
134
+
135
+ Sets absolute rotation in radians.
136
+
137
+ ```js
138
+ setRotation(cube, 0, Math.PI / 4, 0); // 45° Y rotation
139
+ ```
140
+
141
+ #### `setScale(meshId, x, y, z)` or `setScale(meshId, uniform)`
142
+
143
+ Sets object scale. Use single number for uniform scaling.
144
+
145
+ ```js
146
+ setScale(cube, 2); // Double size uniformly
147
+ setScale(cube, 1, 2, 1); // Stretch vertically only
148
+ ```
149
+
150
+ #### `rotateMesh(meshId, x, y, z)`
151
+
152
+ Rotates by the specified amounts (additive).
153
+
154
+ ```js
155
+ // Spin cube each frame
156
+ rotateMesh(cube, 0, dt, 0);
157
+ ```
158
+
159
+ #### `moveMesh(meshId, x, y, z)`
160
+
161
+ Moves by the specified offset (additive).
162
+
163
+ ```js
164
+ moveMesh(cube, 0, Math.sin(time) * dt, 0); // Bob up and down
165
+ ```
166
+
167
+ #### `destroyMesh(meshId)`
168
+
169
+ Removes object from scene and frees memory.
170
+
171
+ ```js
172
+ destroyMesh(cube);
173
+ ```
174
+
175
+ ### Camera Controls
176
+
177
+ #### `setCameraPosition(x, y, z)`
178
+
179
+ Sets camera position in world space.
180
+
181
+ ```js
182
+ setCameraPosition(0, 5, 10); // Behind and above origin
183
+ ```
184
+
185
+ #### `setCameraTarget(x, y, z)`
186
+
187
+ Sets what the camera looks at.
188
+
189
+ ```js
190
+ setCameraTarget(0, 0, 0); // Look at origin
191
+ ```
192
+
193
+ #### `setCameraFOV(degrees)`
194
+
195
+ Sets field of view angle.
196
+
197
+ ```js
198
+ setCameraFOV(75); // Wide angle view
199
+ ```
200
+
201
+ ### Scene Effects
202
+
203
+ #### `setFog(color, near, far)`
204
+
205
+ Adds atmospheric fog for depth perception.
206
+
207
+ - `color` (hex): Fog color as 0xRRGGBB
208
+ - `near` (number): Distance where fog starts
209
+ - `far` (number): Distance where fog is fully opaque
210
+
211
+ ```js
212
+ setFog(0x003366, 10, 50); // Blue distance fog
213
+ ```
214
+
215
+ #### `setLightDirection(x, y, z)`
216
+
217
+ Sets the main directional light direction.
218
+
219
+ ```js
220
+ setLightDirection(1, 1, 0.5); // Light from upper-right
221
+ ```
222
+
223
+ #### `enablePixelation(factor)`
224
+
225
+ Applies N64-style pixelation effect.
226
+
227
+ - `factor` (number): Pixelation intensity (1 = none, 2+ = pixelated)
228
+
229
+ ```js
230
+ enablePixelation(2); // Double-pixel rendering
231
+ ```
232
+
233
+ #### `enableDithering(enabled)`
234
+
235
+ Toggles color dithering for authentic retro look.
236
+
237
+ ```js
238
+ enableDithering(true);
239
+ ```
240
+
241
+ ### Advanced Features
242
+
243
+ #### `raycastFromCamera(x, y)`
244
+
245
+ Cast a ray from camera through screen coordinates for object picking.
246
+
247
+ - Returns: `{ meshId, point, distance }` or `null`
248
+
249
+ ```js
250
+ const hit = raycastFromCamera(mouseX, mouseY);
251
+ if (hit) {
252
+ console.log(`Clicked object ${hit.meshId} at distance ${hit.distance}`);
253
+ }
254
+ ```
255
+
256
+ #### `get3DStats()`
257
+
258
+ Returns rendering performance statistics.
259
+
260
+ ```js
261
+ const stats = get3DStats();
262
+ console.log(`Triangles: ${stats.render.triangles}, Calls: ${stats.render.calls}`);
263
+ ```
264
+
265
+ #### Direct Three.js Access
266
+
267
+ For advanced users who need full Three.js control:
268
+
269
+ ```js
270
+ const scene = getScene();
271
+ const camera = getCamera();
272
+ const renderer = getRenderer();
273
+ const mesh = getMesh(meshId);
274
+ ```
275
+
276
+ ## N64-Style Best Practices
277
+
278
+ ### Geometry
279
+
280
+ - Keep polygon counts low (< 1000 tri per object)
281
+ - Use `segments` parameter on spheres (6-12 recommended)
282
+ - Prefer simple, angular shapes over smooth curves
283
+
284
+ ### Materials
285
+
286
+ - Use flat, saturated colors
287
+ - Avoid complex textures
288
+ - Embrace vertex lighting over per-pixel
289
+
290
+ ### Performance
291
+
292
+ - Batch similar objects when possible
293
+ - Use fog to hide distant detail
294
+ - Keep scene complexity moderate (< 50 active objects)
295
+
296
+ ### Aesthetic
297
+
298
+ - Use pixelation factor 1.5-2.0 for authentic feel
299
+ - Enable dithering for color banding
300
+ - Limit color palette for true retro look
301
+
302
+ ## Example Cart Structure
303
+
304
+ ```js
305
+ let objects = [];
306
+ let time = 0;
307
+
308
+ export async function init() {
309
+ // Setup scene
310
+ setCameraPosition(0, 5, 10);
311
+ setFog(0x001122, 10, 30);
312
+ enablePixelation(1.5);
313
+
314
+ // Create objects
315
+ objects.push(createCube(1, 0xff0000, [0, 0, 0]));
316
+
317
+ // Load models if needed
318
+ const model = await loadModel('/assets/ship.glb');
319
+ objects.push(model);
320
+ }
321
+
322
+ export function update(dt) {
323
+ time += dt;
324
+
325
+ // Animate objects
326
+ objects.forEach((obj, i) => {
327
+ rotateMesh(obj, 0, dt, 0);
328
+ });
329
+
330
+ // Move camera
331
+ const camX = Math.cos(time * 0.5) * 10;
332
+ const camZ = Math.sin(time * 0.5) * 10;
333
+ setCameraPosition(camX, 5, camZ);
334
+ setCameraTarget(0, 0, 0);
335
+ }
336
+
337
+ export function draw() {
338
+ cls(); // Clear 2D overlay
339
+ // 3D renders automatically
340
+
341
+ // Add 2D HUD elements
342
+ print('3D Scene Active', 8, 8, rgba8(255, 255, 255, 255));
343
+ print(`Objects: ${objects.length}`, 8, 24, rgba8(200, 200, 200, 255));
344
+ }
345
+ ```
346
+
347
+ ## Migration from 2D
348
+
349
+ Existing 2D carts continue to work unchanged. To add 3D elements:
350
+
351
+ 1. Initialize 3D scene in `init()`
352
+ 2. Create/animate 3D objects in `update()`
353
+ 3. Use `draw()` for 2D overlay elements
354
+ 4. 3D rendering happens automatically between `update()` and `draw()`
355
+
356
+ The 2D framebuffer becomes a transparent overlay rendered on top of the 3D scene, perfect for HUD elements, text, and UI.