2D Top Down Space Shooter AI
Cheers
Quote: Would you just get them to fire a volley of shots at random intervals, or is there usually a more complex method?
Short answer... depends on what you want. That decision is not an AI one but rather a design decision.
For a more-detailed answer on the AI portion, there are two approaches that can be solved almost simultaneously.
First method: Explain the problem in detail to us. Include the types of information that are available from the object library that the AI can use to reason on. Then, explain how you might be able to use that information as part of your decision process. Also include how you would like the AI to look like it is behaving.
Second method: After writing up the information in the first method, sit back and realize that you can do a lot of this yourself just by doing one simple task at a time using the above through process.
Dave Mark - President and Lead Designer of Intrinsic Algorithm LLC
Professional consultant on game AI, mathematical modeling, simulation modeling
Co-founder and 10 year advisor of the GDC AI Summit
Author of the book, Behavioral Mathematics for Game AI
Blogs I write:
IA News - What's happening at IA | IA on AI - AI news and notes | Post-Play'em - Observations on AI of games I play
"Reducing the world to mathematical equations!"
As an easy first approximation I could see using a few different types of AI one that tries to predict movement, one that shoots where the player is now, random etc. Kind of like packman.
Most current shooters don't have AIs they have enemies that shoot and move in patterns, and enemy creation is entirely predetermined.
What, in your experience would be a better idea? The enemies already move sideways a certain amount of pixels, if they either hit the left or right boundaries, or collide with another enemy they change directions. Would random firing patterns suit this style of enemy movement, or have the enemies firing based on the player being within line of site?
If the player is anywhere within +/-n pixels of your direct LOS, fire.
If the player is to the left of you and is moving right, fire.
If the player is to the right of you and is moving left, fire.
With those 3 rules, your enemies will fire on and off but at reasonable-looking times. It also has the tendency to fence the player in slightly making him dodge between the bullets.
Dave Mark - President and Lead Designer of Intrinsic Algorithm LLC
Professional consultant on game AI, mathematical modeling, simulation modeling
Co-founder and 10 year advisor of the GDC AI Summit
Author of the book, Behavioral Mathematics for Game AI
Blogs I write:
IA News - What's happening at IA | IA on AI - AI news and notes | Post-Play'em - Observations on AI of games I play
"Reducing the world to mathematical equations!"