- My very own NEAT framework in C++ (it's v3 on the NES) : [v1. BASE] - [v2. SFML] - [v3. EMUL]
- The NeuroEvolution of Augmenting Topologies (NEAT) User Page : http://www.cs.ucf.edu/~kstanley/neat.html
- Nintaco API - NES / Famicom emulator and game RAM manipulation in C : https://nintaco.com/api.html
- AI learns to play SMB using GA and NN : https://chrispresso.io/AI_Learns_To_Play_SMB_Using_GA_And_NN
- Super Mario Bros. JU PRG0 ! ram map : https://datacrystal.romhacking.net/wiki/Super_Mario_Bros.:RAM_map
cd bin
1. Execute program : $ <cmd>
2. Connect Nintaco : Tools > Start Program Server... > Start Server
3. Disconnect : Stop Server or Ctrl+C
./make.sh
or
OPT=$(dirname $(pwd))'/opt/'
sudo apt-get update
sudo apt-get install g++ cmake libsfml-dev valgrind libgtest-dev wmctrl
cd /usr/src/gtest
sudo cmake CMakeLists.txt
sudo make
sudo cp -v lib/*.a /usr/lib
cd "${OPT}"'java'
sudo rm -rv *
wget -O jre-8uLatest-linux-x64.tar.gz https://javadl.oracle.com/webapps/download/AutoDL?BundleId=247127_10e8cce67c7843478f41411b7003171c
tar zxvf jre-8uLatest-linux-x64.tar.gz
rm -v jre-8uLatest-linux-x64.tar.gz
mv -v jre1.8* jre1.8.0_latest
cd "${OPT}"'nintaco'
if [ -d "Nintaco_bin_2020-05-01" ]; then rm -rv Nintaco_bin_2020-05-01; fi
unzip Nintaco_bin_2020-05-01.zip
./app.sh
or
$ ./build.sh -R
$ ./compile.sh
$ ./run.sh -m train -k n -l 1_1 -g 0 -t 0 -n 1 -p plt1_1 -s sav1_1
$ ./run.sh -m eval -k n -l 1_1 -e 10 -t 0 -n 0 -s sav1_1
./train.sh [-D -R] <args>
or
* Debug : $ ./train.sh -D -k n -l 1_1 -g 0 -t 0 -n 1 -p plt1_1 -s sav1_1
* Release : $ ./train.sh -R -k n -l 1_1 -g 0 -t 0 -n 1 -p plt1_1 -s sav1_1
./eval.sh [-D -R] <args>
or
* Debug : $ ./eval.sh -D -k n -l 1_1 -e 10 -t 0 -n 0 -s sav1_1
* Release : $ ./eval.sh -R -k n -l 1_1 -e 10 -t 0 -n 0 -s sav1_1
./play.sh [-D -R] <args>
or
* Debug : $ ./play.sh -D -k y -l 1_1 -e 10
* Release : $ ./play.sh -R -k y -l 1_1 -e 10
./test.sh [-D -R] <args>
or
* Debug : $ ./test.sh -D
* Release : $ ./test.sh -R
./memcheck.sh <cmd>
* Example : $ ./memcheck.sh ./train.sh -g 10
* Example : $ ./memcheck.sh ./eval.sh -s sav
./log.sh [-V] <cmd>
* Example : $ ./log.sh ./train.sh -s sav
* Example : $ ./log.sh -V ./play.sh -e 1
./readme.sh
* Update : $ ./readme.sh
./help.sh
usage: apps/exec [-h] [-m MOD] [-k KEY] [-l LVL] [-g GEN] [-e EPO] [-t STP] [-n NOP] [-p PLT] [-s SAV]
NEAT SuperMorIA
optional args:
-h Print help and exit
-m MOD Set mode < train | eval | play | test >
-k KEY Set keyboard sfml < y | n >
-l LVL Set load state file level lvl
params:
-g GEN [train] Set number generation (0=inf)
-e EPO [eval, play] Set number epoch (0=inf)
-t STP [train, eval] Set number max step (0=inf)
-n NOP [train, eval] Set number max noop (0=inf)
utils:
-p PLT [train] Set file name plot plt
-s SAV [train, eval] Set file name save sav
keys:
X [play] Button A (? set)
Z [play] Button B (? set)
Up [play] Button Up (? set)
Down [play] Button Down (? set)
Left [play] Button Left (? set)
Right [play] Button Right (? set)
Space [play] Button Start (? set)
Enter [play] Button Select (? set)
D [train, eval] (Debug) Ai view
./emul.sh
* Start : $ ./emul.sh
include/env/conf.hpp
* HYPERPARAMETER VALUES :
INPUTS = 93
OUTPUTS = 3
LIM_HIDDEN = 1000000
MUTATE_WEIGHT_RATE = 0.1f
MUTATE_GENE_RATE = 0.25f
MUTATE_LINK_RATE = 1.f
MUTATE_BIAS_RATE = 0.4f
MUTATE_NEURON_RATE = 0.7f
MUTATE_ENABLE_RATE = 0.2f
MUTATE_DISABLE_RATE = 0.4f
MUTATE_OFFSET_SIZE = 0.1f
MUTATE_RATE_DECAY = 0.f
DELTA_DISJOINT = 2.f
DELTA_WEIGHTS = 0.4f
DELTA_THRESHOLD = 1.f
CROSSOVER_PROB = 0.75f
STALE_SPECIES = 50
POPULATION_SIZE = 300
END_POPULATION_SIZE = 0
POPULATION_GENS_INC = 300
POPULATION_INC_FREQ = 10
ACT_REPEAT = 5
MVG_AVG = 300
PLT_FREQ = 2
SAV_FREQ = 1
GENERATIONS_TRAIN = 0
EPOCHS_EVAL = 10
MAX_STEP = 0
MAX_NOOP = 1
cd bin && ./app.sh
-------------------------------TRAIN-------------------------------
GENERATION : 1 / 300
MAX FITNESS : 289.5
MVG AVG : 41.0717
# WIN : 0
GENERATION : 24 / 300
MAX FITNESS : 3373
MVG AVG : 642.527
# WIN : 2
GENERATION : 33 / 300
MAX FITNESS : 3375.5
MVG AVG : 837.527
# WIN : 6
GENERATION : 35 / 300
MAX FITNESS : 3402.5
MVG AVG : 923.523
# WIN : 5
GENERATION : 36 / 300
MAX FITNESS : 3440.5
MVG AVG : 1032.61
# WIN : 6
GENERATION : 44 / 300
MAX FITNESS : 3441
MVG AVG : 1048.76
# WIN : 16
GENERATION : 61 / 300
MAX FITNESS : 3443
MVG AVG : 1773.53
# WIN : 83
GENERATION : 62 / 300
MAX FITNESS : 3454
MVG AVG : 1826.32
# WIN : 99
GENERATION : 88 / 300
MAX FITNESS : 3463.5
MVG AVG : 2168.22
# WIN : 140
GENERATION : 124 / 300
MAX FITNESS : 3468.5
MVG AVG : 2354.4
# WIN : 170
GENERATION : 149 / 300
MAX FITNESS : 3470.5
MVG AVG : 2526.36
# WIN : 196
GENERATION : 155 / 300
MAX FITNESS : 3471
MVG AVG : 2457.06
# WIN : 187
GENERATION : 300 / 300
MAX FITNESS : 3471
MVG AVG : 2749.04
# WIN : 216
Time: 4.03416e+08ms
log/plots/
-------------------------------EVAL--------------------------------
EPOCH : 1 / 1
FITNESS : 3471
DID WIN : YES
Time: 35091.9ms
- [Overworld] Level 1_1:
./demo.sh 1_1
- [Underwater] Level 2_2:
./demo.sh 2_2
- [Castle] Level 1_4:
./demo.sh 1_4
include/env/env/
src/env/env/
- 1.1. implement model
res/rom/
res/sav/
res/
- 1.2. add rom file
- 1.3. add level state files
- 1.4. add optional resources
include/env/env.hpp
- 2.1. add include
- 2.2. declare model struct
src/env/env.hpp
- 2.3. define initialization function
- 2.4. define observation function
- 2.5. define action function
- 2.6. define is done function
- 2.7. define fitness function
- 2.8. define information function
- 2.9. define no operation function
- 2.10. define reset function
- 2.11. define step function
- 2.12. define reset render function
- 2.13. define step render function
include/env/view.hpp
- 3.1. add include
- 3.2. declare event state struct
- 3.3. declare draw variables
- 3.4. declare draw functions
src/env/view.cpp
- 3.5. define event setup function
- 3.6. define get action function
- 3.7. define draw setup function
- 3.8. define draw loop function
test/include/
test/src/
- 4.1. implement tests
include/env/conf.hpp
- 5.1. add include
- 5.2. define default arguments
- 5.3. declare optional parameters
- 5.4. define argv cmds commands
- 5.5. define help error message
- 5.6. define optional commands
- 5.7. define params parameters
- 5.8. define optional parameters
README.md
- 6.1. update readme
LICENSE
- 6.2. update license
@romainducrocq