profile-image
blog-image

Video Game Dev: Teach a Ball AI Player a Game called Bumper Balls


It is very hard to teach AI how best to attack a player and push that player out of bounds.

I've been playing with the AI to get it to "see", "target", and "move towards" the player. The hardest part is teaching the AI to compensate each time you move out of the way.

You'd think..."Lets have the AI barrel right at the other player as quickly as possible"...but with AI that is not the case!

The ball ends up going as fast as it can so once it passes "the threshold of no return" it can't compensate direction of attack. You can see it miss by a great deal.

What about making the ball slow down at the right points for move smooth movement?

What happens is it doesn't slow down enough to change direction. I'd have to have it slam on the breaks when it gets closer. The other option is to increase the breaks the closer it gets to the player but then at the cost of speed. That is the point isn't it? Ram the other ball as fast as possible with the goal of knocking it off the level?

The only way I can figure to do this is detect the angle of attack is off from the destination angle. Based on how drastic the ball will miss is how much force left or right should be applied. This is like adding boosters to the side of the object that go off to "auto correct". It is the same as "strafing" except this is a 3D ball not a person.

Hopefully I'll figure it out and post a successful video.

I'm actually surprised I even got the AI system working properly.

If you guys are asking...no this isn't unity game engine :P