Author Topic: Darwinbots 3 Progress  (Read 29589 times)

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Darwinbots 3 Progress
« Reply #60 on: May 28, 2009, 07:16:14 PM »
Quote from: bacillus
I see how you got that from FP, but I think it's just a case of each object resolving each of its collisions as though they were different single collisions. Remember that the other masses can be reduced to a single mass as they are all external of the concerned mass.

You mean like if 10 objects are colliding at the same time, just treat all the collisions pairwise?  This won't work, because as you resolve one collision it can invalidate the solution you found for other collisions.  You can just iterate over all the collisions pairwise a few times (this is what most commercial engines do), but if you iterate as often as you need to to resolve all the collisions to arbitrary precision it's an [img class=\"tex\" src=\"http://www.forkosh.dreamhost.com/mathtex.cgi?O(n^3)\" alt=\"LaTeX: O(n^3)\" /] process.  Essentially it's Gaussian eleminiation (or so I was told once upon a time).  If you set up the system of equations from the start, it's still [img class=\"tex\" src=\"http://www.forkosh.dreamhost.com/mathtex.cgi?O(n^3)\" alt=\"LaTeX: O(n^3)\" /], but you can do it much faster using more advanced techniques (LU decomposition to solve the system).  Should be something like 3 times faster.

Typical matrices will also be rather sparse as they grow, so I'm researching sparse methods for solving the matrix at the moment.  A good method might be more along the lines of [img class=\"tex\" src=\"http://www.forkosh.dreamhost.com/mathtex.cgi?O(n)\" alt=\"LaTeX: O(n)\" /] since there's probably a maximum number of collisions possible per body.

If you read Chapter 2, most of what I just said should make sense.

Quote
Okay, so j0 represents the scalar exertion upon an object, and n the direction of change, so therefore should have a magnitude of 1. mass/moment of inertia convert the 'force' into an 'instantaneous' acceleration/torque. j0 is acting perpendicular to the center about a point, eg. a tangent.
Okay, that makes sense. But is the code for calculating the normal/tangent/impulse already in place?

[img class=\"tex\" src=\"http://www.forkosh.dreamhost.com/mathtex.cgi?j_0 \vec{n}\" alt=\"LaTeX: j_0 \vec{n}\" /] is the impulse ([img class=\"tex\" src=\"http://www.forkosh.dreamhost.com/mathtex.cgi?j\" alt=\"LaTeX: j\" /] is the traditional symbol for impulse.  The 0 is so it makes sense later on when you handle multiple simoltaneous collisions and have multiple impulse terms).  An impulse is essentially a crazy large force that acts in a crazy small amount of time.  Remember that force needs time over which to act in order to change the position or velocity of an object, so an impulse just does it instantaneously.

As far as what's done, Prsn was working on it.  I'm not sure how far he got.  Check the changelog from his most recent commit and see what's there.  There's no code yet for calculating the collision normal (that's collision detection work, and there's been no real work on that yet).

Basically what needs to happen is that there's an island class which represents all the bodies that are directly or indirectly in contact.  You'd iteratively build up the island by adding body pairs (and their collision point and collision normal).  And then do something like island.solve() and have it figure out all the impulses necessary.  Prsn started on the island code, though I haven't looked at it yet so I don't know how far he got.

Quote
EDIT => Are the Azimuth files corrupt? I've tried to update several times at revision 304, but TortoiseSVN still marks it as a deprecated version.

Should all work.  What do you mean by deprecated?
« Last Edit: May 28, 2009, 07:25:39 PM by Numsgil »

Offline bacillus

  • Bot Overlord
  • ****
  • Posts: 907
    • View Profile
Darwinbots 3 Progress
« Reply #61 on: May 29, 2009, 12:13:53 AM »
Quote
Should all work. What do you mean by deprecated?

Not the current version.

Okay, I see your point. But that means an extra jn calculation has to be made for each object. Couldn't we reduce it to one multi-collision code, even for single collisions, or would that also be a drag on efficiency?
"They laughed at Columbus, they laughed at Fulton, they laughed at the Wright brothers. But they also laughed at Bozo the Clown."
- Carl Sagan

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Darwinbots 3 Progress
« Reply #62 on: May 29, 2009, 12:49:45 AM »
Quote from: bacillus
Quote
Should all work. What do you mean by deprecated?

Not the current version.

What's not the current version?  Your working copy?

Quote
Okay, I see your point. But that means an extra jn calculation has to be made for each object. Couldn't we reduce it to one multi-collision code, even for single collisions, or would that also be a drag on efficiency?

No idea what you mean.

Offline bacillus

  • Bot Overlord
  • ****
  • Posts: 907
    • View Profile
Darwinbots 3 Progress
« Reply #63 on: May 29, 2009, 09:47:52 PM »
Quote
No idea what you mean.
I get that a lot.  

What I mean is that instead of treating a one-on-one collision as a 'special case', we handle every collision the same method, regardless of the number of masses colliding.
"They laughed at Columbus, they laughed at Fulton, they laughed at the Wright brothers. But they also laughed at Bozo the Clown."
- Carl Sagan

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Darwinbots 3 Progress
« Reply #64 on: May 30, 2009, 12:10:03 AM »
We don't need a special case for one-on-one collisions in the actual code (though it wouldn't hurt).  Mostly I just listed it on the math page so the math behind multiple collisions makes sense.

So feel entirely free to skip writing out a function to solve one-on-one collisions.  The important part is that you understand the math behind it.  It's the algorithm for multiple collisions that's the work horse.

Offline bacillus

  • Bot Overlord
  • ****
  • Posts: 907
    • View Profile
Darwinbots 3 Progress
« Reply #65 on: May 31, 2009, 03:12:00 AM »
Well, maybe I should just write the code first to actually get something running...
 
"They laughed at Columbus, they laughed at Fulton, they laughed at the Wright brothers. But they also laughed at Bozo the Clown."
- Carl Sagan

Offline bacillus

  • Bot Overlord
  • ****
  • Posts: 907
    • View Profile
Darwinbots 3 Progress
« Reply #66 on: June 04, 2009, 12:33:28 AM »
Okay, while I'm trying to fix TortoiseSVN, does anyone know if velocity and angular velocity have already been implemented in the Body class? I could write the movement system, it's extremely trivial, but I want to make sure it's not handled somewhere else.
"They laughed at Columbus, they laughed at Fulton, they laughed at the Wright brothers. But they also laughed at Bozo the Clown."
- Carl Sagan

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Darwinbots 3 Progress
« Reply #67 on: June 04, 2009, 01:14:43 AM »
Look in PointMass.cs.

Basically the Body class is a pretty thin wrapper taht combines the ideas of collision shapes (the shape list), and a point mass (which it inherits from).  Where a point mass is something with heft and inertia but without any physical bounds.
« Last Edit: June 04, 2009, 01:23:26 AM by Numsgil »

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Darwinbots 3 Progress
« Reply #68 on: June 04, 2009, 01:10:05 PM »
If you have source code type questions, log on to chat.darwinbots.com.  It's an http chat room I set up for this sort of thing.  I'm usually logged in, and I can give you real time feedback on various source-y type things.

Offline jknilinux

  • Bot Destroyer
  • ***
  • Posts: 468
    • View Profile
Darwinbots 3 Progress
« Reply #69 on: June 09, 2009, 06:55:12 PM »
IMO, it looks like you're going for an unnecessary level of realism. I'd prefer having an unrealistic method of dealing with collisions and get a slightly faster simulation. For example, the slideshow discussed dealing with negative impulses. I wouldn't mind having negative impulses in a simulation if it makes it faster.
« Last Edit: June 09, 2009, 07:00:09 PM by jknilinux »

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Darwinbots 3 Progress
« Reply #70 on: June 09, 2009, 08:02:03 PM »
Actually I think the level of realism will make it faster.  Not at first, because I'm cutting corners in places.  But when all is said and done there's a lot to be said for fixing things when they're easy to fix.  But as far as I know this is all pretty novel.  No physics engines work like this.  So I can't really make any promises.
« Last Edit: June 09, 2009, 08:02:32 PM by Numsgil »

Offline Moonfisher

  • Bot Overlord
  • ****
  • Posts: 592
    • View Profile
Darwinbots 3 Progress
« Reply #71 on: June 10, 2009, 07:09:09 PM »
I definately agree I'll take processing speed over realisme, to a certain point.
And multithreading will also help a lot, at least for my part.
But I was also thinking it would be nice if there was an easier way to set up connected sims with different settings.
I think larger evolutionary steps could sometimes be produced by jumping in and out of different environments.
I know it should be possible to set up with teleporters, but I failed miserably at that.

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Darwinbots 3 Progress
« Reply #72 on: June 11, 2009, 12:55:24 AM »
My hope is that we can at least partially leverage something like XBOX live for organism sharing.  Or if not that, at least use something slightly more reliable than the current FTP.  That should go a long way towards making the multiverse of connected sims large enough to really have an ecosystem going.

Offline Shasta

  • Administrator
  • Bot Destroyer
  • *****
  • Posts: 231
    • View Profile
Darwinbots 3 Progress
« Reply #73 on: June 11, 2009, 01:41:57 PM »
I'm fairly sure we wouldn't be able to use Live to share organisms, unless you somehow work out a deal with Microsoft  It shouldn't be too hard to create a TCP server to handle everything with .net however, so that seems like the best option to me.

Offline NoZ

  • Bot Neophyte
  • *
  • Posts: 4
    • View Profile
Darwinbots 3 Progress
« Reply #74 on: June 11, 2009, 02:07:07 PM »


Hello All

sorry if this questoin is a bit out of turn but im doing my PHD which involves alot of networking, Im not too sure what your currently programming in but if its C, C# or C++ or you can make a wrapper for it then you could possibly use YARP (yet anouther robot platform), its not really ment for the internet but it might work (80% sure) with minimal effort as long as theres one static server of unchanging IP, and would allow you to send robots from one sim to anouther in a string.

I dont know if this is any use to you.

NoZ