Compare commits
No commits in common. "072867a7a363aa8f31338da6cbde67e958e19b23" and "4171fefb00c12fffc5d67e7e3a84bdf842efe3de" have entirely different histories.
072867a7a3
...
4171fefb00
|
@ -1,37 +1,15 @@
|
||||||
# Celeste-AI: A Celeste Classic DQL Agent
|
# Celeste-AI: A Celeste Classic DQL Agent
|
||||||
|
|
||||||
This is an attempt to create a deep Q-learning agent that learns to play Celeste Classic.
|
This is an attempt to create an agent that learns to play Celeste Classic.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Contents
|
## 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 called `hackcel.p8`.
|
- `./resources`: contain files these scripts require. 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 called `hackcel.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 in `model_data/current/plots/`.
|
|
||||||
|
|
||||||
|
|
||||||
## Setup
|
## Setup
|
||||||
|
|
||||||
Before you set up Celeste-AI, you need to prepare PICO-8. See [`resources/README.md`](./resources/README.md)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
This is designed to work on Linux. You will need `xdotool` to send keypresses to the game.
|
This is designed to work on Linux. You will need `xdotool` to send keypresses to the game.
|
||||||
|
|
||||||
1. `cd` into this directory
|
1. `cd` into this directory
|
||||||
2. Make and enter a venv
|
2. Make and enter a venv
|
||||||
3. `pip install -e .`
|
3. `pip install -e .`
|
||||||
|
|
||||||
Once you're set up, you can...
|
|
||||||
- `python celeste_ai/train.py` to train a model
|
|
||||||
- `python plot.py` to make prediction plots
|
|
||||||
- `python 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 inside `train.py`
|
|
||||||
- `screenshots`: contains subdirectories. Each subdirectory contains the frames of one episode. Use `ffmpeg.sh` to turn these into a video.
|
|
||||||
- `plots`: generated by `plot.py`. Contains pretty plots.
|
|
|
@ -52,7 +52,6 @@ class ScreenshotManager:
|
||||||
continue
|
continue
|
||||||
number += 1
|
number += 1
|
||||||
|
|
||||||
target = self.target / str(number)
|
|
||||||
else:
|
else:
|
||||||
target = self.target / str(number)
|
target = self.target / str(number)
|
||||||
|
|
||||||
|
|
|
@ -1,21 +0,0 @@
|
||||||
# Celeste-AI resources
|
|
||||||
|
|
||||||
- `./carts/celeste.p8`: Unmodified *Celeste Classic* cart
|
|
||||||
- `./carts/hackcel.p8`: *Celeste Classic* modified with delays and debug
|
|
||||||
- `./pico8`: An old version of PICO-8
|
|
||||||
- `./images`: Miscellaneous images for pretty plots. Not used by scripts yet.
|
|
||||||
|
|
||||||
|
|
||||||
## PICO-8 setup
|
|
||||||
1. Run `./pico-8/linux/pico8`
|
|
||||||
2. Once it starts, type `folder`. This will open the PICO-8 root folder in your file browser.
|
|
||||||
3. Copy both carts in `./carts` into that folder.
|
|
||||||
|
|
||||||
## PICO-8 basics
|
|
||||||
- `load name.p8`: load a game into memory
|
|
||||||
- `run`: run that game
|
|
||||||
- `folder`: open PICO-8 root in file browser
|
|
||||||
- `shutdown`: exit PICO-8
|
|
||||||
- `<escape key>`: toggle editor or exit a game.
|
|
||||||
|
|
||||||
That's all you need to know to train Celeste-AI.
|
|
|
@ -38,7 +38,7 @@ k_dash=5
|
||||||
-- - screenshots at every frame
|
-- - screenshots at every frame
|
||||||
-- - frame skipping
|
-- - frame skipping
|
||||||
-- - waiting for input
|
-- - waiting for input
|
||||||
hack_human_mode = false
|
hack_human_mode = true
|
||||||
|
|
||||||
-- If true, disable screensake
|
-- If true, disable screensake
|
||||||
hack_no_shake = true
|
hack_no_shake = true
|
||||||
|
|
Reference in New Issue