Skip to main content

Hide-And-Seek Engine (SAR Extension)

SAR Simulation Replay

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: float
  • supports_walking: bool
  • supports_flying: bool
  • supports_aquatic: bool
  • blocking: 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, walking
  • altitude_min, altitude_max
  • base_speed, base_view, battery, deployment_delay
  • rgb
  • terrain_speed dictionary by tile name
  • start ([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 names
  • moves: bool
  • rgb (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..3
    • 0 = no transmit
    • 1,2,3 = transmit channel (merged into shared local knowledge)

Tensor shape for partial obs mode stepping batched env:

  • [num_envs, n_agents, 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:

  • .npy files for all observation/state/action/reward buffers.
  • replay.gif (if --record was used).

Metadata

Release files for hide-and-seek-engine 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hide-and-seek-engine 0.5.0
File Size Uploaded Provenance
hide_and_seek_engine-0.5.0.tar.gz 22.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for hide-and-seek-engine 0.5.0
File Interpreter ABI Platform
hide_and_seek_engine-0.5.0-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details

Total release size: 143.7 kB

Release files / hide_and_seek_engine-0.5.0.tar.gz

Download URL hide_and_seek_engine-0.5.0.tar.gz
Size 22.8 kB
Tags Source
SHA-256 checksum
How to use checksums
e211eeb9fa0a114d92828cb149f4897c23d4aee6ab839070e28b3479ef89cfd0
BLAKE2b-256 checksum
How to use checksums
bcc47f1f9b14c687d5b5647670bdfcccc90b687fc478f431f4587066398e1bd5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.4

Release files / hide_and_seek_engine-0.5.0-cp312-cp312-win_amd64.whl

Download URL hide_and_seek_engine-0.5.0-cp312-cp312-win_amd64.whl
Size 120.9 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
7ad3bdef6a970ae14b68710889337add2ec45b90c63ad8520fd284d4dab2204f
BLAKE2b-256 checksum
How to use checksums
61504e5ffc732c25482aef7a82fb45bb1595ab3e04e0f9e7fdb0280c2d827001
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.4

Security for hide-and-seek-engine 0.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page