This repo contains a minimal implementation of a 1 vs 1 fighting game. The environment uses minimalistic graphics to maximize performance.
Simply clone this repo into your working directory, move into the main folder and install with pip
git clone https://github.com/fmalato/minimal_fighting_env.git
cd minimal_fighting_env
pip install -e .
The environment uses minimalistic graphics to maximize running and rendering speed.
Players are represented by stacks of red/blue blocks. Health bars are shown on the top part of the window using similar blocks. An attack is shown as a half block. Similarly, a parry is represented by a half block with a lighter shade of red/blue. Whenever a player is stunned, a white bar will appear directly under its health bar. The bar shortens at each time step. Finally, a player that has been hit will flash for some time steps. While flashing, that player is invulnerable.
There are two attacks ("punch" and "kick") and two parries ("high" and "low"). A "punch" can be blocked by a "high" parry, while a "kick" is prevented using a "low" parry.
initial_health: How many hit points each player hasreward_shape: The reward assigned to a player whenever a certain situation occursmax_timesteps: The maximum number of timesteps. Same as base gym argument, just re-defined for simplicityraw_pixel_obs: Flag that decides whether to use an RGB image or internal data as observation
Additionally, some parameters are defined in the __init__() method. You can change them, but I don't recommend doing so.
An agent receives a reward in seven different occasions, namely for winning/losing a fight, hitting an opponent and getting hit, blocking/getting stunned, and a time condition. To specify a reward, you have to specify all the conditions. By default, the reward is specified as follows. To use a custom reward, simply change the values related to each condition.
reward_shape = {
"win": 1.0,
"lose": -1.0,
"hit": 0.0,
"hurt": 0.0,
"block": 0.0,
"stun": 0.0,
"time": 0.0
}
- Each player has
initial_healthHit Points. - If the opponent hits you, you lose 1 Hit Point for a punch, 2 Hit Points for a kick.
- Successfully blocking an incoming attack stuns the opponent for 5 time steps.
- If a stunned player is hit, they are no longer stunned.
- When your Hit Points reach 0, you die.
- Last player standing wins.
You can let two agents play, or you can choose to control player 1. In this case, control your agent with the following keys
[ KEYBOARD ]
--------------------------------------[punch]-----[block high]-----
[move left]----------------------------------- I - O --------------
---- A --- D ---------------------------------- K - L -------------
---------[move right]-------------------[kick]-------[block low]---
-------------------------------------------------------------------
Coming soon
