Move around Blob with arrow keys or mouse.
Split blob with h.
Join blobs with j.
Turn gravity on / off with g.

Written by:
Javascript Source Code
Get FireFox

Ray Tracing is fun and easy
Lately, I have been doing other things, such as this:

It's a raytracer I have been working on for a while. Read more.

Linux Version

You can also download the source code for a Linux / SDL / Cairo demo: blobsallad

There is an experimental Open GL version here.
I implemented this to test performance, but it lacks some of the features of the SDL version.
I also removed the horrible linked list implementation in favor for a 'normal' stack-allocated-array class.

Controls are:
  • g - toggle gravity
  • h - split blob
  • j - join blob
  • e - increase the size of the blobs
  • r - decrease the size of the blobs
  • arrow keys - push blobs around

  • 2007-01-26 11:20 I wrote this article for Chris Mills at Opera.

    2006-11-14 23:59 Uploaded newer version which contains some crude not too fast collision detection and
    some kind of level that the blobs can hang around in. The collision detection is not very fast though.
    See bs_octree.c for details. So if someone could implement a faster version I would be most happy.
    Further, I decided to start implementing my own 2D drawing algorithms for OpenGL. I know what you
    are thinking; "why don't he use this or that library?". I guess I could do that, but on the other
    hand I like to try everything for myself. If I just wated a funny game I would buy a PSP :).
    Either way, after doing some profiling I noticed that Cairo use rather much time so I though
    maybe I could do something myself. (Long live the brave and stupid, which would be me I guess).
    Also, there are some additional controls you can play around with if you like; Press e to increase
    the size of the blobs, and r to shrink them. Press v to display some profiling information. Don't
    be too confused about the percentages don't adding up, some of the tasks include the others. For

    --- PROFILER ----------------------------------------------------
    All Tasks: 2.87s
    1.83s, 63.76%, BS_PROFILER_TASK_DRAW
    0.88s, 30.66%, BS_PROFILER_TASK_OCTREE

    The First and second task are prety much everything that is done. The Octree task is included
    in the simulation task. Further the test line segment task is included in the octree task.
    All percentages are of the total time, 2.87 seconds in this case.

    2006-10-15 23:34 Removed support for X11 and GTK since this is never used and defunct.

    2006-10-15 22:51 Code clean up in blob collective

    2006-10-14 16:43 Implemented faster collision detection, which reduce collision detection effort
    from 16000 computations per blob to just 40. Less is more. The only problem is that this solution
    is less visual appealing due to incorrect computation of the blobs radius. So if I can fix that
    I suppose it's gonna look alright. Another benefit from this approach is that the blobs doesn't
    get stuck inside each other.

    2006-10-11 23:16 Implemented first collision detection so that blobs now bounce of each other.
    This use up a lot of CPU since two colliding blobs are deformable and penalty forces are applied
    iterative. Now this is not so good since I would like to implement some other stuff like a world
    in which the blobs can do stupid blobish stuff, and I suppose I could use CPU for that. So high prio
    is to speed this up
    I have started to harass people I know for game music. If you're interested in creating music
    do game design, graphics and stuff like that just send me a mail. If you wanna code you're also
    welcome of course.

    2006-10-03 20:44 Fixed stability problems, model will no longer behave like a drunk sailor.

    2006-10-02 21:56 I made some changes in the blob model. First I got a nicer looking blob.
    Also, I gave up using breizeir curves for drawing the blob. Now every blob is 40 line segments.
    It have some interesting stability problems. Turn of gravity and see what I mean.

    I have also noticed that the cairo library seems to be quiet a bottle neck.
    To test this, comment out all meaningful code in bs_blob_collective_draw, then spawn
    blobs like crazy and notice that you can create quiet a few before any substantial
    frame drop begins.

    You need Cairo to compile the source.
    Cairo comes with most main distros such as Debian and Ubuntu.

    If you have any questions just send me a mail. I am NOT an evil programmer.


    Don't tell those guys that did that game ...

    Here is how the blob is made. A lot of pointmasses connected
    thogether with joints. Each joint allows for some flexibility
    which makes the whole thing blobish. A pointmass turns blue to
    indicate that the pointmass is inside some other blob. Once the
    pointmass is inside the other blob a penalty force is applied
    which force the point outside the other blob. I figured another
    possibly much faster way to implement collision detection in which
    two blobs are separated by a line. Points passing over the other side
    of the line are put back again, hence blobs repell each other but
    this should be conciderably faster and allows for fast discrimination.