Reputation: 2282
I'm currently in the process of creating an AI entity for my tile-based game. The game entails an AI character navigating to the players sprite, in order to inflict damage .Currently I use:
If Ai.SpriteRectangle.X < _sprite.SpriteRectangle.X Then
MoveRight()
ElseIf Ai.SpriteRectangle.X > _sprite.SpriteRectangle.X Then
MoveLeft()
ElseIf Ai.SpriteRectangle.Y < _sprite.SpriteRectangle.Y Then
MoveDown()
ElseIf Ai.SpriteRectangle.Y > _sprite.SpriteRectangle.Y Then
MoveUp()
End If
This this is rather deterministic and not would I would call AI. Where would I stand if I wanted to create a non-algorithmic opponent, which learns to avoid (dodge) fireballs fired at them by the Player? Are their any resources etc. Maybe via the use of a genetic algorithm...
I plan on studying artificial intelligence at uni but would like an early introduction.
Upvotes: 0
Views: 687
Reputation: 9484
I can recommend AI Junkie to you, specifically the section on agents. Judging by the level of your question, this seems like a good starting point: just construct an elementary state machine to group you AI's behavior. With that in place, you can add more sophisticated behaviors (basic ones like follow, approach, evade and such).
After that basic stuff is working, you could try to add more sophistication to the AI, but be warned that adding useful genetic algorithms and neural networks is very hard. In my opinion, at this point in time it is not feasible (especially for small score projects) as a smartly created, hard-coded AI will give a much better playing experience.
The site will offer first insights on all of these (note that there are multiple pages for each section: this might not be clear initally). The code is in C, but I think you won't have any issues following along. Finally, the book Mat Buckland wrote (the site's author) - Programming Game AI by Example - is recommended as to providing a gentle introduction into the subject.
Upvotes: 3