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