Screen Repulsion Map

Friday 11 June 2010 at 9:12 pm. Used tags: , , , ,

This is the goal:

Have a big amount of spaceship flying around the player
and avoid collision with the player, flying projectiles and
other spaceships.
They should fly in a natural way and should not be scripted.

The solution:



The steering behavior of the spaceship consists of two
things: Steer toward the player to attack him/her and avoid collision
with every object.

The steering towards the player is a simple vector from
the actual position to the player position.



The avoiding is a bit more tricky.

Every Gametick, a ScreenRepulsionMap is updated.

Every Object has some vectors coming of its center, spreading around the object.



All object copy their Sub-Map to the map. (The player at last, because its the
most important and should not be overwritten)


update: Every spaceship checks the around itself for repulsing vectors and

calculates a result vector. (This gives better behavior then just looking to the movement direction!)



The result is a behavior which is unpredictable, seems natural and collisions are minimized.
The completely avoid collisions much more calculation is needed. This is
a satisfyable result which runs with 1000 FPS on a five year old laptop!

This is a small video of it (by the way: System is now a bit more tuned and looks better. I will post a new video, when more features are ready to be shown):

Stay tuned! This algorithm will be used in the next game... Subscribe to the RSS Feed ;-)

No comments



Emoticons

This is used to protect this website from spamming computers:
 

Remember personal info?
Hide email
Small print: All html tags except <b> and <i> will be removed from your comment. You can make links by just typing the url or mail-address.