DKC2 Neat from MarI/O
Find a file
2021-05-08 23:44:18 -04:00
doc Added image of donkutil 2021-03-17 06:40:41 -05:00
pool Added save state 2021-05-05 18:25:42 -04:00
tools Added a bunch of code to add waypoints to the goal. Not sure at what 2021-05-07 21:54:25 -04:00
.editorconfig Added watchexec to remove Powershell dependency 2021-04-29 07:22:08 -04:00
.gitignore Clean up some old garbage 2021-05-04 08:36:50 -04:00
config.lua Pass sprites around 2021-05-08 23:44:18 -04:00
font.font Add font 2021-03-15 16:05:40 -05:00
game.lua Pass sprites around 2021-05-08 23:44:18 -04:00
i3.json Update layout 2021-05-06 00:48:57 -04:00
LibDeflate.lua Compress the pool files 2021-03-06 08:53:37 -05:00
LICENSE.namedpipe.md Clean up some old garbage 2021-05-04 08:36:50 -04:00
mathFunctions.lua Stage rulers. Try to hijack algorithm used to determine tile location 2021-03-03 15:40:19 -05:00
mem.lua Add climbing. Fix sprite list regression 2021-05-04 23:29:31 -04:00
neat-donk.lua Environment variable to load pool file 2021-05-05 03:34:04 -04:00
pipe-test.lua Clean up some old garbage 2021-05-04 08:36:50 -04:00
pool.lua Properly bubble up the max fitness because some calculations use it. 2021-05-08 09:31:11 -04:00
promise.lua Promisify everything? 2021-05-01 19:39:35 -04:00
README.md Fix pipes in Linux with socat 2021-05-04 20:30:52 -04:00
runner-process.lua Properly bubble up the max fitness because some calculations use it. 2021-05-08 09:31:11 -04:00
runner-wrapper.lua Properly bubble up the max fitness because some calculations use it. 2021-05-08 09:31:11 -04:00
runner.lua Pass sprites around 2021-05-08 23:44:18 -04:00
serpent.lua Switch to Serpent 2021-04-23 15:39:11 -04:00
spritelist.lua More advanced logic to calculate good tiles which allows some ropes. 2021-05-05 05:33:35 -04:00
state-test.lua Added a bunch of code to add waypoints to the goal. Not sure at what 2021-05-07 21:54:25 -04:00
util.lua Pass sprites around 2021-05-08 23:44:18 -04:00
xpra-run.sh Run the check for Xpra in the background 2021-05-01 22:16:45 -04:00
xpra.css Include terminal window in CSS selector 2021-05-01 22:23:16 -04:00

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!)
  • socat for Linux, or a fairly recent version of Windows that has PowerShell
  • A Donkey Kong Country 2 1.1 US ROM (matching hash b79c2bb86f6fc76e1fc61c62fc16d51c664c381e58bc2933be643bbc4d8b610c)

Windows

You will want to install the rrtest-1613424691 version of lsnes. Older versions were crashing for me. The easiest way to do this is to use Chocolatey:

# Make sure you use an Administrator shell!

# Skip this command if you have Chocolatey already.
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

# Install lsnes
choco install --version 2.0.24-rrtest-1613424691 lsnes

Instructions

  1. Start lsnes
  2. Go to Configure -> Settings -> Advanced and change LUA -> Maximum memory use to 1024MB
  3. Load the DKC2 ROM if you aren't using threads: File -> Load -> ROM...
  4. Load the neat-donk.lua script: Tools -> Run Lua script...

Config

Look at config.lua for some settings you can change. Not all have been tested.

  • _M.Filename: Change the number to a different one from the _M.State list to load a different file.
  • _M.NeatConfig.Threads: Change this to 1 to prevent multiple instances of lsnes from getting launched at once, or increase it to run more instances. If you use more than 1 thread, you may also want to launch lsnes using xpra to manage the windows, with the xpra-run.sh script.

Keys

1: Stop/start

4: Play the best run

6: Save the pool file

8: Load the pool file

9: Restart

Other Tools

Status Overlay

The status overlay is located at tools/status-overlay.lua. It will help you see the tile and sprite calculations by marking the tiles with their offsets on the screen, giving a crosshair with tile measurements every 32 pixels, and listing 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.

BSNES Launcher

Located at tools/bsnes-launcher.lua, this script gives you an easy way to launch bsnes-plus with breakpoints preset. Run it in lsnes and it will display a message to the Lua console and stderr on how to use it.

Notes

  • Only tested on Pirate Panic
  • The pool files are gzipped Serpent data

Credits

TODO

  • Incur penalty for non-hazardous enemy collisions to encourage neutralizing Klobber
  • Award for picking up items
  • Make enemies neutral when held? (Klobber, Click-Clack, etc.)
  • Multiple nets to handle different contexts s/a clicking map items