Bring the graphics-dev collaborator's dpl3-revive into the repo as first-class
project code (they've handed it off; it's ours now). This is the proven
Division renderer that our in-process rt_draw has been trying to be.
What's here:
- parser/ B2Z/V2Z/SVT/SCN/SPL/BGF/BMF/BSL decoders (pure Python).
- spec/ reverse-engineered format + the definitive VelociRender wire
protocol (from the original DIVISION source, matches our live
VPX node/action tables exactly).
- source-ref/ read-only copies of the original DIVISION C (BIZREAD.C,
DPLTYPES.H, DPL.H) that define the formats.
- patha/ the "virtual VelociRender board": vrboard.py (24-action protocol
server), vrview.py (numpy software rasterizer, the reference),
vrview_gl.py (moderngl GPU backend, 832x512@60Hz), plus the
run/replay/regress tooling and evidence renders. Drives FLYK/BLADE/
Star Trek demos AND our btl4opt/rpl4opt game binaries.
- viewer/ WebGL archive generators (.py); prebuilt HTML/data regeneratable.
- samples/ small test models/textures.
- bt*.raw.bin real BTL4OPT arena wire captures (kept for offline renderer
testing/regression against OUR game).
.gitignore keeps the multi-hundred-MB demo capture dumps + debug logs +
regeneratable viewer bundles out of history (they stay on disk).
Phase 0 of the integration is validated: their board decodes our bt8 capture
with zero errors (3748 nodes, 507 instances, 4 mechs) and renders our arena
(terrain/dome/sky, correct Division DAC gamma). Plan + status in memory;
integration continues in emulator/RENDERER-COLLAB.md.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
91 lines
3.6 KiB
Python
91 lines
3.6 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
run_demo.py -- one-command launcher: pick a scene, run the virtual board with the
|
|
live window, and start FLYK in the custom DOSBox-X against it.
|
|
|
|
python run_demo.py # SHARKS.SCN (default)
|
|
python run_demo.py SDEMO # any HPDAVE scene by basename
|
|
python run_demo.py TMPRIGS --prefix rig1
|
|
python run_demo.py SDEMO --dir HPDAVE --exe flyk
|
|
|
|
Writes C:\\RUNSCN.BAT in the staged tree (see stage_assets.py), spawns
|
|
dosbox-x-vrlink with VRLINK=1 after the board socket is up, then runs the vrrun
|
|
board loop inline (window opens on first draw_scene). Ctrl-C / close window to
|
|
stop; the DOSBox process is killed on exit.
|
|
"""
|
|
import os, sys, subprocess, threading, atexit
|
|
|
|
HERE = os.path.dirname(os.path.abspath(__file__))
|
|
STAGE = r"c:\temp\flykc"
|
|
DOSBOX = r"G:\DOSBox-X\dosbox-x-vrlink.exe"
|
|
CONF = os.path.join(HERE, "flyk_vr.conf")
|
|
|
|
|
|
def main():
|
|
args = [a for a in sys.argv[1:] if not a.startswith("--")]
|
|
scene = (args[0] if args else "SHARKS").upper()
|
|
if not scene.endswith(".SCN"):
|
|
scene += ".SCN"
|
|
proddir = "HPDAVE"
|
|
exe = "flyk"
|
|
prefix = "live"
|
|
for i, a in enumerate(sys.argv):
|
|
if a == "--dir" and i + 1 < len(sys.argv): proddir = sys.argv[i + 1]
|
|
if a == "--exe" and i + 1 < len(sys.argv): exe = sys.argv[i + 1]
|
|
if a == "--prefix" and i + 1 < len(sys.argv): prefix = sys.argv[i + 1]
|
|
|
|
scn_path = os.path.join(STAGE, proddir, scene)
|
|
if not os.path.exists(scn_path):
|
|
raise SystemExit(f"{scn_path} not staged -- run stage_assets.py first")
|
|
|
|
# joystick flight: rewrite the scene's TRACKER line to the game-port path
|
|
# (DOSBox maps the physical stick; FLYK's KEYBOARD tracker is inert under
|
|
# DOSBox, THRUSTMASTER is what moved the camera -- verified live on BLADE).
|
|
# Disable with --no-joystick.
|
|
import re
|
|
s = open(scn_path, encoding='latin1').read()
|
|
if "--no-joystick" not in sys.argv:
|
|
s2 = re.sub(r'(?m)^\s*TRACKER\s+\S+\s+[\d.]+\s+[\d.]+',
|
|
'TRACKER THRUSTMASTER 4.0 0.3', s)
|
|
if s2 != s:
|
|
open(scn_path, 'w', encoding='latin1').write(s2)
|
|
print("scene TRACKER -> THRUSTMASTER (joystick flight)")
|
|
s = s2
|
|
# RETRACE n = the scene's frame-rate divider (60/n Hz on the real board)
|
|
mr = re.search(r'(?m)^\s*RETRACE\s+(\d+)', s)
|
|
if mr:
|
|
os.environ['VRVIEW_FPS'] = str(max(1, 60 // max(1, int(mr.group(1)))))
|
|
print(f"RETRACE {mr.group(1)} -> pacing {os.environ['VRVIEW_FPS']} Hz")
|
|
# ambient SPECIALFX sim is opt-in (--sfx): most scenes' defs are event-only
|
|
if "--sfx" in sys.argv:
|
|
os.environ['VRVIEW_SFX'] = '1'
|
|
print("ambient SPECIALFX sim enabled")
|
|
with open(os.path.join(STAGE, "RUNSCN.BAT"), "w") as fp:
|
|
fp.write(f"cd \\{proddir}\r\ncall SETSVGA.BAT\r\n{exe} .\\{scene}\r\n")
|
|
print(f"scene: {proddir}\\{scene} (capture prefix: {prefix})")
|
|
|
|
proc = []
|
|
|
|
def launch_dosbox():
|
|
env = dict(os.environ, VRLINK='1')
|
|
p = subprocess.Popen([DOSBOX, "-conf", CONF], env=env,
|
|
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
|
proc.append(p)
|
|
print(f"dosbox launched (pid {p.pid})")
|
|
|
|
threading.Timer(2.0, launch_dosbox).start()
|
|
atexit.register(lambda: [p.kill() for p in proc if p.poll() is None])
|
|
|
|
# --soft = software rasterizer (reference); default is the moderngl backend
|
|
sys.argv = ["vrrun.py", prefix, "--view"] + (
|
|
["--soft"] if "--soft" in sys.argv else [])
|
|
import vrrun
|
|
try:
|
|
vrrun.main()
|
|
except KeyboardInterrupt:
|
|
pass
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|