When I first created the local game I made all players that were not controlled by people just go back and forth just to add something dynamic to the game. However these were not especially fun to play against. The game is still designed to be a multiplayer game for four people, but since I want anyone to be able to just click play and get started immediately I still need the other players to move which is where the AI comes in.
I started working on the AI yesterday and made it move in the direction the ball(s) were relative to the paddle. This was easily done by just taking the dot product between the paddle’s forward vector and the vector between the paddle and the balls position + a vector in the direction of the balls velocity, making it look like its predicting the path of the ball. This way the paddle moves left or right to always be able to deflect the ball. And this is exactly what it did as long as there was only one ball. With two balls it did miss the ball sometimes since it prioritized the ball closest to the paddle and could only move with the same speed as the player.
However it is not very fun to play against an unbeatable opponent, so what I have done today is tried to make the AI more dumb, while still appearing intelligent. The way I did this was by only tracking balls that were moving in the direction of the paddle and are within a certain distance from the paddle since this is how many real players think (and moving towards the middle when the balls are moving away). The result is fairly good and is not impossible to score against, albeit quite difficult. Since I am making a multiplayer game I have decided to keep the AI in this relatively good state and not spend more time on perfecting something not central to the game but instead move on to the powerup(s) and other things concerning the logic of the game.