Spaces:
Sleeping
Sleeping
Update README.md
Browse files
README.md
CHANGED
|
@@ -9,5 +9,158 @@ app_file: app.py
|
|
| 9 |
pinned: false
|
| 10 |
short_description: Experience the world through an RFT observer agent’s view
|
| 11 |
---
|
|
|
|
| 12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 9 |
pinned: false
|
| 10 |
short_description: Experience the world through an RFT observer agent’s view
|
| 11 |
---
|
| 12 |
+
# RFT Predator Space — Symmetric Observers (First-Person POV)
|
| 13 |
|
| 14 |
+
Experience the world from an RFT “observer agent” perspective inside a predator/prey arena rendered in pseudo-3D. The point is simple and testable: **both agents are symmetric observers co-existing in the same frame**, each with their own viewpoint, heading, and local policy.
|
| 15 |
+
|
| 16 |
+
This Space is intentionally inspectable: deterministic seeds, explicit rules, and no hidden model weights.
|
| 17 |
+
|
| 18 |
+
---
|
| 19 |
+
|
| 20 |
+
## Safety / Accessibility
|
| 21 |
+
**No flashing UI:** the “Map progression” panel is **event-driven** (updates only on reset/catch/load), not updated every timer tick. This prevents flicker that could be unsafe for photosensitive users.
|
| 22 |
+
|
| 23 |
+
---
|
| 24 |
+
|
| 25 |
+
## What this Space is
|
| 26 |
+
A deterministic gridworld where:
|
| 27 |
+
- **Predator** and **Prey** move on the same map.
|
| 28 |
+
- You view the world in **first-person** from the currently selected observer.
|
| 29 |
+
- The other agent is only visible when **line-of-sight + field-of-view** allow it (no “see through walls” cheating).
|
| 30 |
+
- Capture occurs if **Predator and Prey occupy the same cell**.
|
| 31 |
+
|
| 32 |
+
This is not a physics engine. It’s an observer-perception demo that’s easy to replay and verify.
|
| 33 |
+
|
| 34 |
+
---
|
| 35 |
+
|
| 36 |
+
## Core Concept: Symmetric Observers
|
| 37 |
+
Both agents have:
|
| 38 |
+
- position `(x, y)`
|
| 39 |
+
- orientation (E/S/W/N)
|
| 40 |
+
- local behavior rules
|
| 41 |
+
|
| 42 |
+
You can **toggle control** (Pred ↔ Prey) to swap whose “reality” you’re seeing. This is the cleanest way to demonstrate symmetry: neither observer is privileged.
|
| 43 |
+
|
| 44 |
+
---
|
| 45 |
+
|
| 46 |
+
## Modes (Manual / Auto / Hybrid)
|
| 47 |
+
|
| 48 |
+
### Manual (AutoRun OFF)
|
| 49 |
+
- Your button presses drive the currently controlled observer.
|
| 50 |
+
- The non-controlled agent still runs its own policy each step (so the world remains “alive”).
|
| 51 |
+
|
| 52 |
+
### AutoRun + AutoChase (AutoRun ON, AutoChase ON)
|
| 53 |
+
- Predator attempts to **chase** when the prey is within LOS+FOV.
|
| 54 |
+
- Otherwise predator **wanders**.
|
| 55 |
+
- Prey **flees** when not player-controlled.
|
| 56 |
+
|
| 57 |
+
### Hybrid AutoRun (AutoRun ON, AutoChase OFF)
|
| 58 |
+
- Predator **wanders autonomously** (no pursuit logic).
|
| 59 |
+
- Prey still **flees**.
|
| 60 |
+
- This demonstrates two independent observers operating in the same frame without collapsing into a single “predator narrative.”
|
| 61 |
+
|
| 62 |
+
**Important:** AutoRun moves the **current POV observer** (autopilot). If you’re viewing Predator POV, Predator moves under AutoRun. If you’re viewing Prey POV, Prey runs its flee autopilot.
|
| 63 |
+
|
| 64 |
+
---
|
| 65 |
+
|
| 66 |
+
## Rendering / “Seeing” Rules (First-Person POV)
|
| 67 |
+
The pseudo-3D view uses grid raycasting to draw walls and depth. The other agent only appears if:
|
| 68 |
+
1) **Line-of-sight** between the agents is clear
|
| 69 |
+
2) The target is within the observer’s **field-of-view**
|
| 70 |
+
3) The target is not hidden behind a closer wall slice (**occlusion**)
|
| 71 |
+
|
| 72 |
+
Result: the observer can’t see through walls, and perception is honest.
|
| 73 |
+
|
| 74 |
+
---
|
| 75 |
+
|
| 76 |
+
## Controls
|
| 77 |
+
|
| 78 |
+
### Movement (applies to the currently controlled observer)
|
| 79 |
+
- **Turn Left**
|
| 80 |
+
- **Forward**
|
| 81 |
+
- **Turn Right**
|
| 82 |
+
|
| 83 |
+
### Observer / Autonomy
|
| 84 |
+
- **Toggle Control (Pred ↔ Prey)**
|
| 85 |
+
Switches camera + manual input to the other observer.
|
| 86 |
+
|
| 87 |
+
- **Toggle AutoRun**
|
| 88 |
+
Enables autonomous ticking (timer based).
|
| 89 |
+
|
| 90 |
+
- **Toggle AutoChase**
|
| 91 |
+
Only affects predator behavior under AutoRun:
|
| 92 |
+
- ON → chase policy (LOS + FOV) with roam fallback
|
| 93 |
+
- OFF → wander-only policy (Hybrid mode)
|
| 94 |
+
|
| 95 |
+
- **Tick**
|
| 96 |
+
Single deterministic step (useful for inspection and debugging).
|
| 97 |
+
|
| 98 |
+
### Symmetry tools
|
| 99 |
+
- **Swap Roles (Pred ⇄ Prey)**
|
| 100 |
+
Swaps positions and orientations. This is a “symmetry hammer” that makes it obvious both observers are equivalent in the frame.
|
| 101 |
+
|
| 102 |
+
### Optional overlay (kept subtle)
|
| 103 |
+
- **Toggle Overlay**
|
| 104 |
+
Displays faint “disturbance/coherence” visualization. It’s off by default to keep the base experience clean.
|
| 105 |
+
|
| 106 |
+
---
|
| 107 |
+
|
| 108 |
+
## Map Progression + Unlocks
|
| 109 |
+
Maps unlock as you accumulate catches. The map list shows:
|
| 110 |
+
- ✅ unlocked maps
|
| 111 |
+
- 🔒 locked maps and required catch count
|
| 112 |
+
|
| 113 |
+
Unlocks update only when something actually changes (reset/catch/load) to avoid flicker.
|
| 114 |
+
|
| 115 |
+
---
|
| 116 |
+
|
| 117 |
+
## Save / Load
|
| 118 |
+
Two supported workflows:
|
| 119 |
+
|
| 120 |
+
### Slot saves (server-side)
|
| 121 |
+
- Saves are written to `./saves/*.json`
|
| 122 |
+
- Dropdown lists existing saves (Refresh if needed)
|
| 123 |
+
|
| 124 |
+
### Export / Import (portable)
|
| 125 |
+
- Export produces a downloadable JSON save file
|
| 126 |
+
- Import lets you upload the save later to resume exactly
|
| 127 |
+
|
| 128 |
+
Saved state includes:
|
| 129 |
+
- seed, map name
|
| 130 |
+
- positions and orientations
|
| 131 |
+
- control target (Pred/Prey)
|
| 132 |
+
- mode toggles (AutoRun, AutoChase, overlay)
|
| 133 |
+
- catches (and therefore unlocked maps)
|
| 134 |
+
|
| 135 |
+
---
|
| 136 |
+
|
| 137 |
+
## Determinism / Reproducibility
|
| 138 |
+
Runs are deterministic given:
|
| 139 |
+
- the **Seed**
|
| 140 |
+
- the same sequence of actions / ticks
|
| 141 |
+
|
| 142 |
+
Autonomy uses deterministic RNG streams derived from seed + step index, so:
|
| 143 |
+
- same seed + same choices = same behavior
|
| 144 |
+
|
| 145 |
+
This is crucial for verification and repeatable demos.
|
| 146 |
+
|
| 147 |
+
---
|
| 148 |
+
|
| 149 |
+
## Files
|
| 150 |
+
- `app.py` — single-file Space for simplicity
|
| 151 |
+
- `saves/` — created automatically for slot saves
|
| 152 |
+
|
| 153 |
+
---
|
| 154 |
+
|
| 155 |
+
## Requirements
|
| 156 |
+
Minimal dependencies:
|
| 157 |
+
gradio
|
| 158 |
+
numpy
|
| 159 |
+
|
| 160 |
+
---
|
| 161 |
+
|
| 162 |
+
---
|
| 163 |
+
|
| 164 |
+
## Notes
|
| 165 |
+
This Space is designed to be inspectable and falsifiable at the “game rules” level: you can see exactly what the observer can see, why it turns, and when it commits to action.
|
| 166 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|