Online-Lobby, Arenen, Lackiererei, ComfyGen-Grafik, Verschleierung
Grosse Erweiterung ueber die erste spielbare Version hinaus: - Online (Firebase ueber REST, kein SDK): Konto per E-Mail, globale Lobby mit Laender-Raeumen, Herausfordern, Live-PvP (Host rechnet, Gast interpoliert, KI-Uebernahme bei Lag). Gast kann anonym beitreten. net.js / lobby.js / netfight.js, Regeln in docs/firebase. - 3 Arenen in verschiedenen Groessen (RC.ARENAS, half 8/12/16), Kamera + Licht + Boden skalieren; Liga skaliert die Arena mit, Setting + online aus Seed. Harte Rams/Wandtreffer schleudern Roboter auf den Rucken. - Intro (3D-Kamerafahrt), Titel, Einstellungen (Kamera, Schwierigkeit, Steuerung, Grafik, Arena), Lackiererei (painter.js, selbst bemalen). - Shop mit ComfyGen-Sprites (aus den 3D-Teilen erzeugt), Liga-Gegner sehen aus wie ihre Portraits (looks.js), kraeftigere Waffen-Modelle. - Oekonomie: Startgeld 800, Schadensbonus, Schaukaempfe, Online-Preisgeld. - Verschleierung: build.ps1 -Obfuscate (terser), tablet-taugliche Touch-UI. - Tests: tests/sim.test.js, balance.js, online.test.js. Dev-Tools in tools/. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
56
tools/partshot.html
Normal file
56
tools/partshot.html
Normal file
@@ -0,0 +1,56 @@
|
||||
<!doctype html>
|
||||
<!-- Dev tool (not shipped): renders ONE robot part exactly as the game builds it in 3D, on black,
|
||||
3/4 view from the front right. Used as reference for the shop images (ComfyGen generate_variants).
|
||||
partshot.html?id=flipper part id from game/parts.js (chassis, armour, wheels, weapon, tower)
|
||||
partshot.html?id=flipper&size=768 canvas size in px
|
||||
Screenshot via Chrome headless: tools/partshots.ps1 -->
|
||||
<html><head><meta charset="utf-8"><title>partshot</title>
|
||||
<style>html,body{margin:0;background:#000;overflow:hidden}canvas{display:block}</style></head>
|
||||
<body>
|
||||
<canvas id="c"></canvas>
|
||||
<script src="../game/vendor/three.min.js"></script>
|
||||
<script src="../game/kit/kit-core.js"></script>
|
||||
<script src="../game/parts.js"></script>
|
||||
<script src="../game/robot.js"></script>
|
||||
<script src="../game/combat.js"></script>
|
||||
<script src="../game/looks.js"></script>
|
||||
<script src="../game/render3d.js"></script>
|
||||
<script>
|
||||
(function () {
|
||||
'use strict';
|
||||
const T = THREE, q = new URLSearchParams(location.search);
|
||||
const id = q.get('id') || 'flipper', size = +q.get('size') || 768, p = RC.PARTS[id];
|
||||
const cv = document.getElementById('c');
|
||||
const renderer = new T.WebGLRenderer({ canvas: cv, antialias: true, preserveDrawingBuffer: true });
|
||||
renderer.setPixelRatio(1); renderer.setSize(size, size);
|
||||
renderer.outputEncoding = T.sRGBEncoding; renderer.toneMapping = T.ACESFilmicToneMapping; renderer.toneMappingExposure = 0.85;
|
||||
const scene = new T.Scene(); scene.background = new T.Color(0x000000);
|
||||
scene.add(new T.HemisphereLight(0xc8d4ea, 0x2a2018, 0.9));
|
||||
const key = new T.DirectionalLight(0xfff2e0, 1.9); key.position.set(3, 6, 4); scene.add(key);
|
||||
const rimA = new T.DirectionalLight(0xff8a3a, 0.9); rimA.position.set(-4, 2, 3); scene.add(rimA);
|
||||
const rimB = new T.DirectionalLight(0x6aa8ff, 0.8); rimB.position.set(-2, 3, -5); scene.add(rimB);
|
||||
|
||||
// neutral steel paint with orange accent - the player paints the body later, parts keep their own colours
|
||||
const build = Object.assign({}, RC.STARTER, { [p.slot]: id });
|
||||
if (p.slot === 'weapon' || p.slot === 'tower') build.armour = null;
|
||||
const R = RC.buildRobotModel(build, { body: 0x8d939c, accent: 0xff7a1a });
|
||||
scene.add(R.root);
|
||||
R.tilt.children.forEach(o => { o.visible = o.userData.part === p.slot; });
|
||||
|
||||
// frame the visible pieces
|
||||
// only visible, solid meshes (the hidden flame cone of the flamer would blow up the frame)
|
||||
R.root.updateMatrixWorld(true);
|
||||
const bb = new T.Box3();
|
||||
R.tilt.children.forEach(o => { if (o.visible) o.traverse(m => {
|
||||
if (m.isMesh && m.visible && !m.material.transparent) { m.geometry.computeBoundingBox(); bb.union(m.geometry.boundingBox.clone().applyMatrix4(m.matrixWorld)); }
|
||||
}); });
|
||||
const c = bb.getCenter(new T.Vector3()), s = bb.getSize(new T.Vector3()), r = s.length() / 2;
|
||||
const cam = new T.PerspectiveCamera(28, 1, 0.05, 100);
|
||||
const dir = new T.Vector3(1, 0.78, 0.95).normalize();
|
||||
cam.position.copy(c).addScaledVector(dir, r / Math.sin(T.MathUtils.degToRad(14)) * 1.12);
|
||||
cam.lookAt(c);
|
||||
renderer.render(scene, cam);
|
||||
document.title = 'done';
|
||||
})();
|
||||
</script>
|
||||
</body></html>
|
||||
26
tools/partshots.ps1
Normal file
26
tools/partshots.ps1
Normal file
@@ -0,0 +1,26 @@
|
||||
# Renders every visible robot part (chassis, armour, wheels, weapon, tower) with tools/partshot.html
|
||||
# into sprite-generator/output/r3d_<id>_raw_00001_.png - references for the shop images:
|
||||
# .\tools\partshots.ps1 all parts
|
||||
# .\tools\partshots.ps1 flipper one part
|
||||
# Then in sprite-generator: gen generate_variants (variants.py), gen adopt --size 192 part_<id>
|
||||
param([string[]]$Ids)
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$root = Split-Path $PSScriptRoot -Parent
|
||||
$chrome = @("$env:ProgramFiles\Google\Chrome\Application\chrome.exe", "${env:ProgramFiles(x86)}\Microsoft\Edge\Application\msedge.exe") |
|
||||
Where-Object { Test-Path $_ } | Select-Object -First 1
|
||||
if (-not $chrome) { throw 'Chrome or Edge not found' }
|
||||
if (-not $Ids) {
|
||||
$Ids = 'crate', 'doorstop', 'bulwark', 'scarab', 'rubber', 'bigtyre', 'tracks', 'steel', 'titan', 'hardox',
|
||||
'wedge', 'flipper', 'hammer', 'saw', 'crusher', 'spinner', 'flamer', 'minigun', 'rockets'
|
||||
}
|
||||
$out = Join-Path $root 'sprite-generator\output'
|
||||
New-Item -ItemType Directory -Force $out | Out-Null
|
||||
$profileDir = Join-Path $env:TEMP 'robotclash-partshot'
|
||||
$page = 'file:///' + ((Join-Path $root 'tools\partshot.html') -replace '\\', '/' -replace ' ', '%20')
|
||||
$ErrorActionPreference = 'Continue' # Chrome reports "bytes written" on stderr
|
||||
foreach ($id in $Ids) {
|
||||
$png = Join-Path $out "r3d_${id}_raw_00001_.png"
|
||||
& $chrome --headless=new --use-angle=swiftshader --enable-unsafe-swiftshader --hide-scrollbars --window-size=768,768 `
|
||||
--virtual-time-budget=3000 --user-data-dir="$profileDir" --screenshot="$png" "${page}?id=$id&size=768" 2>&1 | Out-Null
|
||||
if (Test-Path $png) { " r3d_$id -> $png" } else { " r3d_$id FAILED" }
|
||||
}
|
||||
27
tools/uishots.ps1
Normal file
27
tools/uishots.ps1
Normal file
@@ -0,0 +1,27 @@
|
||||
# Layout check: screenshots of every screen (Chrome headless) into tools\shots\.
|
||||
# .\tools\uishots.ps1 desktop 1280x800
|
||||
# .\tools\uishots.ps1 -Tablet tablet landscape 1024x768 + portrait 768x1024 (touch emulation)
|
||||
param([switch]$Tablet)
|
||||
$root = Split-Path $PSScriptRoot -Parent
|
||||
$chrome = @("$env:ProgramFiles\Google\Chrome\Application\chrome.exe", "${env:ProgramFiles(x86)}\Microsoft\Edge\Application\msedge.exe") |
|
||||
Where-Object { Test-Path $_ } | Select-Object -First 1
|
||||
if (-not $chrome) { throw 'Chrome or Edge not found' }
|
||||
$out = Join-Path $PSScriptRoot 'shots'
|
||||
New-Item -ItemType Directory -Force $out | Out-Null
|
||||
$page = 'file:///' + ((Join-Path $root 'game\index.html') -replace '\\', '/' -replace ' ', '%20')
|
||||
$screens = [ordered]@{
|
||||
title = 'title'; shop_weapon = 'play'; shop_chassis = 'play&tab=chassis'; shop_wheels = 'play&tab=wheels'; shop_tower = 'play&tab=tower'
|
||||
paint = 'play&paint'; league = 'play&screen=league'; vs = 'play&screen=vs'; settings = 'play&screen=settings'
|
||||
help = 'play&screen=help'; lobby = 'play&screen=lobby'; fight_fpv = 'fight=3&ff=4'; fight_iso = 'fight=3&ff=4&cam=iso'
|
||||
}
|
||||
$sizes = if ($Tablet) { @(@{n='tabL';s='1024,768'}, @{n='tabP';s='768,1024'}) } else { @(@{n='desk';s='1280,800'}) }
|
||||
foreach ($sz in $sizes) {
|
||||
foreach ($k in $screens.Keys) {
|
||||
$png = Join-Path $out "$($sz.n)_$k.png"
|
||||
$cargs = @('--headless=new', '--use-angle=swiftshader', '--enable-unsafe-swiftshader', '--hide-scrollbars', "--window-size=$($sz.s)",
|
||||
'--virtual-time-budget=5000', "--user-data-dir=$env:TEMP\robotclash-uishots", "--screenshot=$png")
|
||||
if ($Tablet) { $cargs += '--touch-events=enabled'; $cargs += '--blink-settings=primaryPointerType=2,availablePointerTypes=2,primaryHoverType=1,availableHoverTypes=1' }
|
||||
& $chrome @cargs "${page}?$($screens[$k])" 2>&1 | Out-Null
|
||||
" $($sz.n)_$k"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user