Development Blog: Boss AI
Updated: Apr 21
In a typical 2D platformer game, you restrict your level to fit into predefined squares. This makes it pretty easy to process this data with an A* pathfinding algorithm. The white squares are walls. Our goal is the develop an AI compatible with game physics and to handle this we added mass and gravity to our game levels.
The first step, is to define an area that we will use to generate and calculate the clifs(orange points). We do this by creating a GameObject (Jump points gameobject), and setting its position and scale. This will be the area enemy will use to understand when to jump. So the logic basicaly enemy follows player when it's in range and after hit the Jump point will jump on the other side of the cliff. This basic diagram designed for the game level called 'Deep'.
This was intended, but could easily be changed if we didn’t like this maneuver. The simplest way to change this would be to remove that Jump points altogether. That way, the enemy wouldn’t even know that it could jump off of the platform. It would have to find player to attack only(basic bandits AI on platform works like this). To move AI around, and the solution is actually pretty simple. All I have to do, is to shoot 4 rays out of two different positions (left and right) around the AI, and check whether it detects any obstacle (wall, floor tiles). If it detects need to stop and wait till player come back to area. You can add more conditions to AI and give him lot of decisions so I've decided to make an AI which doesn't need to depends on the waypoints and honestly, that’s ALL we need to do.
"Intelligent agents need to be able to make predictions about their environment if they are to deliver on the promise of advancing different technology applications," says Guzdial. "Our model can be used for a variety of tasks in training or education scenarios, and we think it will scale to many types of games as we move forward."