View Full Version : Clanlib physics

10-13-2006, 01:07 PM
Hi All,

I mostly am posting just to say hello and provide some moral support. :-D Clanlib is awesome, and I'm glad that a forum was created, it seems like a good idea. In 2007, I will be releasing a 2D physics engine, that will easily integrate into Clanlib. About 2 years worth of work has gone into making it, and I couldn't think of anything cooler than advancing the Clanlib project with my contribution. Have a great day everybody.

-Tim Kerchmar

10-25-2006, 12:11 AM
If the engine is written in LISP (that's what your signature hints), what are your plans for getting it integrated with ClanLib? The project will of course not mind distributing in a contrib directory or link your website, but I'm not sure if its a good idea to have a direct dependency on a LISP intepreter in ClanLib itself.

10-25-2006, 01:45 PM
Hi Magnus,

Last night I successfully performed some more optimizations and got 100fps on a decently complex scene. Progress. :-D

I wrote the original version in Lisp, and the simplest route to contributing to Clanlib would be to convert all my many changes back to C++, so that there are no dependancies. I can produce a DLL that does not require an installation of the Lisp runtime, but my implementation is Win32 only. Am I correct in assuming that the most expedient route to integration is to do the conversion myself?

Now a situation may have changed since Clanlib 0.8.x, but the provided collision detection was a little buggy the last that I checked. Here's what I would be offering:

Collision outlines are a sequence of lines and circles that form completely enclosed shapes. Those shapes may be self-intersecting or concave if required. There is no tool nor plans for one that will help generate the outlines from a bitmap, that is up to a developer to create the tool or a xml based method of creating and modifying these outlines.

The collision detection is full dynamic-dynamic, so fast moving objects collide perfectly with other objects. In a movement transaction all objects either don't move or are moved to positions that do not intepenetrate any other object. Contact points are recorded, as well as the normal of collision for that contact.


Multiple physics layers.
Animated outlines.
Physical solver.
Constraint/spring system.
Arbitrary placement of objects.

I think that without these features, it would not be useful enough in the general case for users of clanlib. As always, I want to at least provide a Clanlib integration of the physics engine so that Clanlib users can benefit from my work. :-D

-Tim Kerchmar

05-11-2007, 03:51 AM
Sorry about the late reply - I tend to not read the forum that often, hehe.

The collision stuff in 0.8 is indeed fairly primitive and any better collision library stuff would be highly appreciated by ClanLib users, I'm sure. :) I just got the impression the stuff you did was done in Lisp (the final version to merge with clanlib) and if that would be the case it probably might present some problems as an external dependency.

One of the goals of clanlib is to keep dependencies as a minimum, and when we must have them, ideally we can make it a seperate library with just that dependency. For example, the clanMikMod library exists only because the mod sound playing classes cannot be in clanSound without forcing everyone to include the mikmod library.

If your collision stuff is written in Lisp, a similar dependency would arise and therefore could only be placed in ClanLib as a seperate module. That in itself is probably not that big a problem, but our build system stuff would probably have to be able to build your lisp code. Unless you design it so that it consists of two libraries, a clanCollision and a pTyhmnCollsion dll/lib/whatever that clanCollision then links to.

We also have the option of not including it into clanlib itself, but simply making it available on our contrib page. With that model it doesn't have to follow any of the usual ClanLib rules or conventions.

So basically I see there are three options:

Port the code to C++ and include it into ClanLib itself.
Make a clanCollision binding library that links with your lisp library (like PCRE and clanRegExp).
If the library generally do not follow the usual ClanLib API and/or coding rules, offer it under the contributions page on clanlib.org.

Btw grats on the 100 fps stuff - it sounds like it works fast. :)

05-11-2007, 04:19 AM
Its 100% C++ now. I've moved on from the collision stuff to the physical solver. Its pretty sweet, but kind of slow, because it converges slowly on the correct answer when objects are stacked. The collision only sample can now process 150 dynamic objects in close proximity at about 55fps on a 1.8GHz Athlon 64.