Page 1 of 1
Tokamak Open Source
Posted: Wed May 23, 2007 8:42 am
by Dirk Gregorius
From what I saw in comarissons this was actually one of the fastest engines. So quite cool that it is open source now.
http://sourceforge.net/projects/tokamakp/
Posted: Wed May 23, 2007 1:16 pm
by wyd124
Is this the result of competition?
Posted: Wed May 23, 2007 1:36 pm
by raigan2
If only the source was at least somewhat commented!
Posted: Wed May 23, 2007 9:20 pm
by Erin Catto
Do you know what algorithms it uses?
Re: Tokamak Open Source
Posted: Wed Jan 02, 2008 7:32 pm
by David Lam
Hello All!
During this holiday I decided to revisit the world of physics programming and come across many different new physics engine and physics research. And hence I come to find this website about physics discussion. Doing a search for "Tokamak" come up with a few mentions. I admit I have neglect Tokamak for awhile. In case you are interested, When I released Tokamak back in 2003, I didn't have the skill and connection to take it commercial. I tried a few leads (that's another story), but I quickly returned to the world of game development doing mostly graphics stuffs. What I can say is that it is not easy to maintain a hobby project when you have a full time job and a family (and other hobbies)!
The dynamic solver hasn't change since back in 2003. It is what you can call sequential impulse. But the naive implementation of this doesn't work very well. Simply calculating impulse for zero-relative velocity alone will allow the joints position to drift. So there is an extra term in the impulse calculation for drift correction. The correction impulse should be such that it produce a relative velocity that reduce the displacement "in a frame step time". All the impulses for one body are accumulated before applying.
There is a hack for reducing the number of iteration require for maintaining stable stacking. Tokamak builds a directed graph of contacts pointing away from the gravity vector. And contact constraints are solve in that order.
The other things that was important was putting bodies to sleep. That's mostly done by considering the history of the body's state. I don't remember the exact procedure but I am happy to take a look at it again if anyone is interested.
For collision detection, everything is pretty standard except for narrow-phase convex meshes. I used the algorithm describe in this paper
http://www.cs.hku.hk/research/techreps/ ... 005-01.pdf (Collision Detection of Convex Polyhedra Based on Duality Transformation). The algorithm seems sound, but for some reason I found very few people know or discuss about it. I think there's some numerical issue with my implementation so sometime it can fail.
That's off the top of my head. I am happy to talk about anything which I haven't cover. My view on physics engine is pretty much represented what Tokamak does: the important of speed, memory and stability far outweigh any accuracy concerns. I do intend on going back to work on Tokamak, for my own personal use if not for anything else.
Cheers,
David
Re: Tokamak Open Source
Posted: Wed Jan 02, 2008 8:31 pm
by billyzelsnack
Welcome back to the physics world David. I think many people here were inspired by Tokamak when it first came out. I know I was.
Re: Tokamak Open Source
Posted: Wed Jan 02, 2008 10:53 pm
by Erin Catto
Hi David,
I'm sure many people here would be curious to know about the inner workings of Tokamak.
I used the algorithm describe in this paper
http://www.cs.hku.hk/research/techreps/ ... 005-01.pdf (Collision Detection of Convex Polyhedra Based on Duality Transformation). The algorithm seems sound, but for some reason I found very few people know or discuss about it..
I actually did implement this algorithm a while back using a quad-edge data structure. However this method doesn't give an accurate distance or penetration depth. How did you manage to use it to create contact points?
Cheers,
Erin
Re: Tokamak Open Source
Posted: Thu Jan 03, 2008 7:57 pm
by David Lam
Erin Catto wrote:Hi David,
I'm sure many people here would be curious to know about the inner workings of Tokamak.
I used the algorithm describe in this paper
http://www.cs.hku.hk/research/techreps/ ... 005-01.pdf (Collision Detection of Convex Polyhedra Based on Duality Transformation). The algorithm seems sound, but for some reason I found very few people know or discuss about it..
I actually did implement this algorithm a while back using a quad-edge data structure. However this method doesn't give an accurate distance or penetration depth. How did you manage to use it to create contact points?
Cheers,
Erin
Hi Erin,
This could well be the case. In my test, arbitrary convex mesh colliding with ground box mesh (not as a primitive) seem fine but convex mesh colliding with each other do sometime penetrate. I checked the algorithm, and I can understand it and everything seems good on paper. It would be easy to write a test program and set up the fail case and follow the code to see why it fails, when I find the time

.
David