Skip to main content

A custom RL environment with C++ backend and Gymnasium wrapper.

Project description

Hybrid Shoot Environment

This environment is designed as a sanity check for reinforcement learning with hybrid action spaces (discrete + continuous). It supports both Gymnasium (single agent with hybrid actions) and PettingZoo (multi-agent decomposition).

There are num_enemies enemies in a 2D space. The goal is to Jam and Shoot them.

Installation

pip install .

Gymnasium Usage

The Gymnasium environment presents a single agent with a Tuple action space.

from hybrid_shoot import HybridShootEnv

env = HybridShootEnv()
obs, info = env.reset()
# Action: (Jam_Target_Index, [Shoot_X, Shoot_Y])
action = (0, [0.5, 0.5]) 
obs, reward, done, truncated, info = env.step(action)

Action Space (Gymnasium)

A spaces.Tuple containing:

  1. Jam: Discrete(num_enemies) - Selects which enemy to jam.
  2. Shoot: Box(low=0, high=map_size, shape=(2,)) - [x, y] coordinates to shoot at.

PettingZoo Usage

The PettingZoo environment decomposes the task into two cooperating agents.

from hybrid_shoot import HybridShootPettingZooEnv

env = HybridShootPettingZooEnv()
observations, infos = env.reset()

Agents & Action Spaces (PettingZoo)

  1. jammer: Discrete(num_enemies) - Selects which enemy to jam. (jammed enemy does not cause negative reward this turn)
  2. shooter: Box(low=0, high=map_size, shape=(2,)) - Selects the [x, y] coordinates to shoot.

Game Mechanics

Jamming: Stops the targeted enemy from dealing damage this turn. Shooting: Fires at location (x, y).

  • Standard Mode (independent_mode=False): An enemy must be jammed to be vulnerable to being shot. Shooting an unjammed enemy does nothing.
  • Independent Mode (independent_mode=True): Jamming prevents damage, and Shooting kills enemies regardless of whether they are jammed.

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

hybrid_shoot-0.2.0.tar.gz (23.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hybrid_shoot-0.2.0-cp312-cp312-win_amd64.whl (111.6 kB view details)

Uploaded CPython 3.12Windows x86-64

File details

Details for the file hybrid_shoot-0.2.0.tar.gz.

File metadata

  • Download URL: hybrid_shoot-0.2.0.tar.gz
  • Upload date:
  • Size: 23.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.6

File hashes

Hashes for hybrid_shoot-0.2.0.tar.gz
Algorithm Hash digest
SHA256 c7d8bdf5d88e136cde88d0b518f2560569a69374d7c4ebd50b24cdd9e75c01fc
MD5 fba9327e0e299d57d94e9139006dbc67
BLAKE2b-256 a353dd8baac4ac6712e82b8cf2e452abcb43f25ed1e7b6494f0efc7ca5dfaa91

See more details on using hashes here.

File details

Details for the file hybrid_shoot-0.2.0-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for hybrid_shoot-0.2.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 850073c81c77f33df88864a439c961e6e32937da42e1be714e3cea7d7a293856
MD5 a4d2c0ee7da9fd5ad784fdb650a4fd5b
BLAKE2b-256 dcaaeb473801dcfb118532e0daec572b76c817dd4f546025ba01f7edce9bb5bb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page