Mark 5242c7443c | ||
---|---|---|
celeste_ai | ||
report | ||
resources | ||
.editorconfig | ||
.gitignore | ||
README.md | ||
ffmpeg.sh | ||
plot.py | ||
pyproject.toml |
README.md
Celeste-AI: A Celeste Classic DQL Agent
This is an attempt to create a deep Q-learning agent that automatically solves the first stage of Celeste Classic.
A gif of the result is below. This took 4000 episodes, which amounts to about 30 hours of training time.
Contents
./resources
: contains files this script requires. Notably, we have an (old) version of PICO-8 that's known to work with this script, and a version of Celeste Classic with telementery and delays calledhackcel.p8
.ffmpeg.sh
: uses game screenshots to make real-time video of the agent's attempts. Read the script, it's pretty simple.plot.py
: generates plots from model snapshots. These are placed inmodel_data/current/plots/
.
Setup
Before you set up Celeste-AI, you need to prepare PICO-8. See resources/README.md
This is designed to work on Linux. You will need xdotool
to send keypresses to the game.
cd
into this directory- Make and enter a venv
pip install -e .
Once you're set up, you can...
python celeste_ai/train.py
to train a modelpython plot.py
to make prediction plotspython test.py
to test a model
Before running, be aware of the following:
- Only one instance of PICO-8 can be running at a time. See
celeste.py
. hackcel.p8
captures a screenshot of every frame. PICO-8 will probably place these on your desktop. Since this repo contains a rather old version of PICO-8, there is no way to change where it places screenshots.train.py
will delete, move, and rename screenshots automatically during training, but you should tell it where your desktop is first.- When you start training, a
model_data
directory will be created. It contains the following:model_archive
: history of the model. Save interval is configured insidetrain.py
screenshots
: contains subdirectories. Each subdirectory contains the frames of one episode. Useffmpeg.sh
to turn these into a video.plots
: generated byplot.py
. Contains pretty plots.