Lenard-Jones Potential Functions

Lenard-Jones potential function is actually a formular used to calculate molecule’s attraction and repulsion forces, which are varied by distance between two objects. However, it could also be adepted to use as a calculation in many AI behaviors, namely; chasing, intercepting, obstacle avoidances, as well as swarming. Changing the 4 parameters of the function could also drastically change the behavior of the AI itself without having to change any other code.

The formular for Lenard-Jones Potential Function is;

F = -( Attraction / r^n ) + ( Repulsion / r^m )

Where r is distance and F is the force between two objects.

By applying Attraction, Repulsion, n and m depends on the each obstacle and calculate force F between the current unit and all other objects in the scene, a complex behavior pattern could be created.

For example, by leaving out Attraction factor, the function becomes an obstrucle avoidance which push the unit away from the object. While a higher Attraction and low Repulsion could draw the unit to the object but retain a minimum distance. This function, when apply to a lots of units, could imitate angry bees swarm behavior where all units attempt to remain close to the group, while remain in constant motions, as oppose to Flocking algorithm which result in a neat movement formation.

For Reference:
Bourg, D. and Seemann, G. (2004) AI for Game Developers, Sebastopol: O’Reilly Media.

[ Placeholder for Scanned Images ]

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s