Unity Play Harness: Install, Source and Security

Unity Play Harness

Published by tipoli5890 in game-studio

Review recommended18 installs

What this skill does

>-

Add Unity Play Harness to your agent

Review the source and files first. When you are ready, copy the prompt instruction or use the CLI command supported by your environment.

Install with a prompt

Paste this into a compatible coding agent:

add this skill "unity-play-harness" from https://github.com/tipoli5890/game-studio

Install with the CLI

Run this command in a controlled environment after reviewing the repository:

npx skills add https://github.com/tipoli5890/game-studio --skill unity-play-harness

Skill instructions

unity-play-harness — build the game so an agent can play it and read it

A game an agent cannot drive is a game that gets checked once, by hand, by whoever happens to be at the keyboard. The work here is not testing; it is making the game observable and reachable so that everything else — a verification, a measurement, an answer to a complaint — becomes cheap enough to do on every change.

Load what the situation needs

The situationRead
"Playtest this"; a journey test — does the runner reach the gate, every runthe four parts below, then reference/journeys.md
Designing the one-line snapshot; a value you need is not in it; reading it from eval, a command, the log or a testreference/probe-contract.md
"boot straight into the boss"; "how would a test reach this screen"; a wait that times outreference/situations.md
Writing the test that drives and samples; which invariants are worth asserting over a runreference/journeys.md
A screenshot pass over every situation; situations that must not write the player's saves; the same ids in a built playerreference/situations.md → "A shot list over every situation"
A match that has to play itself; an autoplayer through the real input funnel; the smoke run that rides on itreference/situations.md → "the autoplayer" · reference/journeys.md → "The autoplayer smoke run"
Reading, comparing or handing over a recorded runreference/timeline-format.md
A feel report with no number in it — "comes in too fast", "disappears while it loads", "looks inconsistent", "I can't measure what the player felt"; deciding what stays a human judgementreference/complaint-to-test.md
Minutes of random but plausible input over every situation; a seed that replays a red runreference/soak.md · templates/SoakTest.cs
What to build first, where a threshold comes from, simulation/presentation splitunity-game-brief
A results file you are about to believe; exit codes; state leaking between runsunity-debug → reference/harness-trust.md
Running the suite headless: -runTests, test filters, tests not foundunity-debug → reference/cli-harness.md
Driving a live Editor, unity command, Safe Modeunity-debug → reference/editor-control.md
Needing to SEE the moment: windowed runs, settle time, reading the pixelsunity-debug → reference/visual-checks.md

Copy resources/GameProbe.cs, resources/GameProbeReporter.cs, resources/Situations.cs, resources/SituationBoot.cs and resources/JourneyRecorder.cs into a Runtime assembly, resources/Editor/ProbeCommands.cs into an Editor one, and start from templates/CourierSituations.cs and templates/JourneyTest.cs. A 2D game starts from templates/CourierSituations2D.cs instead and adds resources/JourneyInvariants2D.cs, which is a separate file so that a project without the 2D physics module still compiles the rest.

Four parts, each with a condition that says it is actually there:

PartDone when
Probeunity command eval 'return GameProbe.Json();' returns one line carrying state, pos, ready{} and allReady
SituationsSituations.Ids() lists at least one id, and every one of them declares a readiness set
Journeysone [UnityTest] writes timeline.jsonl, logs [JOURNEY] … samples=N, and scripts/journey_report.py prints violations=0
Complaint → testthe last feel report has a situation, a sampled quantity, a threshold with a source, and a before/after table

None of it is instrumentation to delete afterwards. GameProbe and Situations ship with the game, because the next complaint arrives after the debug component was removed.


Readiness is a set, not a flag

The single most expensive shape of bug here, and the reason situations wait on a set:

The visible ground, its collider and the hazard volume must become ready in the same pass. When they do not, the game looks finished and is not — the runner is drawn on a lane it can fall through, and the bug reproduces once in ten runs.

So: list every member the moment needs, make each one a predicate that is re-evaluated on every poll, and wait until they are all true with a timeout that names the ones still missing.

[SITUATION] TIMEOUT approach-gate not ready after 15.0s: laneCollider, sentry

Never yield return new WaitForSeconds(3f). A sleep that is long enough today is a flake next month, and when it fails it tells you only that three seconds passed.


The probe contract in one screen

KeyWhat it is
schema · frame · t · ut · dt · timeScaleVersion, and the clock in both scales — a timeScale of 0 explains most "it froze" reports
scene · situation · state · camWhere the game is, and which moment it was told to be in; a null cam explains a black screenshot
pos · vel · speedThe player: transform.position, and velocity from the delegate given to SetPlayerVelocity (a 2D body, a CharacterController, a motor, a grid mover), else Rigidbody.linearVelocity, else the position delta
ready{} · allReadyEvery readiness member, re-evaluated this frame
counts{} · custom{}Named ints, and the handful of game-specific numbers a complaint could be about
batch · playingWhich instrument produced the line, and whether the game was running at all

Two hooks put anything else in there, and both take a delegate rather than a value — a delegate cannot go stale, a cached bool can:

GameProbe.Ready("laneCollider", () => _lane != null && _lane.Collider.enabled);
GameProbe.Register("gateDist", () => Vector3.Distance(_runner.position, _gate.position));

state comes from the game's own state machine, through SetState(() => _run.Phase.ToString()). A probe holding its own copy starts lying on exactly the day the two diverge — which is the day something is broken.


Discipline

  • The probe reads. It never writes. No flag setting, no spawning, no state advancing. A probe that changes the run cannot be trusted about the run.
  • Enter calls the game's own transition. Assigning Phase = Approach produces the right label with none of the work done, and readiness then passes on an empty moment.
  • Readiness members are predicates, re-evaluated on every poll — never a bool set during a load that may have been cancelled. An empty set reads as not ready.
  • Wait on the set, with a timeout, on unscaled time. A situation that sets timeScale to 0 must still time out instead of hanging the suite.
  • Sample in Update. WaitForEndOfFrame never resumes in batch mode, so a journey that samples there records everything windowed and nothing headless.
  • Assert transitions and bounds, not absolute values. speed < 12 within 2 units of the gate survives the next tuning pass; speed == 9.8 fails it. Print the absolute numbers underneath.
  • Assert the sample count first. samples=0 makes every other assertion iterate an empty list and pass — a green test that checked nothing.
  • Delete the journey directory before every run. A half-overwritten timeline next to last run's screenshots reads as one run and describes neither.
  • The human keeps the feel verdict. The harness proves a number moved where it was aimed; it cannot prove the game feels better, so the report back ends with a question.
  • Ship the probe, gate the logging. GameProbe and Situations stay in a Runtime assembly; GameProbeReporter disables itself unless Debug.isDebugBuild || Application.isEditor, so a release player carries the probe and prints nothing; the commands are Editor-only.

Scope — what this skill does NOT do

Not hereGo to
Running Unity, exit codes, screenshots, verifying a fix, trusting a run, proving the harness is honestunity-debug
Frame-time counters, draw calls, GC, a before/after table of numbersunity-profiling
The brief, the constraints, which interaction to build firstunity-game-brief
Installing editors, licences, templates, the CLI's own surfaceunity-cli
Assembly definitions, folder layout, which Editor version the project is pinned tounity-new-project
A collision or trigger that never fires, a raycast that missesunity-physics-3d · unity-physics-2d
Building the UI rather than reaching a screen of itunity-game-ui
Which controller, camera or movement model a game needs, by perspectiveunity-gameplay
Reading input through one funnel a journey can driveunity-input
The same observability on a real phone: a probe scene read through logcat or the iOS consoleunity-device-testing

Files included

  • reference/complaint-to-test.md
  • reference/journeys.md
  • reference/probe-contract.md
  • reference/situations.md
  • reference/soak.md
  • reference/timeline-format.md
  • resources/Editor/ProbeCommands.cs
  • resources/GameProbe.cs
  • resources/GameProbeReporter.cs
  • resources/JourneyInvariants2D.cs
  • resources/JourneyRecorder.cs
  • resources/SituationBoot.cs
  • resources/Situations.cs
  • scripts/journey_report.py
  • scripts/probe.py
  • SKILL.md
  • templates/CourierSituations.cs
  • templates/CourierSituations2D.cs
  • templates/JourneyTest.cs
  • templates/SoakTest.cs

More skills