Skip to content
lifning edited this page Aug 4, 2012 · 4 revisions

Computing and replaying runs

Getting started

python gui-gtk.py
  • Select a game module. Most of the time, we're concerned with superopti, the module for using libretro in Optiness.

Selecting a "game" module.

Each module has its own parameters, which come pre-assigned to some default values that might make testing quicker. superopti's values default to running Super Mario World (heuristic, rom) level 1-2 (initstate) in snes9x (libretro), only searching on the buttons right, X, and A (inputmask), and holding each input state for 10 frames at a time (granularity).

  • Select the brain module that will search the selected game. I've had the most success with wario.

Selecting a "brain" module.

wario searches by pressing all possible combinations of valid inputs and proceeding with whichever makes the most short-term progress. It looks ahead peek+step inputs, but only proceeds with the first step of them, so for peek > 0 it has a little bit of foresight. Since it is a greedy algorithm, escapedepth configures how many input states to look ahead if it gets caught in a local minimum (can't improve the game progress any further with only step+peek inputs).

  • Start the search.

Starting the search.

The string of inputs produced by the search will be saved to the file specified by output (which will be overwritten if it exists). Change the path before clicking Start if you wish to save it somewhere other than output/last_run.pickle.

  • Replay the search when it's finished.

Replaying the input string found by the last search.

The pseudo-brain rerun takes an Optiness run pickle as an input file and replays it. It will error out before starting if the game parameters are any different from what they were when the run was produced, unless force is True. rerun can also be useful for converting the produced run to video.

Using the rerun brain to record a video.

To record a video, enable force and recordvideo, set the granularity to what was used on superopti's side when the run was produced, and set superopti's granularity to 1 and audio to wave. This process will dump all the frames as PNG images and produce a WAV audio file which can all be put together using ffmpeg with the helper scripts included in Optiness' source tree, output/encode-*.

Clone this wiki locally