Spaces:
Sleeping
Sleeping
Download html_game/index.html from aadi-joshi/omninpc: direct link, hf CLI and curl.
- Browser
- Download file 12.3 kB
-
https://huggingface.co/spaces/aadi-joshi/omninpc/resolve/main/html_game/index.html
- Command line
-
hf download hf://spaces/aadi-joshi/omninpc/html_game/index.html
-
curl -L -o index.html https://huggingface.co/spaces/aadi-joshi/omninpc/resolve/main/html_game/index.html
12.3 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8" /> | |
| <title>OmniNPC — Live Nemotron Demo</title> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
| <style> | |
| :root { | |
| --bg: #0a0e1a; | |
| --panel: rgba(12, 18, 32, 0.85); | |
| --accent: #76b900; /* NVIDIA green */ | |
| --accent-soft: #a3e635; | |
| --warn: #f87171; | |
| --info: #60a5fa; | |
| --dim: #94a3b8; | |
| --text: #e2e8f0; | |
| --border: rgba(118, 185, 0, 0.35); | |
| } | |
| * { box-sizing: border-box; margin: 0; padding: 0; } | |
| body { | |
| background: var(--bg); | |
| color: var(--text); | |
| font-family: 'JetBrains Mono', 'Menlo', 'Consolas', monospace; | |
| overflow: hidden; | |
| height: 100vh; width: 100vw; | |
| } | |
| #game-canvas { display: block; position: absolute; top: 0; left: 0; } | |
| /* ── HUD layout ── */ | |
| #hud { | |
| position: absolute; top: 0; left: 0; right: 0; bottom: 0; | |
| pointer-events: none; | |
| display: grid; | |
| grid-template-columns: 320px 1fr 360px; | |
| grid-template-rows: auto 1fr auto; | |
| gap: 12px; padding: 12px; | |
| } | |
| .panel { | |
| background: var(--panel); | |
| border: 1px solid var(--border); | |
| border-radius: 8px; | |
| padding: 10px 12px; | |
| backdrop-filter: blur(8px); | |
| pointer-events: auto; | |
| font-size: 12px; line-height: 1.5; | |
| } | |
| .panel h3 { | |
| color: var(--accent); | |
| font-size: 11px; letter-spacing: 1.5px; | |
| margin-bottom: 8px; text-transform: uppercase; | |
| border-bottom: 1px solid var(--border); | |
| padding-bottom: 4px; | |
| } | |
| /* Top-left: scoreboard */ | |
| #score-panel { grid-column: 1; grid-row: 1; } | |
| #score-panel .row { | |
| display: flex; justify-content: space-between; align-items: center; | |
| padding: 3px 0; border-bottom: 1px dotted rgba(255,255,255,0.08); | |
| } | |
| #score-panel .row:last-child { border-bottom: none; } | |
| #score-panel .name { font-weight: bold; } | |
| #score-panel .player .name { color: var(--accent-soft); } | |
| #score-panel .hostile .name { color: var(--warn); } | |
| #score-panel .ally .name { color: #38bdf8; } | |
| #score-panel .wanderer .name { color: #fbbf24; } | |
| #score-panel .score { font-size: 16px; font-weight: bold; } | |
| /* Top-center: timer + directive */ | |
| #top-panel { grid-column: 2; grid-row: 1; text-align: center; } | |
| #timer { | |
| font-size: 32px; font-weight: bold; color: var(--accent); | |
| line-height: 1; | |
| } | |
| #timer.urgent { color: var(--warn); animation: pulse 0.6s infinite; } | |
| @keyframes pulse { | |
| 0%, 100% { transform: scale(1); } | |
| 50% { transform: scale(1.08); } | |
| } | |
| #directive { | |
| font-size: 11px; color: var(--info); margin-top: 4px; | |
| min-height: 14px; opacity: 0.9; | |
| } | |
| #directive::before { content: 'SUPER 49B: '; color: var(--accent); font-weight: bold; } | |
| /* Top-right: latency chart */ | |
| #lat-panel { grid-column: 3; grid-row: 1; } | |
| #lat-canvas { display: block; width: 100%; height: 60px; } | |
| #lat-stats { | |
| display: flex; justify-content: space-between; font-size: 10px; | |
| color: var(--dim); margin-top: 4px; | |
| } | |
| /* Middle row left: voice + controls */ | |
| #voice-panel { grid-column: 1; grid-row: 2; align-self: end; } | |
| #voice-panel .mic-status { | |
| display: flex; align-items: center; gap: 8px; font-size: 11px; | |
| } | |
| .mic-dot { | |
| width: 8px; height: 8px; border-radius: 50%; | |
| background: var(--dim); | |
| } | |
| .mic-dot.live { | |
| background: var(--accent); box-shadow: 0 0 8px var(--accent); | |
| animation: blink 1.2s infinite; | |
| } | |
| @keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } } | |
| #voice-panel .heard { color: var(--accent-soft); margin-top: 6px; min-height: 16px; } | |
| /* Middle row right: reasoning trace */ | |
| #think-panel { | |
| grid-column: 3; grid-row: 2; | |
| display: flex; flex-direction: column; | |
| max-height: 360px; overflow-y: auto; | |
| } | |
| #think-list { display: flex; flex-direction: column; gap: 6px; } | |
| .think-entry { | |
| border-left: 2px solid var(--border); | |
| padding: 4px 8px; font-size: 10px; color: var(--dim); | |
| line-height: 1.4; | |
| } | |
| .think-entry .role { color: var(--accent-soft); font-weight: bold; } | |
| .think-entry .body { color: var(--text); opacity: 0.85; } | |
| .think-entry.super-entry { | |
| border-left: 2px solid var(--accent); | |
| background: rgba(118, 185, 0, 0.06); | |
| } | |
| .think-entry.super-entry .role { color: var(--accent); } | |
| /* Bottom row: NPC token stream */ | |
| #stream-panel { grid-column: 1 / span 3; grid-row: 3; } | |
| #stream-list { | |
| display: flex; gap: 12px; overflow-x: auto; | |
| padding-bottom: 4px; max-height: 80px; | |
| } | |
| .npc-card { | |
| flex: 1 1 200px; min-width: 200px; | |
| background: rgba(0,0,0,0.3); border-radius: 6px; | |
| padding: 6px 8px; font-size: 10px; | |
| border: 1px solid rgba(255,255,255,0.08); | |
| } | |
| .npc-card .role-head { | |
| display: flex; justify-content: space-between; | |
| font-weight: bold; margin-bottom: 4px; font-size: 11px; | |
| } | |
| .npc-card .action { color: var(--accent-soft); } | |
| .npc-card .say { color: var(--text); font-style: italic; opacity: 0.85; } | |
| .npc-card .lat { color: var(--dim); font-size: 9px; } | |
| /* Crosshair */ | |
| #crosshair { | |
| position: absolute; top: 50%; left: 50%; | |
| width: 12px; height: 12px; | |
| transform: translate(-50%, -50%); | |
| pointer-events: none; | |
| border: 1px solid rgba(255,255,255,0.5); | |
| border-radius: 50%; | |
| } | |
| /* End screen */ | |
| #end-screen { | |
| position: absolute; inset: 0; | |
| background: rgba(0,0,0,0.85); display: none; | |
| align-items: center; justify-content: center; flex-direction: column; | |
| z-index: 10; pointer-events: auto; | |
| } | |
| #end-screen.show { display: flex; } | |
| #end-title { | |
| font-size: 64px; font-weight: bold; margin-bottom: 16px; | |
| color: var(--accent); | |
| } | |
| #end-stats { font-size: 16px; line-height: 1.8; text-align: center; } | |
| #end-restart { | |
| margin-top: 24px; padding: 12px 32px; | |
| background: var(--accent); color: var(--bg); | |
| border: none; font-family: inherit; font-weight: bold; | |
| cursor: pointer; border-radius: 4px; font-size: 14px; | |
| } | |
| /* Start screen */ | |
| #start-screen { | |
| position: absolute; inset: 0; | |
| background: rgba(0,0,0,0.92); display: flex; | |
| align-items: center; justify-content: center; flex-direction: column; | |
| z-index: 20; pointer-events: auto; padding: 24px; | |
| } | |
| #start-screen h1 { | |
| font-size: 56px; color: var(--accent); letter-spacing: -1px; | |
| margin-bottom: 8px; | |
| } | |
| #start-screen .sub { | |
| font-size: 14px; color: var(--dim); margin-bottom: 24px; | |
| max-width: 600px; text-align: center; line-height: 1.6; | |
| } | |
| #start-screen .keys { | |
| display: grid; grid-template-columns: 1fr 1fr; | |
| gap: 6px 24px; font-size: 12px; margin-bottom: 24px; | |
| } | |
| #start-screen .keys b { color: var(--accent-soft); } | |
| #start-btn { | |
| padding: 14px 48px; background: var(--accent); color: var(--bg); | |
| border: none; font-family: inherit; font-weight: bold; | |
| cursor: pointer; border-radius: 4px; font-size: 16px; | |
| } | |
| #start-btn:hover { background: var(--accent-soft); } | |
| #api-input { | |
| width: 320px; padding: 8px; background: rgba(255,255,255,0.05); | |
| border: 1px solid var(--border); color: var(--text); | |
| font-family: inherit; font-size: 11px; border-radius: 4px; | |
| margin-bottom: 12px; | |
| } | |
| /* Particles + recording badge */ | |
| #recording-badge { | |
| position: absolute; top: 12px; left: 50%; | |
| transform: translateX(-50%); display: none; | |
| background: rgba(248, 113, 113, 0.9); color: white; | |
| padding: 4px 12px; border-radius: 12px; font-size: 11px; | |
| z-index: 5; pointer-events: auto; | |
| } | |
| #recording-badge.live { display: block; } | |
| /* Helpers */ | |
| .badge { padding: 1px 6px; border-radius: 3px; font-size: 9px; | |
| background: rgba(118,185,0,0.2); color: var(--accent-soft); } | |
| </style> | |
| </head> | |
| <body> | |
| <canvas id="game-canvas"></canvas> | |
| <div id="crosshair"></div> | |
| <div id="recording-badge">● REC</div> | |
| <div id="hud"> | |
| <!-- Top-left: scoreboard --> | |
| <div class="panel" id="score-panel"> | |
| <h3>SCORE BOARD</h3> | |
| <div class="row player"><span class="name">YOU</span><span class="score" id="score-player">0</span></div> | |
| <div class="row ally"><span class="name">ALLY (Nano)</span><span class="score" id="score-ally">0</span></div> | |
| <div class="row hostile"><span class="name">HOSTILE (Nano)</span><span class="score" id="score-hostile">0</span></div> | |
| <div class="row wanderer"><span class="name">WANDERER (Nano)</span><span class="score" id="score-wanderer">0</span></div> | |
| </div> | |
| <!-- Top-center: timer + directive --> | |
| <div class="panel" id="top-panel"> | |
| <div id="timer">60.0</div> | |
| <div id="directive">connecting…</div> | |
| </div> | |
| <!-- Top-right: latency chart --> | |
| <div class="panel" id="lat-panel"> | |
| <h3>NANO LATENCY (last 30 calls)</h3> | |
| <canvas id="lat-canvas" width="340" height="60"></canvas> | |
| <div id="lat-stats"> | |
| <span>avg: <b id="lat-avg">—</b></span> | |
| <span>p95: <b id="lat-p95">—</b></span> | |
| <span>calls: <b id="lat-calls">0</b></span> | |
| <span>err: <b id="lat-errors" style="color:var(--warn)">0</b></span> | |
| </div> | |
| </div> | |
| <!-- Middle-left: voice --> | |
| <div class="panel" id="voice-panel"> | |
| <h3>VOICE COMMAND</h3> | |
| <div class="mic-status"> | |
| <span class="mic-dot" id="mic-dot"></span> | |
| <span id="mic-text">press V to enable mic</span> | |
| </div> | |
| <div class="heard" id="voice-heard"></div> | |
| <div style="font-size:9px;color:var(--dim);margin-top:6px;line-height:1.5"> | |
| say: <b style="color:var(--accent-soft)"><npc> <command></b><br/> | |
| e.g. "hostile go to blue zone"<br/> | |
| "ally come here" · "wanderer dance"<br/> | |
| "everyone stop" · "ally collect coins" | |
| </div> | |
| </div> | |
| <!-- Middle-right: reasoning trace --> | |
| <div class="panel" id="think-panel"> | |
| <h3>NEMOTRON REASONING (live <think>)</h3> | |
| <div id="think-list"></div> | |
| </div> | |
| <!-- Bottom: per-NPC stream --> | |
| <div class="panel" id="stream-panel"> | |
| <h3>PER-NPC NANO STREAM</h3> | |
| <div id="stream-list"> | |
| <div class="npc-card" id="card-hostile"> | |
| <div class="role-head"><span style="color: var(--warn)">HOSTILE</span><span class="lat">—ms</span></div> | |
| <div class="action">action: idle</div> | |
| <div class="say">"…"</div> | |
| </div> | |
| <div class="npc-card" id="card-ally"> | |
| <div class="role-head"><span style="color: #38bdf8">ALLY</span><span class="lat">—ms</span></div> | |
| <div class="action">action: idle</div> | |
| <div class="say">"…"</div> | |
| </div> | |
| <div class="npc-card" id="card-wanderer"> | |
| <div class="role-head"><span style="color: #fbbf24">WANDERER</span><span class="lat">—ms</span></div> | |
| <div class="action">action: idle</div> | |
| <div class="say">"…"</div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <div id="end-screen"> | |
| <div id="end-title">TIME!</div> | |
| <div id="end-stats"></div> | |
| <button id="end-restart">PLAY AGAIN</button> | |
| </div> | |
| <div id="start-screen"> | |
| <h1>OmniNPC</h1> | |
| <div class="sub"> | |
| Three Minecraft NPCs powered by NVIDIA Nemotron Nano 8B (vision) and Nemotron Super 49B (strategy). | |
| They see only screen pixels — no engine API. Race to collect the most coins in 60 seconds. | |
| </div> | |
| <input id="api-input" placeholder="API URL (leave blank for auto-detect)" value="" /> | |
| <div class="keys"> | |
| <span><b>WASD</b></span><span>walk</span> | |
| <span><b>Mouse</b></span><span>look</span> | |
| <span><b>SPACE</b></span><span>jump</span> | |
| <span><b>SHIFT</b></span><span>sprint</span> | |
| <span><b>E</b></span><span>collect coin</span> | |
| <span><b>R</b></span><span>start/stop recording</span> | |
| <span><b>V</b></span><span>toggle voice</span> | |
| <span><b>M</b></span><span>mute / unmute sound</span> | |
| <span><b>Esc</b></span><span>release mouse</span> | |
| </div> | |
| <div style="font-size:11px;color:var(--dim);max-width:600px;text-align:center;margin-bottom:18px;line-height:1.6"> | |
| <b style="color:var(--accent-soft)">Voice format:</b> | |
| <code style="color:var(--text)"><npc> <command></code> | |
| — e.g. "hostile go to blue zone", "ally come here", "wanderer dance", | |
| "everyone stop". No NPC name → defaults to ally. | |
| </div> | |
| <button id="start-btn">START GAME</button> | |
| </div> | |
| <!-- Three.js: pinned ESM build --> | |
| <script type="importmap"> | |
| { | |
| "imports": { | |
| "three": "https://unpkg.com/three@0.162.0/build/three.module.js" | |
| } | |
| } | |
| </script> | |
| <script type="module" src="./game.js"></script> | |
| </body> | |
| </html> | |