Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I have a non-released game, and currently it's only possible to play with another human being. As the game rules are made up by me, I think it would be great if new players could learn basic game play by playing against an AI opponent. I mean it's not like Tennis, where the majority knows at least the fundamental rules.

On the other hand, I'm a bit concerned that this AI implementation can be quite complex. I hope you can help me with an complexity estimation. I've tried to summarize the gameplay below. Is this defense AI very hard to do?

Basic Defense Game Play

Player Defender can move within his land, i.e. inside a random, non-convex, polygon. This land will also contain obstacles modeled as polygons, that Defender has to move around. Player Attacker has also a land, modeled as another such polygon.

Assume that Defender shall defend against Attacker. Attacker will then throw a thingy towards Defender's land. To be rewarded, Attacker wants to hit Defender's land, and Defender will want to strike away the thingy from his land before it stops to prevent Attacker from scoring.

To feint Defender, Attacker might run around within his land before the throw, and based on these attacker movements Defender shall then continuously move to the best defense position within his land.

share|improve this question
2  
An AI capable of playing the game is probably not needed for a tutorial. You could record and play back the actions and force the player to place/move where you need them to for the game to make sense. This won't require any additional AI that your game didn't already have. And can be very effective at training players. KISS –  DampeS8N Dec 19 '12 at 18:24
    
Yea, but I also think it would be nice for players to be able to play against the device. But as I said, I have worries about the complexity. And I agree, KISS FTW! –  Fredrik Johansson Dec 19 '12 at 18:33
3  
You'll probably want to break this question down into smaller parts in that case. AI is a huge space with many options. You'll want to start with movement, such as with A*, and move into decision trees and the like. There will not be one single AI you need, you'll need a collection of techniques to get the job done. Mimicking people is not easy. –  DampeS8N Dec 19 '12 at 18:40
    
@FredrikJohansson I can give you a solution but I need to know two things: whether the world is 2D or 3D and the shape of the trajectories of the projectiles (2D world with straight trajectories for the projectiles or maybe 3D with the projectiles having parabolic trajectories like cannonballs?) –  madshogo Dec 20 '12 at 21:23
    
Thanks @madshogo! It's a 2d world, with straight trajectories. You see the players, and their lands from above. –  Fredrik Johansson Dec 20 '12 at 22:47

1 Answer 1

up vote 1 down vote accepted

That sounds pretty complex to me :/

As an alternative, perhaps you can make a scripted tutorial that the user can step through. If all the events are pre-determined you won't need any AI at all.

Otherwise you'll need to break down each component (as DampeS8N suggests). Identify the actions you'll need your AI to take. Finding a path, targeting a "thingy" and hitting it away are all things you'll need to do. As you delve deeper into this, you'll find a dozen more little things you'll need to detect/react to.

share|improve this answer
1  
Oops. @DampeS8N, I just saw that your first comment suggests my alternative. So I pretty much lifted your answer. You should make an answer and I'll delete this one. –  Byte56 Dec 19 '12 at 19:48

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.