What is AI Jumping?
Updated: Dec 18, 2020
One of the most overlooked but vital aspects of Ai movement is their interactions with jumping. While there is tons of papers and research surrounding many other Ai topics, jumping is untouched and leaves lots of room for different and varying types of interpretation. With jumping comes an inherent skew of issues due to jumps being more risky than other Ai programs.
The said jump could fail
the target doesn't get enough speed to clear the jump
they are displaced by a physics system in the middle of there jump
a failed jump could also end in death for a pursuer
More room for error in a jump then regular movement
To make the jump, the Ai needs to check to make the sure they are moving at the correct speed, in the correct direction, and that the jump is used at the correct time or a failure could occur
Regular steering algorithms were not designed to incorporate jumping
Now to start understanding the best way to tackle an Ai jump we have to deal with what is clarified as a jump. In game logic a jump is made of three points, the jump off point, the midair velocity, and the landing point.
Oddly enough the simplest support for Ai jumping is some strategy that is more focused on level design then game programming. Jump points are for a pad on either side of a gap that acts as the launching point of the jump and when the character reaches a starting area for any of these jumps, they are then launched across if they have achieved the needed minimum velocity.
This doesn't work for every jump however because if the platform doesn't fit a failure is bound to happen
To achieve said jump we must combine our jump pad with our Ai pathfinding system and have it operate so that if the target we are pursuing crosses this gap the pathfinding will be rerouted to the correct jump pad that it can determine to be possible instead of to the ledge. Once it has determined the jump pad it will then accede the correct velocity and direction for that jump and launch the second it hits the pad.
One weakness with this method is that the jump simply does not contain enough information about the jump to be universally used across every jump case. Depending on the difficulty of the landing area some velocity calculations have to be more exact than others, also, some failed jumps may be more important than others (drop into water or a drop into lava) and the jump doesn't have any way to prioritize that. Unless we use…
Adding a landing pad to a jump point is significantly less risky than using one without. Instead of launching a character across the gap hoping it lands on geometry; this gives the Ai the ability to calculate its own velocity so it can predict its landing location.
This is the equation used to calculate the trajectory of the jump
S - Starting point
Sx - Starting point x value
Sy - Starting point y value
Sz - Starting point z value
E - Ending point
Ex - Ending point x value
Ey - Ending point y value
Ez - Ending point z value
v - Velocity
vx - Velocity x value
vy - Velocity y value
vz - Velocity z value
g - Gravity
t - Time
Once the Ai navigates itself to the jump pad's location and has determined the jump to be doable, the function calculates the velocities needed and applies them to the character landing them on the jump pad.
Now we have seen giving information to the Ai to do all the jumping calculations, we are now going to discuss giving all of the information to the jump itself in the form of jump links. Jump links are relatively the same as jump and landing pads except all of the trajectory information is stored in the jump itself. This allows for easier implementation with pathfinding Ai as the jump links are part of a pathfinding network as they are using the pathfinding information to return the distance between the gaps then apply our functions to jump across that distance.
I made a Unreal project to show off jump links for my Game Ai Final and the following images are from that project.
Uses for Ai Jumping
Ai jumping again is the most vital due to the variety and games this system can cross, from 2D to 3D, first person to sidescroller, Ai jumping has a place and every version of these games so all of these methods could be transferred to any of those options. Some of the most impactful genres that Ai could effect would be platformer genres as most of those are driven by jumping mechanics so the system would have to be near perfect. The developers at Awesomenauts used Jump links for their 2D platformer pathfinding system by placing nodes over there five different levels and this saved them hours of work developing a new method.
While when discussing Ai in video games people often don't mention jumping but with a variety of methods ranging from physics based to incorporation with other Ai algorithms it is one of the most vital system in Ai.
Games), J. (2015, April 02). Teaching Awesomenaut's AI Where To Jump. Retrieved December 18, 2020, from https://ctrl500.com/tech/teaching-the-ai-to-find-a-path-in-awesomenauts/
Millington, I. (2019). Artificial intelligence for games. Boca Raton: CRC Press.
Persson, M. (2006, January 26). Development of three AI techniques for 2D platform games. Retrieved December 18, 2020, from http://www.diva-portal.org/smash/record.jsf?pid=diva2%3A4762