High-performance batched multi-agent environment
Project description
Hide-And-Seek Engine (SAR Extension)
High-performance OpenMP + pybind11 grid-world simulator for heterogeneous Search and Rescue (SAR), with:
- CTDE-ready tensors (
C x H x W) for CNN extractors - Hybrid action space (
move+radio) - PettingZoo parallel API adapter
- Local/POV rendering utilities
Install
pip install -e .
Optional rendering/input dependencies:
pip install pygame pillow pettingzoo imageio
Level File Formats
test_level/tiles.json
Either list or name->object map. Each tile supports:
rgb:[r, g, b]altitude: floatsupports_walking: boolsupports_flying: boolsupports_aquatic: boolblocking: bool
Movement semantics:
- Agent can enter tile when it matches at least one supported transport mode.
- If transport does not match:
blocking=true: tile behaves like wall (entry denied, agent not stuck)blocking=false: agent can enter but becomes stuck
test_level/agents.json
Either list or name->object map. Each agent supports:
flying,aqueous,walkingaltitude_min,altitude_maxbase_speed,base_view,battery,deployment_delayrgbterrain_speeddictionary by tile namestart([y, x], supports normalized[0..1]or map coords)
test_level/survivors.json
Either list or name->object map. Each survivor supports:
allowed_savers: list of agent namesmoves: boolrgb(optional)start(optional)
test_level/level.png
PNG map where every pixel is matched to nearest tile rgb in tiles.json.
Core Environment Usage
from hide_and_seek_engine.env_wrapper import SARBatchedGridEnv
env = SARBatchedGridEnv(
num_envs=8,
map_png="test_level/level.png",
tiles_json="test_level/tiles.json",
agents_json="test_level/agents.json",
survivors_json="test_level/survivors.json",
map_size=32,
seed=42,
)
obs, info = env.reset()
actions = env.action_space.sample()
obs, rewards, terminated, truncated, info = env.step(actions)
state = env.state() # global CTDE state
Observation Space (Local Actor Input)
obs is a dictionary:
obs["spatial"]: shape[Env, Agent, C_local, H, W]- channels include terrain+altitude, local survivor layer, local obs mask, local agent layers
obs["internal"]: shape[Env, Agent, 6][deploy_remaining, stuck, view_range, battery, y, x]
State Space (Central Critic Input)
env.state() returns:
state["spatial"]: shape[Env, C_global, H, W]state["internal"]: flattened agent+survivor internal vectors
Action Space (Hybrid)
Per agent action:
- movement: 2D vector in
[-1, 1] - radio: discrete channel
0..30= no transmit1,2,3= transmit channel (merged into shared local knowledge)
Tensor shape for stepping batched env:
[num_envs, 4, 3](dy,dx,radio_channel)
Rendering
- Global view:
env.render(env_idx=0)- undiscovered tiles are drawn at half RGB brightness
- saved survivors are white
- Agent POV:
env.render_pov(agent_idx=0, env_idx=0)- allies and survivors shown using last-known positions
- knowledge updates when locally seen or shared by radio
Print radio events from current frame:
env.radio_render()
PettingZoo Parallel API
from hide_and_seek_engine.env_wrapper import SARParallelPettingZooEnv
pz_env = SARParallelPettingZooEnv(
map_png="test_level/level.png",
tiles_json="test_level/tiles.json",
agents_json="test_level/agents.json",
survivors_json="test_level/survivors.json",
)
obs, infos = pz_env.reset()
actions = {
agent: {"move": [0.0, 1.0], "radio": 1}
for agent in pz_env.agents
}
obs, rewards, terminations, truncations, infos = pz_env.step(actions)
Test & Benchmark Suite
Run unit checks + 10k-step stress tests + FPS measurements + renderer smoke test:
python env_spec.py --steps 10000 --envs 1 2 4 8
Skip renderer test:
python env_spec.py --steps 10000 --envs 1 2 4 8 --skip-render
Human Data Recorder
Collect SARSA tuples from one human-controlled random agent each episode:
python human_runner.py
To record a visual replay of the session:
python human_runner.py --record
Controls:
- movement:
W,A,S,D - radio:
1,2,3
After each episode, enter a save name. Data is written to saved_human_behavior/<name>/, containing:
.npyfiles for all observation/state/action/reward buffers.replay.gif(if--recordwas used).
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hide_and_seek_engine-0.2.8.tar.gz.
File metadata
- Download URL: hide_and_seek_engine-0.2.8.tar.gz
- Upload date:
- Size: 21.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f6959b0a6dcb2e4bf77a4b1d0be1a5b8798acaf02f4121a01c63bd102b3d2ed5
|
|
| MD5 |
8370b415b7362a5ca180ad5a73f5dab4
|
|
| BLAKE2b-256 |
821bf6563589539c13319632b19e18e474bfc076de859b1187e742c86530d795
|
File details
Details for the file hide_and_seek_engine-0.2.8-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: hide_and_seek_engine-0.2.8-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 132.6 kB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6fddb9fe5b04c784355e39f9f5049434abe32f4e4e5af4bd4ee3caa2b63c15ec
|
|
| MD5 |
2d781e75a82945505cd52be263fc8457
|
|
| BLAKE2b-256 |
5dfcc505f48a39965bbfc15f67aed92977e6a54f7816704e8977e71581e69254
|