SUZY SU PORTFOLIO / SELECT A DIRECTION作品集 / 选择方向
All work返回作品

Solo · AI-assisted (Claude Code) · In progress独立 · AI 协助开发(Claude Code)· 开发中

VR Sheepdog

Unity 6 · C# · Flocking AI · A* · Deterministic Sim

You are the shepherd, not the dog. Seated in your own living room, you give hand signals to an autonomous sheepdog that herds a flock around your real sofa and table into a pen. The simulation core is done; the Quest mixed-reality shell is next. The commands are named after real handler calls: Walk Up, Lie Down, Come Bye, Away and That'll Do. 你是牧羊人,不是狗。坐在自己的客厅里,用手势指挥一条自主牧羊犬,把羊群绕过真实的沙发和茶几赶进围栏。模拟核心已经完成,下一步是 Quest 混合现实外壳。指令沿用真实牧羊比赛的口令:Walk Up、Lie Down、Come Bye、Away、That'll Do。

My role我的职责

Game concept, herding rules, test layouts and evaluation; code written with Claude Code.

玩法概念、放牧规则、测试场景和评估;代码借助 Claude Code 编写。

Context项目背景

Personal portfolio project · milestone 1 of 4 done.

个人作品集项目 · 四个里程碑完成了第一个。

Core tools主要技术

Unity 6 · C# · .NET 9 offline harness · NUnit

Problem问题

In a real room, furniture blocks the flock and the dog. A dog that works on an open field can fail completely around a sofa.

在真实房间里,家具会挡住羊群和狗。在空地上能干活的狗,到了沙发旁边可能完全失灵。

Decision决策

Build a deterministic, seedable simulation first, test it over ten seeds per layout, and fix each failure at its root with a test.

先做一个确定性、可指定种子的模拟,每种场景跑十个种子,每个失败都找到根因并补上测试。

Outcome结果

10 of 10 seeds pen all 12 sheep on both the open field and the L-shaped sofa room; 44 EditMode tests pass.

空地和 L 形沙发房间两种场景,10 个种子都把 12 只羊全部赶进围栏;44 个 EditMode 测试通过。

Top-down debug render of the L-shaped sofa room (seed 5). Black: dog. White: sheep. The line is the dog's planned path.L 形沙发房间的俯视调试画面(种子 5)。黑色是狗,白色是羊,线条是狗规划的路线。

How the herd moves羊群怎么动

  1. Sheep羊

    A flocking model from herding research (Strömbom et al. 2014): cohesion with six neighbours, separation, and fleeing pressure that grows as the dog gets closer.

    采用放牧研究中的群体模型(Strömbom 等,2014):和六个邻居聚拢、保持间距,狗越近逃离的压力越大。

  2. Dog狗

    Collects strays, then drives the group toward the pen, unless the player's command overrides it.

    先收拢掉队的羊,再把羊群往围栏赶;玩家下指令时以指令为准。

  3. Room房间

    A 5 cm occupancy grid that knows each body's size, so nothing squeezes through a gap narrower than itself; bodies slide along walls instead of sticking.

    5 厘米一格的占用网格,按身体大小判断能否通过,比身体窄的缝钻不过去;碰到墙会沿墙滑动而不是卡住。

The simulation steps at a fixed 30 Hz and is deterministic for a seed and a command log. A five-second snapshot buffer already supports rewind and fork: go back, give a different command, compare.模拟以固定 30 Hz 步进,给定种子和指令记录结果完全确定。五秒快照缓冲已经支持倒带和分叉:退回去,换一个指令,对比结果。

From 1 in 10 to 10 in 10 around a sofa绕沙发:从 10 次成功 1 次到 10 次全成

The L-shaped room started at 1 success in 10 seeds. Five separate root causes were behind it, and each got a test: pathfinding returned nothing when it started inside an inflated obstacle; the flock's path used twice the sheep radius, so a 0.345 m gap was impassable; the drive point was purely geometric and landed behind the sofa arm; the pen entry point was computed behind the sofa; and "gathered" only checked distance, so a flock split by the sofa arm counted as one group.

L 形房间一开始 10 个种子只成功 1 次。背后有五个独立的根因,每个都补了测试:起点落在障碍膨胀区内时寻路直接返回空;羊群路径用了两倍羊身半径,0.345 米的缝变得过不去;驱赶站位只按几何算,落到了沙发扶手后面;围栏入口点算在了沙发后面;「已聚拢」只看距离,被沙发扶手隔开的两群羊也被当成一群。

The dog's outrun was then planned with A* over a ground cost: cells next to sheep and cells in front of the flock cost more, so the dog goes round behind the flock instead of cutting through it. I first tried the wide arc used in real trials; on the open field it fell to 7 of 10, because in a small room the sheep feel the dog everywhere. A tight, fast pass behind the flock won.

之后狗的绕跑改用 A* 按「地面代价」规划:贴着羊的格子和羊群前方的格子代价更高,狗会从羊群后面绕过去,而不是从中间穿过。我先试了真实比赛里的大弧线绕跑,结果空地成功率掉到 7/10:小房间里羊在哪儿都能感到狗。最后定为紧贴羊群后方快速绕过。

  • Open field: 10 of 10 seeds penned all 12 sheep, 15.8–32.1 s, mean 18.6 s.
  • 空地:10 个种子都把 12 只羊全部赶进围栏,用时 15.8–32.1 秒,平均 18.6 秒。
  • L-shaped sofa room: 10 of 10, 27.4–43.1 s, mean 35.2 s.
  • L 形沙发房间:10 个种子全部成功,用时 27.4–43.1 秒,平均 35.2 秒。

Ten seeds per layout in the Unity EditMode run.Unity EditMode 中每种场景跑 10 个种子。

Tooling and what's next工具与下一步

The core is plain C# with no Unity dependency, so a .NET 9 harness compiles it outside the editor to run ten-seed tables, per-second traces and pathfinding probes in seconds. An editor recorder renders any seed to video. Next: a side-by-side rewind and fork view (M2), then the Quest shell, where the scanned room becomes the occupancy grid and three hand gestures replace the keyboard (M3).

核心是不依赖 Unity 的纯 C#,所以 .NET 9 的离线工具可以在编辑器外编译它,几秒内跑完十个种子的结果表、逐秒轨迹和寻路探针。编辑器录制器可以把任意种子渲染成视频。下一步:倒带与分叉的并排对比视图(M2),然后是 Quest 外壳:扫描到的房间变成占用网格,三个手势代替键盘(M3)。

Open field, seed 3, fully autonomous.空地,种子 3,全自动。