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

[ demo, gpl, program ] [ Propose Tags ]


Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


Versions [RSS] 0, 1, 2
Dependencies base (>=4.8 && <4.14), containers (>=0.5 && <0.7), GLUT (>=2.7 && <2.8), hosc (>=0.17 && <0.18), hsc3 (>=0.17 && <0.18), random (>=1.1 && <1.2) [details]
License GPL-3.0-only
Copyright 2010,2013,2015,2016,2019 Claude Heiland-Allen
Author Claude Heiland-Allen
Category Demo
Home page
Source repo head: git clone
this: git clone v2)
Uploaded by ClaudeHeilandAllen at 2019-08-28T01:32:28Z
Reverse Dependencies 1 direct, 0 indirect [details]
Executables bowntz
Downloads 1949 total (10 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
Last success reported on 2019-08-28 [all 2 reports]

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

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    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 <>.