Artificial Intelligence Warehouse
Artificial Intelligence Depot
"As knowledge increases, ignorance unfolds." -Kennedy
FEATURES COMMUNITY KNOWLEDGE SEARCH  
enemy AI
 
• enemy AI

Hi,

This is what i want to do:
There is a enemy...and there are many bullets flying in the screen.
The bullets travel straight...until they collide with the margins of the screen, where the reflect

What the enemy has to do is... navigate on the screen so that he gets hit by a minimum number of bullets.

The bullets have random directions when they start.

I don't expect for someone to tell me exactly what to do ...rather a direction in which i can document myself. Is there an already known algorithm for these kind of things?

Thanks.

PS: Actually.. the enemy's movement is restricted to a line in the upper part of the screen. He can only go left/right

1 posts.
Wednesday 15 November, 05:20
Reply
• my solution

I don't know if there is an actual algorithm, but I designed a quick algorithm that probably would work.

the enemy doesn't move until the bullet(s) is within a certain radius of it. Then it assesses the slope of the bullet travelling, and goes the direction away from the bullet, while travelling, continue to check for the radius around it. The bullets closer have greater priority to escape unless there are more bullets on the side it is escaping to. Always, check within the range of the enemy.

I'm not sure how well this would work when there's a large number of bullets, but it should work. Try tweaking the radius size to see if there is an optimal range.

4 posts.
Thursday 14 December, 18:56
Reply