3D 리플레이 1단계: .vrf 변환기(tools/replay-extract) · 사이트 3D 재생기 · 대화 동기화

- tools/replay-extract: ValorantReplayParser(MIT, 고정 커밋) → gvr-replay JSON v1
  (선수 이동 10Hz · 라운드 · 킬 · 사격 · 스킬/설치물 · 녹화 시작 시각)
- 사이트: 경기 화면 '3D 리플레이' 칸 (three.js 지연 로드). 미니맵 바닥 + 실제 높이,
  회전 · 확대 · 선수 선택 · 따라가기 · 킬피드 · 자막 · 말하는 사람 표시
- 동기화: 같은 킬의 경기 기록 시각과 리플레이 시각 차이 중앙값 (못 맞추면 라운드 시작)
  현장 모드 시계에 묶어 재생 · 멈춤 · 이동 · 배속이 대화와 같이 움직임
- 목 서버 데모(GVR_MOCK_REPLAY), 동기화 테스트 4개

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
EJClaw
2026-10-17 03:56:43 +09:00
parent 50fc90070b
commit 9592efeff6
18 changed files with 1539 additions and 1 deletions

View File

@@ -0,0 +1,76 @@
// gvr-replay: 발로란트 리플레이(.vrf) → 사이트 재생기용 JSON (형식 gvr-replay v1)
// gvr-replay <file.vrf> <out.json> [--hz 10]
// gvr-replay <file.vrf> --stats (디버그: 액터 종류별 개수)
// 성공하면 종료 코드 0 과 함께 stdout 마지막 줄에 {"ok":true,...} 요약을 쓴다. 실패는 1 과 {"ok":false,"error":...}
using System.Diagnostics;
using System.Text.Json;
using Replay.Encoding.Archives;
using Replay.Models.Descriptors;
using Replay.Valorant;
using Replay.Valorant.Events;
namespace GvrReplay;
public static class Program
{
public static int Main(string[] args)
{
if (args.Length < 2)
{
Console.Error.WriteLine("사용법: gvr-replay <file.vrf> <out.json> [--hz 10] | gvr-replay <file.vrf> --stats");
return 2;
}
var input = args[0];
var stats = args[1] == "--stats";
var hz = 10;
for (var i = 2; i < args.Length - 1; i++)
if (args[i] == "--hz") hz = Math.Clamp(int.Parse(args[i + 1]), 1, 60);
try
{
var sw = Stopwatch.StartNew();
var collector = new Collector(1000 / hz);
using var file = File.OpenRead(input);
using var archive = new FBinaryArchive(file);
var enricher = new ValorantEventEnricher(collector);
var result = ValorantReplayReader.CreateDefault(null, enricher, ParseProfile.Default).Read(archive);
enricher.Complete();
var info = result.Metadata.ReplayInfo;
if (stats)
{
collector.PrintStats();
return 0;
}
var replay = collector.Build(
result.Metadata.ReplayVersion.Branch,
FDateTimeToUnixMs(info.Timestamp),
info.LengthInMs,
hz);
var tmp = args[1] + ".tmp";
using (var fs = File.Create(tmp))
JsonSerializer.Serialize(fs, replay, ReplayJson.Options);
File.Move(tmp, args[1], true);
Console.WriteLine(JsonSerializer.Serialize(new
{
ok = true,
matchId = replay.MatchId,
map = replay.Map,
build = replay.Build,
players = replay.Players.Count,
rounds = replay.Rounds.Count,
kills = replay.Kills.Count,
elapsedMs = sw.ElapsedMilliseconds,
status = result.Status.ToString(),
warnings = result.TotalDiagnosticCount,
}));
return 0;
}
catch (Exception e)
{
Console.WriteLine(JsonSerializer.Serialize(new { ok = false, error = e.GetType().Name + ": " + e.Message }));
return 1;
}
}
/// UE FDateTime ticks (100ns, 0001-01-01 기준, UTC) → 유닉스 ms
public static long FDateTimeToUnixMs(long ticks) => ticks <= 0 ? 0 : (ticks - 621355968000000000L) / 10000L;
}