/JugglersDrift

Software for displaying multi-juggler runarounds. On an Ubuntu 11.10 system, run "sudo apt-get libpng12-dev", then read the README.

Primary LanguageC++

    And for as much as I profess rather to discover than teach
    these mysteries, it shall suffice to signify unto you that
    the endeavour and drift of jugglers is only to abuse men's
    eyes and judgements.
                          --Reginald Scot
                          "The Discoverie of Witchcraft", 1584


This is a piece of juggling software; namely, a juggling simulator. But while
most juggling simulators (Jongl, JuggleAnim, etc.) focus on stationary
siteswaps, Juggler's Drift focuses on runaround patterns --- patterns in which
three or more jugglers interact by passing clubs, all while simultaneously
moving around within the pattern itself.

Runarounds *are* supported by Wolfgang Westerboer's JoePass! software, but
JoePass! has a nasty tendency to crash under Wine, and besides, its myriad
of graphical editors feels overcomplicated.

My ultimate goal is to have a polished open-source juggling simulator
comparable to JoePass!, but without the complications and crashes. It should
be able to display single-person siteswaps; multi-person stationary patterns;
runarounds; patterns containing doubles; patterns containing jims and zips;
"oogles"; patterns with holes (e.g. Shooting Star); patterns with extra clubs
(e.g. French Three-Count); and extensible patterns (e.g. Feast or Line Feed).
For describing patterns, it should accept text input files in something very
close to established MHN siteswap notation. For describing the footwork, I've
been toying with the idea of something like Metafont, where you could just
specify a few points on the path and have the software fill in some
nice-looking splines, but that might be unwieldy, not to mention hard to
implement.

Right now (2011-08-17), what I've got is a program called "png2js" that
takes a sequence of PNG "frames" and outputs a bit of Javascript that you
can plug into png2js/display.html to get a 2D animated bird's-eye view of
the pattern described by the frame sequence. You need a Web browser that
supports HTML5 Canvas, and Javascript must be enabled.

Each "frame" must be a 3-channel (RGB) image in PNG format containing the
following graphical elements:

  - A light-grayscale background (all grays from #808080 to #FFFFFF are
    treated as equivalent and ignored).
  - One or more "jugglers", represented as colored disks (i.e., monochromatic
    non-grayscale regions). Each juggler must be represented by a different
    color (e.g., "Alice is #FF0000, Bob is #FF8000"). Each frame must include
    all of the jugglers; you can't add new jugglers in the middle of a
    sequence, nor can you make old ones vanish.
  - Zero or more "passes", represented as black line segments. A line
    segment linking two jugglers A and B represents an exchange in which
    A passes to B and B simultaneously passes to A. If the line segment
    has an arrowhead on one end, then it represents an "ooglewise" pass:
    an arrow from A to B represents a pass from A to B.
    One frame may contain anywhere from zero up to N/2 passes, but no
    juggler is allowed to be the source of two passes simultaneously,
    nor the target of two passes simultaneously. In other words, the
    current version supports oogles but not simuls.
    Be sure that each of your black lines is thick enough to be treated
    as one connected region!
  - Nothing else. No extraneous shapes are allowed in any frame.

Each frame represents what's happening on a single beat: the first frame
represents the positions and passes that happen on beat 1, the second frame
represents beat 2, etc.  At the end of the sequence, we wrap back to the
beginning.

There are sample PNG frame sequences in the directory png-patterns/.
Run the following commands to see the 5pHavana pattern animated:

    cd png2js
    make
    ./png2js ../png-patterns/5pHavana/*.png > ./pattern.js
    firefox ./display.html

The --join= option can be used to generate a full animation from only
a fraction of the frames. If the first frame is equivalent to the last
frame rotated clockwise by N degrees (modulo some permutation of the
jugglers' roles), then "--join=N" will generate the full animation.

If the --join= option is passed, and the first frame is equivalent to
the last frame rotated by N degrees and then slid by some amount
(for example, see Morgan's Turbo Reel below), then the resulting
Javascript will include an "EndOfPatternTranslation" term which
causes the display to scroll steadily as the pattern is animated.

    ./png2js --join=120 ../png-patterns/Havana/0[123456].png >pattern.js
    ./png2js ../png-patterns/5pHavana/* >pattern.js
    ./png2js --join=0 ../png-patterns/5pHavana/1* ../png-patterns/5pHavana/201.png >pattern.js
    ./png2js --join=120 ../png-patterns/5pHavana/10[123456].png >pattern.js
    ./png2js --join=0 ../png-patterns/MorgansReel/* >pattern.js
    ./png2js --join=0 --count=3 ../png-patterns/MorgansTurboReel/* >pattern.js
    ./png2js --count=4 ../png-patterns/RotatingOogle/* >pattern.js
    ./png2js --join=0 --count=4 ../png-patterns/RotatingOogle/0[123].png >pattern.js
    ./png2js --join=180 --count=4 ../png-patterns/RotatingOogle/0[12].png >pattern.js
    ./png2js ../png-patterns/2v5Weave/* >pattern.js
    ./png2js --join=0 --count=1 ../png-patterns/MattsModifiedPretzel/* >pattern.js
    ./png2js --join=0 ../png-patterns/ArthursIVXX/* >pattern.js
    ./png2js --join=0 ../png-patterns/Trefoil/* >pattern.js
    ./png2js --join=0 ../png-patterns/Trefoil2/* >pattern.js