This is a remake of the XBox (and older, using xbox graphics) game of Robotron 2084.
Working on simulating the XBox look and feel in an attempt to train a model and then test it on the console itself.
(See my robotron player)
Insure you have python3 installed and venv. In ubuntu:
sudo apt install python3.11 python3.11-venv
Clone, setup venv, install requirements:
git clone git@github.com:stridera/robotron-2084.git
cd robotron-2084/
python3.11 -mvenv .venv
source .venv/bin/activate
pip install -r requirements.txt
Run the game:
python main.py
Everything is configurable. You can either modify robotron/engine/config.yaml
directly or copy it and provide it to the engine via the config_path
argument. You can use this to change the number of enemies per level, how fast enemies move, or how many bullets/enemies they spawn.
The current one is optimized for machine learning and has some changes from live. (Like, we don't gain extra lives.)
The config.yaml.default
file is as close to the real game as I could make it. Feel free to copy it over to get back those functions.
This was designed to have a similar structure to OpenAI Gym games. It supports the reset()
and step()
functions. You can look at main.py and see how it can be used.
Import the module and create the new env.
Example:
import robotron
level = 1
fps = 30
env = robotron.Robotron(level, fps)
Optional Parameters:
level - Default: 1 Specifies the level to start at. Useful for training a level the agent has a particularly hard time at.
fps - Default: 0 Can be used to slow the game down for human players. 0 makes it play as quick as possible and should be used for computer agents.
Returns Returns an image of the play area.
Resets the environment. Sets the level back to level 1, resets score and lives. Returns an image of the newly reset stage.
Example
image = env.reset()
Play one action on the env.
Parameters:
action - int between 0 and 81 (9 * 9) This should be a integer that combines the two stick controls. You can either have a single agent that outputs 91, or you can have one agent for movement and one for shooting and construct it by doing the following:
action = left * 9 + right
Note: You may wish to restrict this to 8*8 and have your guy always moving and always shooting. There is usually no reason to ever stop and the limited action space may help your model.
Returns:
image, reward, done, info
- Image: Returns the current cropped out play area.
- reward: The current score. Probably want to change this to make it return a better reward.
- done: All lives are exhausted. Game Over.
- info: Returns a list of extra state data:
- score: Current score
- level: Current level
- lives: Lives remaining
- family: Family remaining
- data: List of Tuples containing each sprites X, Y, and name. Related to the play area so 0,0 to obs space.
Example
image, reward, done, info = env.step(action)
- There are no effect yet. You probably want to turn it to grayscale anyway, so it won't matter, but this is a post processing step you should do before sending it to your agent.
- Reward is currently just the score. I'll probably change this later to make it better score related and return score in the info.
- Create a pygame screen and draw the play area square.
- Read the stylesheet and setup sprites.
- Parse the wave info.
- Add the player to the center.
- Allow him to run around and shoot bullets.
- Add Grunts.
- Grunts run toward the player and they move sporadically.
- Grunts speed up as the time advances on a stage.
- Add Electrodes.
- Unlike companion cubes, Electrodes will stab you. Electrodes kill grunts and player.
- Add Family Members.
- Add Hulks.
- Add Brains.
- Add Spheroids.
- Add Enforcers.
- Add Quarks.
- Add Tanks.
- Properly handle rolling over level 40. (Waves restart at 21 and repeat.)
- Add flashing effects similar to in game.
- Add warp-in/warp-out effects.
- Robotron 2084. Developed by Eugene Jarvis and Larry DeMar. Published by Williams Electronics.
- Sprite Sheet and definitions are from Sean Riddle's Ripper page.
- Notes, score info, etc from IGN's Robotron 2084 FAQ