DKC2 Neat from MarI/O
.vscode | ||
3rdparty | ||
doc | ||
pool | ||
.editorconfig | ||
.gitignore | ||
.gitmodules | ||
config.lua | ||
donkutil.lua | ||
font.font | ||
game.lua | ||
install.lua | ||
LibDeflate.lua | ||
makeproxy.lua | ||
mathFunctions.lua | ||
neat-donk.lua | ||
pool.lua | ||
README.md | ||
runner-process.lua | ||
runner-wrapper.lua | ||
runner.lua | ||
serpent.lua | ||
spritelist.lua | ||
state-test.lua | ||
util.lua | ||
vscode-debuggee.lua | ||
xpra-run.sh |
Donkey Kong Country 2 NEAT
An AI based on SethBling's MarI/O to play Donkey Kong Country 2 with lsnes.
See YouTube for an example run.
Requirements
- lsnes with Lua 5.2 (do not try to build with 5.3, it does not work!)
- A Donkey Kong Country 2 1.1 US ROM (matching hash b79c2bb86f6fc76e1fc61c62fc16d51c664c381e58bc2933be643bbc4d8b610c)
Instructions
- Start lsnes
- Go to
Configure -> Settings -> Advanced
and changeLUA -> Maximum memory use
to1024MB
- Load the DKC2 ROM:
File -> Load -> ROM...
- Load the
neat-donk.lua
script:Tools -> Run Lua script...
- You may also want to turn off sound since it may get annoying.
Configure -> Sounds enabled
- Look at config.lua for some settings you can change. Not all have been tested, but you should be able to change the number on the
_M.Filename =
line to get a different state file from the_M.State
list. Also note theThreads =
line. Change this to 1 to prevent multiple instances of lsnes from getting launched at once. If you use more than 1 thread, you may also want to launchlsnes
using xpra to manage the windows, with thexpra-run.sh
script.
If you want a better idea of what's going on with the tile and sprite calculations you may want to load donkutil.lua
. It will mark the tiles with their offsets on the screen, give a crosshair with tile measurements (every 32 pixels), and list information about the sprites (you can use the 1 and 2 keys above the letter keys to page through them). Sprites labeled in green are considered "good", red is "bad", normal color is neutral. Solid red means that it's the active sprite in the info viewer.
Keys
1: Stop/start
4: Play the best run
6: Save the pool file
8: Load the pool file
9: Restart
Notes
- Only tested on Pirate Panic
- The pool files are gzipped Serpent data
Credits
- Donkey Hacks
- SethBling's Mar I/O
- Basic tilemap info from p4plus2/DKC2-disassembly
- Serpent
- LibDeflate
TODO
- Incur penalty for non-hazardous enemy collisions to encourage neutralizing Klobber
- Make enemies neutral when held? (Klobber, Click-Clack, etc.)
- Multiple nets to handle different contexts s/a clicking map items