Project Plateau
Project Plateau: four glass plates, one living valley, and the road back to camp.
翻訳待ち
No updates detected yet. GitHub releases will appear here.
Loading the full README. The saved excerpt is shown below.
Two fleets of five triangle ships fight it out in an Asteroids-style arena.
• Watch it in the browser: https://crunchy000.github.io/astorids/ (index.html, scripted AI on both sides). It has synthesised sound effects (lasers, hits, explosions, asteroid thuds, panned by position): press any key to start audio, and M to mute.
• Train agents in Python: astroids_gym, a Gymnasium (the maintained successor to OpenAI Gym) and PettingZoo port of the same game.Read the full README ↗Two fleets of five triangle ships fight it out in an Asteroids-style arena.
index.html, scripted AI on both sides). It has synthesised sound effects (lasers, hits, explosions, asteroid thuds, panned by position): press any key to start audio, and M to mute.astroids_gym, a Gymnasium (the maintained successor to OpenAI Gym) and PettingZoo port of the same game.competition/ runs the game as an AI competition in the Planet Wars RTS format: Docker entries that fly a team over a WebSocket, real-time matches with random settings, and a TrueSkill leaderboard.planetwars/ is our entry for the Planet Wars RTS game itself, trained with JAX on a GPU. It has its own code, tests and Dockerfile and doesn't touch the asteroids game. Play against it in the browser: https://crunchy000.github.io/astroids/planetwars/play/ (the entry ported to JavaScript and WebAssembly, see planetwars/play/).Two rule sets, the same in the browser (press C to switch, or ?rules=classic) and in Python (Config() / Config.competitive()):
The bots contest the zone when no enemy is near. For agents, ObsConfig(extended=True) adds 32 observation inputs for the rules (heat, zone position and control, score lead, respawns and ships left, time remaining, nearby teammates' bullets), and RewardConfig has zone, friendly_hit, win and crash (dying to an asteroid or a ram, on top of death) terms.
pip install -e . # core env: gymnasium + numpy
pip install -e ".[render]" # + pygame for render_mode="human" / "rgb_array"
pip install -e ".[multiagent]" # + pettingzoo for the multi-agent env
pip install -e ".[train]" # + stable-baselines3 + torch for the example trainer
pip install -e ".[video]" # + pygame + imageio/ffmpeg for MP4 recording
You fly one blue ship. The other nine are flown by the built-in scripted bot, the same AI the web page uses, unless you swap in other policies.
import gymnasium as gym
import astroids_gym # registers the env
env = gym.make("AsteroidsBattle-v0", render_mode="human")
obs, info = env.reset(seed=0)
for _ in range(1800):
obs, reward, terminated, truncated, info = env.step(env.action_space.sample())
if terminated or truncated:
obs, info = env.reset()
| Action | MultiDiscrete([5, 2, 2]) = (turn: full left / slow left / none / slow right / full right, thrust off/on, fire off/on). The slow turns give the fine aim control the bot gets from steering continuously. |
| Observation | Box(-1, 1, (160,)), relative to your ship: your own velocity, heading, HP, cooldown; the 5 nearest enemies (position, relative velocity, relative heading, HP, and the lead direction, i.e. where to point so a shot fired now hits); the 4 nearest allies (the same without lead); the 8 nearest enemy bullets; the 5 nearest asteroids. Empty slots are zero, and each slot has a "present" flag. Details are in astroids_gym/obs.py. |
| Reward | +1 kill, −1 death, +0.2 hit dealt, −0.2 hit taken, plus optional aim shaping (below). All set with RewardConfig. |
| Episode | Ships respawn, so an episode ends only at max_steps (default 1800 agent steps = 60 s of game time). terminate_on_death=True gives shorter episodes. |
| Timing | Physics runs at 60 Hz; the agent acts every frame_skip=2 ticks (30 Hz). |
Useful kwargs: teammates= / opponents= take "scripted", "idle", "random" or a callable, so you can do self-play against frozen policies. A callable gets one batch of observations for all the ships it flies, shape (n, 160), and returns (n, 3) actions, so an SB3 model plugs straight in: opponents=lambda obs: model.predict(obs)[0]. You can also pass config=Config(asteroids=False, team_size=3, ...), reward_config=RewardConfig(...) and obs_config=ObsConfig(...). env.step(None) lets the built-in bot fly your ship, which gives a baseline in exactly the same seat.
This is the beginning of the README. Read the rest at the original. Read the full README ↗