Thread: Recent Updates
View Single Post
Old 10-24-2009, 10:37 AM   #25
flipper
Registered
 
Join Date: Mar 2002

Location: Texas
Posts: 60
No calculus required

Sorry for the long post. I just want to make sure that Jim understands how simple this can be.

My technique doesn't require calculus, per se. And it's not an A* path finding or any other advanced math-based AI approach either. It is based on calculus, but you don't really see that, nor do you need to know any. It's mostly data driven and was born out of 10 years of working with experts in the area of computer simulation modeling of real world physical phenomena.

It's based on random sampling out of probability data sets which can be as simple as 2 2D data points.

It does require some simple 3D math in order to determine if any object needs to be avoided. But it really is stupidly simple because I'm stupidly simple and I don't have good math skills to boot.

It also doesn't take up much of any cpu because it's so simple.

The trick to making it work is tweaking the data. That's why I thought Jim might be interested in the approach, since it falls within the normal things that a modeller is familiar with - tweaking data points over and over until you're satisfied with the results.

As an example, say it's time to change the horizontal direction of a fish. A typical approach to accomplish this would be to generate a random number between 0 and 1 and multiply that by 2 pi to get the new direction of travel. In my approach, that's still done, but you constrain the calculation by giving it a high and low boundary specified by variables. Under normal conditions those variable's values are 0 and 2 pi. But the collision avoidance routine can change the variable's values, forcing the fish in the direction it wants the fish to swim in order to avoid the objects the fish is swimming towards.

An example of collision avoidance would be if the fish is swimming fast towards a tank boundary. The collision avoidance routine "sees this" (simple distance and dot product calculations along with a velocity check) and modifies the fish's direction and acceleration boundary sampling variables so that it starts to "want" to slow down and/or turn.

The "sees this" part also uses the idea of constraint-based sampling, it would just (typically) use more than high and low constraints. For example, say you want a fish to behave normally until it's within 3 seconds of colliding with something. That would be one data point. Then say that if it's within 2 seconds of colliding with something you want it to start to slow down some. That's another data point. Etc, down to the last data point that says that the fish must almost stop if it's within a quarter second of colliding with something.

Go through this same "what-if" scenario to come up with a set of data points for forcing turns and you have what you need as a good starting point for collision avoidance that by its very nature almost never allows true collisions.

Now, extend this basic idea into up/down direction, bouyancy, acceleration, forward speed, turning speed, proximity to other fish, proximity to static objects, proximity to other fish that "scare" a given fish, or are food fish for a given fish, etc. Any behaviour of a fish that you wish to control can be modeled using this technique. Using the same simple math and sampling routines and a little as 2 variables per behaviour. All you need to do is come up with the data driving the behaviour.
flipper is offline   Reply With Quote