Is this AI tool right for you? A RAIN{indie} review -By Dave Mark



GDM_slide

How does Rival Theory’s free development tool RAIN{indie} stack up? Here’s the rundown from the April issue of Game Developer magazine.

When the Unity engine came on the scene, it opened up the world of game development to a significantly wider audience. Unity allowed people to sidestep the knowledge, time, and frustration of the complicated process of creating their own rendering engine, lighting effects, physics modeling, and more. Instead, they could get straight to the process of creating worlds, levels, and ultimately games (which is, in and of itself, a complicated process). However, as tickled as people were to be able to dive into Unity and “make things,” one question kept coming up: How do I make AI?

Much like the other systems listed above, creating even simple game AI often takes a lot of investment in infrastructure. Even armed with Mexican food metaphors (see my AI Primer in the August 2012 issue of Game Developer), creating AI architectures is not an easy task. Unity users would simply be better off if there was a tool that allowed them to bypass the messy work of creating the underlying infrastructure and get right to the task of creating the actual behaviors. After all, isn’t that what Unity is all about? Well, that’s what Rival Theory set out to do with RAIN{indie}.

AI for free



I was originally introduced to Rival Theory a year ago when they showed me a brief demo of their initial product, RAIN{one}. Its successor, RAIN{indie}, has subtle differences, with a tightened feature set that focuses more on what the smaller developer needs the most access to. More importantly, while the original was a purchased product, RAIN{indie} is available as a free download. That’s a huge bonus to the small developer who may not have the budget for tools.

At the time of this writing, the tutorials and documentation of RAIN{indie} were still evolving, so I was given a tour of the new product’s features by Rival Theory founder and CEO, William Klein. I had already downloaded the product from their site, installed it, and taken a walk through their demo applications. These showed, in varying degrees of fidelity, the end result of what their behavioral engine could do. William’s explanation showed me how the tools are used to achieve those end results. I actually felt a little guilty for taking up his time - once I found out how simple many of the processes were, I realized I probably could have done it myself in short order.

RAIN{indie} is actually a number of different AI products in one. Included in the package are support for creating pathfinding assets, the actual pathfinding code, behavior trees, and a sensory system. The systems are fully separate and can be included individually as desired. Adding them to your project is similar to adding any other sort of Unity add-in. More importantly, once added to your projects, the modules themselves are accessible. This means that you can use them “as is” or in some modified fashion - even combining them with Unity’s default tech or that of another add-in. This flexibility, in and of itself, is something that should allow users to feel comfortable about incorporating RAIN{indie} into their projects without the chains, cages, or soul-selling that often comes with middleware packages.

Pathfinding with RAIN{indie}



The pathfinding components in RAIN{indie} include a voxel-based navmesh generator. Auto-generating a navmesh is as simple as adding a RAIN Recast object to your Unity scene, setting parameters for options such as the desired cell size and maximum traversable angle (e.g., 45°), and clicking Refresh Recast. Depending on your region size, you have a generated navmesh in seconds or minutes. Oddly, the generated navmeshes are grid-based rather than the typical “odd-shaped polygon” ones that many of us are accustomed to. At a cell size of 1, this makes for many cells - even in large open areas. The result looks more like an odd hybrid of a very dense nav graph rather than a true nav mesh. You can reduce the number of cells by specifying a larger size, but as with any resolution change, the fidelity of the auto-created walkable areas suffers. Regardless, the solution is certainly workable (see Figure 1).

** Figure 1: A RAIN{indie}-generated navmesh overlaid onto a level. (Note that semi-transparency is mine for clarity.)




On top of your navmesh, you can add waypoints to your environment, connect them to each other, and hook them up as paths to assign to your agents. Using the “waypoint gizmo,” navigation nodes can be dragged and dropped into the environment and automatically connected to each other based on raycast-based line-of-sight checks (see Figure 2).

** Figure 2: Editing waypoints to the scene with the “waypoint gizmo.”




In addition to pathfinding, RAIN{indie} has built-in collision avoidance and steering behaviors. It uses a form of “look ahead” steering that responds to terrain, static, and dynamic obstacles. I played with some of the samples in the steering demo (really just capsules gliding through an environment), and they performed respectably even when there was more than one dynamic obstacle. There was one agent in the demo who would get a little hung up on a combination of terrain and an obstacle, but managed to muddle through. To his credit, he was using steering only where a navmesh would have helped out the situation.

While not necessarily as robust in complex situations as more-involved, custom solutions, the steering in RAIN{indie} performed well enough to create intelligent avoidance in simple dynamic environments.

Sensory system and behavior tree editor



RAIN{indie} also includes easy-to-attach sensors that help streamline the setup of the agent’s detection of objects in the world. In essence, these amount to colliders that are looking for intersections with specified objects or types of objects. You can actually specify sensors for not only vision, but also for touch, sound, smell, and yes… taste. Really, there isn’t much difference between them - a collider of a specified size and shape, and some tags to define what it is attempting to sense. Theoretically, you could define the sense as anything you wanted: ghosts, tachyon fields, teenage angst, whatever. It is amusing, however, to hook up a “taste sensor” to your agent - if only conceptually.

While all of the above features are nice, the behavior tree component in RAIN{indie} is something that really caught my eye. For those that don’t know, behavior trees are becoming increasingly popular as the go-to architecture for crafting AI. They are both easy to understand and powerful - so much so that many of the triple-A games today are using some form of behavior tree architecture. Thankfully, because of how they are constructed, they also lend themselves to being constructed and manipulated with visual design tools such as the one included with RAIN{indie}.

Again, as with the other components in RAIN{indie}, attaching a behavior tree to a character only involves a few mouse clicks. Once that “mind” is in place, adding, moving, and editing nodes of the tree are fairly straightforward. Not only can you insert typical node types such as sequencers and selectors right from the tree interface, you can also assign animations, sound events, and more (see Figure 3).

** Figure 3: The behavior tree editor with the dialog for adding nodes to the tree showing the selection of possible actions.




Editing the entire tree graphically is as easy as dragging and dropping. This is important, of course, because, as with any AI development, constructing behavior trees is often a very iterative process. To not have to worry about xml braces, tags, indenting, etc. is very relieving. Also the graphical tree structure is easy to read and helps you visualize the overall structure of your AI. Key parameters for the selected node are exposed right in the tree editor so that browsing the tree is simple and intuitive (see Figure 4).

** Figure 4: A larger behavior tree expanded in the editor. Note that some of the parameters are editable from the properties screen.




Naturally the nodes themselves are not the end of the journey. If you want, RAIN will do a lot of the heavy lifting for you; the editor will create the scripts for you in JavaScript, C#, or Boo. However, depending on what your behaviors do or what decision logic you need to leverage, you may still have to write some code on your own. This is a very key point, though. The fact that the BT editor is writing code for you means that you can edit that code. Many middleware solutions are closed, black box systems; you do it their way whether you want to or not. With RAIN{indie}, you can lean on the system to do most of it on its own, or you can utilize only the framework and write the bulk of the code on your own. This is a huge boon that allows the product to scale gracefully from the casual interloper [is that the right word?] to the more advanced user.

Making it RAIN



All told, RAIN{indie} brings a lot to the table. I feel somewhat remiss as a reviewer since there is no way that I have completely kicked all the proverbial tires on the product. That means there might be more for me to discover - both positive and negative, of course. As they flesh out the documentation and tutorial videos, getting to know the ins and outs of the different features will certainly be easier.

Rival Theory seems to have accomplished what it set out to do, however: Make creating AI for Unity characters simple yet powerful. Another thing it certainly did right is the price. Regardless of any of the features, benefits, and caveats that RAIN{indie} provides, there is really no risk in giving it a test run.

Data box:



Product name: RAIN{indie} Company Name: Rival Theory URL: rivaltheory.com/rainindie Price: Free System Requirements: Any computer capable of running Unity (Mac/PC)

Pros:

  • Components are usable and editable directly in Unity
  • Graphical behavior tree structure editor
  • Hellooo? It’s FREE?


Cons:

  • Still only a framework - not a magic bullet
  • Documentation and tutorials still “in process”
  • Nonstandard, grid-based navmeshes


Author Bio:



Dave Mark is the president and lead designer of Intrinsic Algorithm, an independent game development studio and AI consulting company in Omaha, Nebraska. He is the author of the book Behavioral Mathematics for Game AI and is a contributor to the AI Game Programming Wisdom and Game Programming Gems book series from Charles River Media. Dave is also a founding member of the AI Game Programmers Guild, has spoken at numerous conferences, and was a co-advisor for the previous AI Summits at GDC.