So here's a crazy simulation showing off the result of dozens of AI boulder players trying to navigate a level simultaneously.

Cool, isn't it? So if you wish to know how we're getting these results... read on!

One area which ROA1 could have been better was the boulder's AI. As we went into ROA2, we had to find a system that was both efficient and also easy to use for level designers. After trying different approaches we ended up implementing a path system in which a human player navigates a level to record speed and jump values of how to finish an empty level (no obstacles). The resulting information can be seen represented in the following spline:

As you can see this level (which happens to show a nice preview of the Renaissance art period) has a few jumps and turns and can get quite narrow for a boulder attempting to navigate at top speed. This path shows the most obvious and "safe" path to complete the level, where no risky/difficult jumps have been taken during the recording process.

In the spline you can see how the green vectors are representative of the direction and velocity (given by the vector's length).

However we want our AI to sometimes attempt shortcuts, and for this we record play sessions with riskier routes that require better timed jumps and control, as can be seen in the following two examples.

When the game is running, the AI boulder doesn't simply move through the paths we have predefined - these are there as markers which give a hint to the computer of when to jump and what speed to move. With more prerecorded sessions (done by a human player), the AI has more information to help it know how to navigate the level properly. When knocked away, or even when falling off the level, the AI can re-adjust and use this navigation map to properly move through the level, and that result is the animation at the beginning of this post, which I share here again.

The way the boulder evades obstacles is a different system that works in conjunction with this ...but that is a topic we can talk more about in a future blog post. Hope you enjoyed this quick insight into the development of ROA2. Remember this post when you play the game later on and the AI beats you

Interesting (I've been playing with some AI stuff lately: http://sandbot.bots-united.com/). How many predefined paths are used per level? And how is the path data aggregated or processed to determine a path for the bot?

I can't give a very elaborate answer, since the design behind the system was developed by our Lead Programmer; Leo. We haven't done a final compilation of paths on any map, but I'd expect we'll produce at the very least 5 variations per level, to cover all routes and to ensure there is a lot of variety. It'll probably be more than 5 in the final game. Remember that these are not 'fixed paths' that the AI adheres to strictly, but more so 'guides' to help it understand what are the best routes it can use.

We have a cool set of tools that allow us to record paths and re-do portions in case we miss a turn or a jump. These are stored in the level.

In Rock of Ages 1 the system AI we used was completely different, and based on some vehicle code mixed with standard pathfinding tools (I think).