Mark
/
celeste-ai
Archived
1
0
Fork 0

Compare commits

...

4 Commits

Author SHA1 Message Date
Mark 072867a7a3
Fixed minor bug 2023-02-26 14:41:19 -08:00
Mark 938398f9b1
Updated README 2023-02-26 14:41:08 -08:00
Mark 55a8a9d7cf
Added resources readme 2023-02-26 13:11:54 -08:00
Mark 25ad663eec
Disabled human mode 2023-02-26 12:51:57 -08:00
4 changed files with 48 additions and 4 deletions

View File

@ -1,15 +1,37 @@
# Celeste-AI: A Celeste Classic DQL Agent
This is an attempt to create an agent that learns to play Celeste Classic.
This is an attempt to create a deep Q-learning agent that learns to play Celeste Classic.
## Contents
- `./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`.
- `./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`.
- `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
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.
1. `cd` into this directory
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.

View File

@ -52,6 +52,7 @@ class ScreenshotManager:
continue
number += 1
target = self.target / str(number)
else:
target = self.target / str(number)

View File

@ -0,0 +1,21 @@
# 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.

View File

@ -38,7 +38,7 @@ k_dash=5
-- - screenshots at every frame
-- - frame skipping
-- - waiting for input
hack_human_mode = true
hack_human_mode = false
-- If true, disable screensake
hack_no_shake = true