nova64 0.2.5 → 0.2.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.
Files changed (140) 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/index.html +6 -1
  118. package/package.json +37 -32
  119. package/public/assets/sky/studio/nx.png +0 -0
  120. package/public/assets/sky/studio/ny.png +0 -0
  121. package/public/assets/sky/studio/nz.png +0 -0
  122. package/public/assets/sky/studio/px.png +0 -0
  123. package/public/assets/sky/studio/py.png +0 -0
  124. package/public/assets/sky/studio/pz.png +0 -0
  125. package/public/os9-shell/assets/index-KchE_ngx.js +483 -0
  126. package/public/os9-shell/assets/index-KchE_ngx.js.map +1 -0
  127. package/public/os9-shell/index.html +10 -1
  128. package/runtime/api-2d.js +301 -21
  129. package/runtime/api-3d/pbr.js +45 -1
  130. package/runtime/api-3d.js +1 -0
  131. package/runtime/api-effects.js +90 -3
  132. package/runtime/api-gameutils.js +476 -0
  133. package/runtime/api-generative.js +610 -0
  134. package/runtime/api-skybox.js +54 -0
  135. package/runtime/api-voxel.js +139 -28
  136. package/runtime/gpu-threejs.js +13 -9
  137. package/runtime/ui.js +2 -2
  138. package/src/main.js +20 -0
  139. package/public/os9-shell/assets/index-B1Uvacma.js +0 -32825
  140. package/public/os9-shell/assets/index-B1Uvacma.js.map +0 -1
package/README.md CHANGED
@@ -124,20 +124,36 @@
124
124
 
125
125
  ## 🚀 Quick Start Guide
126
126
 
127
- ### 🏁 **Launch Your 3D Fantasy Console**
127
+ ### **Install & Play (Recommended)**
128
128
 
129
129
  ```bash
130
- # Method 1: Development Server (Recommended)
130
+ # Install globally
131
+ pnpm add -g nova64
132
+
133
+ # Launch the console with 20+ playable demos
134
+ nova64 --start-demo
135
+ ```
136
+
137
+ That's it! Your browser opens to the Nova64 console at `http://localhost:3000/console.html` with all demos ready to play.
138
+
139
+ ### 🏁 **Development Setup**
140
+
141
+ ```bash
142
+ # Clone and set up for development
143
+ git clone https://github.com/seacloud9/nova64.git
144
+ cd nova64
131
145
  pnpm install
132
146
  pnpm dev
133
- # Visit the printed URL (typically http://localhost:5173)
147
+ # Visit http://localhost:5173
148
+ ```
134
149
 
135
- # Method 2: Direct Browser Launch
136
- open index.html
150
+ ### 🔧 **CLI Options**
137
151
 
138
- # Method 3: Simple HTTP Server
139
- python -m http.server 8000
140
- # Visit: http://localhost:8000
152
+ ```bash
153
+ nova64 --start-demo # Launch console with demos
154
+ nova64 --start-demo -p 8080 # Use a custom port
155
+ nova64 --start-demo --no-open # Don't auto-open browser
156
+ nova64 --help # Show all options
141
157
  ```
142
158
 
143
159
  🎉 **You should see spectacular 3D demos running instantly!**
@@ -148,6 +164,7 @@ python -m http.server 8000
148
164
  nova64/ # 🏰 Ultimate 3D Fantasy Console
149
165
  ├── 📄 index.html # Main console launcher
150
166
  ├── 📦 package.json # Dependencies & scripts
167
+ ├── 🎮 bin/nova64.js # CLI entry point (nova64 --start-demo)
151
168
  ├── 🔧 src/main.js # Core engine bootstrap
152
169
  ├── ⚡ runtime/ # 💎 Advanced 3D Engine
153
170
  │ ├── 🎨 gpu-threejs.js # Three.js GPU backend with advanced materials
package/bin/nova64.js ADDED
@@ -0,0 +1,165 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { createServer } from 'http';
4
+ import { readFile, stat } from 'fs/promises';
5
+ import { resolve, join, extname } from 'path';
6
+ import { fileURLToPath } from 'url';
7
+ import { exec } from 'child_process';
8
+
9
+ const __dirname = fileURLToPath(new URL('.', import.meta.url));
10
+ const distDir = resolve(__dirname, '..', 'dist');
11
+
12
+ const MIME_TYPES = {
13
+ '.html': 'text/html; charset=utf-8',
14
+ '.js': 'application/javascript; charset=utf-8',
15
+ '.mjs': 'application/javascript; charset=utf-8',
16
+ '.css': 'text/css; charset=utf-8',
17
+ '.json': 'application/json; charset=utf-8',
18
+ '.png': 'image/png',
19
+ '.jpg': 'image/jpeg',
20
+ '.jpeg': 'image/jpeg',
21
+ '.gif': 'image/gif',
22
+ '.svg': 'image/svg+xml',
23
+ '.ico': 'image/x-icon',
24
+ '.webp': 'image/webp',
25
+ '.woff': 'font/woff',
26
+ '.woff2': 'font/woff2',
27
+ '.ttf': 'font/ttf',
28
+ '.otf': 'font/otf',
29
+ '.mp3': 'audio/mpeg',
30
+ '.wav': 'audio/wav',
31
+ '.ogg': 'audio/ogg',
32
+ '.glb': 'model/gltf-binary',
33
+ '.gltf': 'application/json',
34
+ '.wasm': 'application/wasm',
35
+ '.map': 'application/json',
36
+ };
37
+
38
+ function parseArgs(args) {
39
+ const opts = { port: 3000, open: true, help: false, startDemo: false };
40
+ for (let i = 0; i < args.length; i++) {
41
+ const arg = args[i];
42
+ if (arg === '--help' || arg === '-h') opts.help = true;
43
+ else if (arg === '--start-demo') opts.startDemo = true;
44
+ else if (arg === '--no-open') opts.open = false;
45
+ else if (arg === '--port' || arg === '-p') {
46
+ const port = parseInt(args[++i], 10);
47
+ if (Number.isFinite(port) && port > 0 && port < 65536) opts.port = port;
48
+ }
49
+ }
50
+ return opts;
51
+ }
52
+
53
+ function openBrowser(url) {
54
+ const platform = process.platform;
55
+ const cmd = platform === 'darwin' ? 'open' : platform === 'win32' ? 'start' : 'xdg-open';
56
+ exec(`${cmd} "${url}"`);
57
+ }
58
+
59
+ function printHelp() {
60
+ console.log(`
61
+ \x1b[1m\x1b[35m🎮 Nova64\x1b[0m — Ultimate 3D Fantasy Console
62
+
63
+ \x1b[1mUsage:\x1b[0m
64
+ nova64 --start-demo Launch the console with demos
65
+ nova64 --start-demo -p 8080 Use a custom port
66
+
67
+ \x1b[1mOptions:\x1b[0m
68
+ --start-demo Start local server and open the console
69
+ -p, --port NUM Port to listen on (default: 3000)
70
+ --no-open Don't auto-open the browser
71
+ -h, --help Show this help message
72
+ `);
73
+ }
74
+
75
+ async function servePath(filePath) {
76
+ try {
77
+ const s = await stat(filePath);
78
+ if (s.isDirectory()) {
79
+ filePath = join(filePath, 'index.html');
80
+ }
81
+ const data = await readFile(filePath);
82
+ const ext = extname(filePath).toLowerCase();
83
+ const mime = MIME_TYPES[ext] || 'application/octet-stream';
84
+ return { data, mime, status: 200 };
85
+ } catch {
86
+ return null;
87
+ }
88
+ }
89
+
90
+ async function startServer(opts) {
91
+ const server = createServer(async (req, res) => {
92
+ // Sanitize URL path to prevent directory traversal
93
+ const url = new URL(req.url, `http://localhost:${opts.port}`);
94
+ const pathname = decodeURIComponent(url.pathname);
95
+ const safePath = resolve(distDir, '.' + pathname);
96
+
97
+ // Ensure resolved path is within distDir
98
+ if (!safePath.startsWith(distDir)) {
99
+ res.writeHead(403);
100
+ res.end('Forbidden');
101
+ return;
102
+ }
103
+
104
+ const result = await servePath(safePath);
105
+ if (result) {
106
+ res.writeHead(result.status, {
107
+ 'Content-Type': result.mime,
108
+ 'Cache-Control': 'no-cache',
109
+ 'Access-Control-Allow-Origin': '*',
110
+ });
111
+ res.end(result.data);
112
+ } else {
113
+ res.writeHead(404, { 'Content-Type': 'text/plain' });
114
+ res.end('Not Found');
115
+ }
116
+ });
117
+
118
+ server.listen(opts.port, () => {
119
+ const consoleUrl = `http://localhost:${opts.port}/console.html`;
120
+ console.log(`
121
+ \x1b[1m\x1b[35m🎮 Nova64\x1b[0m Fantasy Console
122
+
123
+ \x1b[32m➜\x1b[0m Console: \x1b[36m${consoleUrl}\x1b[0m
124
+ \x1b[32m➜\x1b[0m Home: \x1b[36mhttp://localhost:${opts.port}/\x1b[0m
125
+ \x1b[32m➜\x1b[0m NovaOS: \x1b[36mhttp://localhost:${opts.port}/os9-shell/\x1b[0m
126
+
127
+ Press \x1b[1mCtrl+C\x1b[0m to stop
128
+ `);
129
+
130
+ if (opts.open) {
131
+ openBrowser(consoleUrl);
132
+ }
133
+ });
134
+
135
+ server.on('error', err => {
136
+ if (err.code === 'EADDRINUSE') {
137
+ console.error(`\x1b[31mError: Port ${opts.port} is already in use.\x1b[0m`);
138
+ console.error(`Try: nova64 --start-demo --port ${opts.port + 1}`);
139
+ process.exit(1);
140
+ }
141
+ throw err;
142
+ });
143
+ }
144
+
145
+ // Main
146
+ const opts = parseArgs(process.argv.slice(2));
147
+
148
+ if (opts.help) {
149
+ printHelp();
150
+ process.exit(0);
151
+ }
152
+
153
+ if (opts.startDemo) {
154
+ // Verify dist/ exists
155
+ try {
156
+ await stat(distDir);
157
+ } catch {
158
+ console.error('\x1b[31mError: dist/ directory not found.\x1b[0m');
159
+ console.error('Run `pnpm build` first, or reinstall the package.');
160
+ process.exit(1);
161
+ }
162
+ startServer(opts);
163
+ } else {
164
+ printHelp();
165
+ }