bowntz: audio-visual pseudo-physical simulation of colliding circles




[Skip to ReadMe]


Versions0, 1, 2, 2
Change logNone available
Dependenciesbase (>=4.8 && <4.14), containers (>=0.5 && <0.7), GLUT (==2.7.*), hosc (==0.17.*), hsc3 (==0.17.*), random (==1.1.*) [details]
Copyright2010,2013,2015,2016,2019 Claude Heiland-Allen
AuthorClaude Heiland-Allen
Home page
Source repositoryhead: git clone
this: git clone v2)
UploadedWed Aug 28 01:32:12 UTC 2019 by ClaudeHeilandAllen


Maintainers' corner

For package maintainers and hackage trustees

Readme for bowntz-2

[back to package description]
Bowntz -- an audio-visual pseudo-physical simulation of colliding circles
Copyright (C) 2010,2013,2015,2016 Claude-Heiland-Allen <>


    $ cabal sandbox init
    $ cabal install


    $ scsynth -u 57110 &
    -- wait for scsynth to start, connect its JACK ports --
    $ ./bowntz

    Bowntz requires a "clean" SC3 server to be running on its usual port.
    Bowntz leaves this SC3 server in an "unclean" state when it exits.

    This situation is far from ideal, but it's the current state of the code.


    The world is a collection of N circles which each move at a constant speed
    in a straight line (in the absence of collisions).  Given two such circles
    it is possible to calculate the precise time of their next collision.  For
    N circles, O(N^2) such "next" collisions may occur.

    Pick the soonest next collision between circles A and B.  This collision
    will change the velocities of A and B, but no other circle.  Update the
    collection of collisions, by removing all the other "next" collisions
    involving either A or B, and computing the new collisions of A and B with
    all the other circles (O(N) collisions).  For maintaining a consistent
    time-base for all circles in the world, it makes sense to advance in a
    straight line each circle to its position at the time of the collision.

    Given a world at time T, to find the world at time T+dT simply step
    through the future collisions one by one until the soonest collision is
    after T+dT, at which point one can just advance the circles in straight
    lines to T+dT.

        T       T+1      T+2      T+3      T+4      T+5      T+6      T+7

    Care needs to be taken in case of numerical imprecision: one can get an
    infinite number of collisions without time increasing.

To do

    General code clean-up and documentation.

    Optimizations based on collision possibility tree, example:

        A               7 possible
        |               A~*~B
        +---B           A~*~E    5 impossible
        |   +---C       B~*~C    !A~*~C
        |   +---D       B~*~D    !A~*~D
        |               C~*~D    !C~*~F
        +---E           B~*~E    !D~*~F
            +---F       E~*~F    !A~*~F

        data Node = Node ID [Node]
        possibles n@(Node _ ns) = possible n `map` ns ++ liftM2 possible ns

    Infinite zoom into circles within circles within circles within circles?
    When (if ever) would it be safe to prune "outside"?

    Some kind of loop where circles contain themselves (I did try this in
    another unreleased version but it resulted in hyperexponential kinetic
    energy increase, which naturally caused problems).

    Non-flat space.

    Angular momentum affecting collisions.

    Remove all sources of non-determinism to enable two-pass rendering:
        1 pass to record audio from SC3    in realtime
        2 pass to record video from OpenGL in non-realtime
    Or just record ball positions in the first pass for later drawing (because
    callback races and/or timing instability might affect the reproducibility
    unless very precise care is taken at all stages..)


    More impressive audio-visuals.


    Anything other than circles (ok, maybe infinite lines would be ok, but
    asymmetry with angular momentum would quickly make collision detection
    get horribly complicated).


    License: GPL

    (at your option) any later version.

    but WITHOUT ANY WARRANTY; without even the implied warranty of
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <>.