Goal keeper AI

Hey guys,

I am working on a little soccer game and I was wondering if anyone has any ideas how to program the AI of a goal keeper, specifically when taking penalties. In best case, it should not be predictable and that easy to score.

Hope to get some great input from you guys :slight_smile:

Thanks

During a penalty, just roll a dice of 6 sides for each direction the goalkeeper can jump towards (or stand still) and hope the best that ball will collide with him. This would be very cheap but random solution i guess.
Or,
You just calculate the trajectory of the ball and jump your goalkeeper in that direction with random speeds that will give variation.

1 Like

or, create the perfect goal keeper AI first, then add some randomization to make him worse.

random = randomize(0,5)
move goal keeper to (ball position x + random)

the randomize variable would depend on your scale.

1 Like

I think there was an old soccer game example somewhere on the wiki, it might be a good reference…

I found the link! It’s the first post (on the fifth page)HERE.

Hope this helps!

PS The project was made in Unity 2.

Grrr. Why soccer… WHY?? :frowning:
Football.
Fussball.
jouer au foot.

soccer.
Any one see what has happened here? xD

The Toffs invented it :smile:

http://en.wikipedia.org/wiki/Football_(word)#Etymology

But no madder how you say it, soccer/football is the best sport ever! :wink:

I hasten to disagree. I hat football. This country is obsessed with it. But I just yawn at it. Oh well.

As an American, I can say it is called Soccer because Americans don’t learn about other cultures, we just do random things for instant gratification! I think Soccer should be called Football like other countries, and American Football should be called “Egg shaped dead cow skin toss then man orgy pile-up”.

I don’t really like either sport though. Sorry this has nothing to do with the post, but I am bored and thought I would throw in my two cents.

“Run three yards, fall down, pile up, run three yards, fall down, pile up.” ~Link from Shall We Dance

For some reason I did not get an e-mail confirming reactions. Thanks for all your reactions and I will digg in and reply back on your comments!

The silly thing is, he didn’t work out the keeper :smile:

Opps! :smile: Sorry! :stuck_out_tongue:

I personally would have the goalkeeper move to the ball on the same axis as the goal but i would add some degree of randomness on how far he moves. If you wanted to change the difficult then you could just change the level of randomness.

This would make the goalkeeper move in the direction of the ball, if you dont want the goalkeeper bouncing back and forth while the balls on the other side of the field you can check it on the axis perpendicular to the goal to make sure the balls within x range.

You could possibly have him look at the ball object and then when the player shoots possibly a slight delay and then a reaction, and especially with penalties half the time the goal keeper dives in a random direction and it is just chance if he saves it so in some respects you could just have a random unpredictable sequence.