snippi

Find specific situations inside Slippi replay files

Usage no npm install needed!

<script type="module">
  import snippi from 'https://cdn.skypack.dev/snippi';
</script>

README

A configurable state machine for finding interesting clips from within a collection of SLP replay files.

Usage

  • State - A predicate combined with options. States are progressed sequentially, and a clip will start when the first state starts progressing, and end when the final state stops passing.
  • State Predicate - The basic building block of states. Given a frame, decides whether the frame should count or not.
  • State Options - Settings about how the predicate must be satisfied in order to count the state as complete and move on to the next state.
    • minimumLength - the number of consecutive frames the predicate must pass before moving on to the next state. Default is 1 frame.
    • leniency - the amount of consecutive failing frames allowed before progress towards minimumLength is reset to zero. Default is 0 leniency.
    • delayedStart - whether the state's predicate can be failing at first before starting progress. If false, the current state's predicate must immediately be passing once the previous state is finished. Default is false.
  • Constraint - The same as a state, but must be passing every frame regardless of what the current state is.
  • Filter - Filters are frame-independent predicates that are based around the game and player. If a game,player pair does not pass all filters, it's state machine will not even be run, saving processing time.

To be counted as a clip, a situation must pass all filters and satisfy each state in order, all while keeping every constraint.

Install:

npm install snippi

Sample code:

const s = require("snippi");
s.snippi()
  .addFilter.character(s.Character.Fox)
  .addConstraint.either({}, s.predicates.isInHitstun, s.predicates.dies)
  .addState.isInHitstun()
  .addState.dies({ delayedStart: true })
  .processAndSave('slp/', 'output.json', 30, 30);

Output:

$ node index.js

Processing file (1/1): C:\dev\snippi\slp\sample.slp
Found 2 matches
Done processing, 2 matches found
Total clip time: 5.8 seconds
Saved to output.json

Then, you can load your json into Project Clippi's Playback Queue to replay the clips.