RIT Networks

From The DarkMod Wiki
Jump to: navigation, search

Contents

What are RITs?

RITs (Random Interesting Things) can be used to make your AI more interesting, unpredictable and challenging. More lifelike AI can be achieved.

How Do They Work?

For RITs, there are two types of path nodes: decision making nodes and normal nodes. The decision making ones are always path_waits and normal nodes can be any kind of path entities. The core idea behind RITs is the following:

RIT basic.png

The blue boxes are path_waits. They should have wait 0 and the angle spawnarg removed. These path nodes are used as the decision making nodes. The AI does not need to walk to them, but it will choose some of the path nodes the path_wait is targeting. The red/green boxes mean any kind of combination of path nodes. Typically a path_corner to make the AI to walk to a certain location, maybe a path_anim to make the AI to play an animation there, and maybe a path_wait to make the AI stand still for a while.

As you can see, the basic idea is that the AI targets a path_wait (enter), which doesn't do anything else, but sends the AI to some of its targets. The AI then goes and does one of the things dictated by the path_wait decision making node. Once the AI has gone through one of the paths, the final path node in that path targets another path_wait (exit). This exit path can then target what ever the mapper wishes, as long as the decision making nodes form an endless loop. If there is no loop, the AI will eventually stop and the path route terminus.

Practical Setup

1) Build a room with RITs. A statue. A few chairs. Maybe a lit fireplace.

2) On each RIT place the necessary interaction path_nodes to make an AI interact with them: path_corner to walk over to them; path_sit on each of the chairs, path_anims for warming hands at the fireplace and standing in front of the statue and pondering, etc (A, B & C in image).

3) Place two path_waits (1 & 2 in image) on the ceiling of the room. (They could be anywhere in the room, but it is easiest to manage if they are in the ceiling.)

4) Name one of the path_waits "enter_room_decide_what_to_do." (1) From that path_wait target each of the RIT path_corners. Set the path_wait "wait 0". so AI won't stop there. The idea is to use the path_wait as a simple decision making node. Be sure that the path_wait has no angle-spawnarg. If it does, the AI will turn towards the angle each time he targets the node.

5) Name the other path_wait "exit_room_decide_what_to_do." (2) Make each RIT final path_node target this path_wait. Make the path_wait target other rooms with similar decision making path_waits.

6) Done.

Rits.jpg

AI will come into the room, select A, B or C at random, and then leave. Next time they enter, they'll again pick at random.

This could be used to make servants to run around a mansion, cleaning, making food, taking sitting breaks, visit the toilet, etc. You could build room decision making network separately for different AI. Servants clean, cook and take breaks. Guards patrol, make random deviations once in a while, and of course take breaks. Controlling the RIT path_corner chance-spawnarg gives you control what RITs the AI do more likely.


Example RIT Network Setups

The common situation in a map is a guarded location. The mapper could build a common RIT network for all the guards in a specific location. The mapper might still want to place static (or the RIT door guard setup) to ultra critical areas that must be manned at all times. Guard RIT patrol routes are fantastic for those ordinary patrolling guards. The benefit is that you only need a single network that can handle multiple AI at once. Also you can later inject more guards (for example sleeping AI that got alerted) into the network without the need to build individual patrol routes to new guards. The mapper could also inject additional guards in the network based on the difficulty the player chooses.

The Basic Guard Patrol RIT

The basic RIT guard network concept looks like this:

RIT guard.png

The green boxes are a static route the AI follows. They are path_corners. At some point the route either continues along the normal static route, or sends the AI to a side track RIT network. See the basic RIT unit to understand what the teal RIT circle means. Basically the AI goes side track, visit a room that is on his route. The mapper can use the chance spawnarg on the RIT enter path_wait, to control how likely the AI is to take the side road. The RITs might be room specific. AI guard RIT in the kitchen means snack time, side track RIT in the main hall might mean sitting down and chilling for a while.

Note the shortcut in the rightmost RIT circle. RIT exits could make the AI take shortcut or even make the AI go back in the opposite direction. This is a good option to consider as you see the RIT patrol would always take a clockwise general direction. If there was a single anti-clockwise path, which the AI could occasionally take, the RIT would function in all directions.

The Basic Servant RIT

Servants do something else than the guards, therefore they should not use RITs designed for guards. An example of a good servant RIT network is presented here.

RIT servant.png

As you can see, the setup is room specific and there are no static patrol parts. Note also how the RIT cycles target each other and even themselves. This means that the servant roams to a room, doing tasks the RIT sidetracks make them do: cleaning, cooking, etc. Since the RIT circles target themselves, (and if the "exit" path_wait targets the "enter" path_wait of the room the AI is currently in with a high chance) the servant can spend some time doing tasks in a single room. Then after a while he moves to another location. Servants could thus be anywhere: cooking, cleaning, getting a bottle of wine from the cellar, sitting in the backyard for a break, etc...

The Basic Roaming RIT

Sometimes the guard and servant RITs are not enough and you need to do something specific. Maybe the lord of the house is strolling around the house and the manor grounds. Maybe there is a thief lurking in the city. Maybe there are some random civilians walking around. In these cases roaming RITs are good option.

Roaming RIT.png

In this setup, the AI uses a single RIT circle, but the circle is spread across the whole map. The "enter" path_wait can send the arbitrarily anywhere in the map. Once the AI reaches the goal the "exit" path_wait targets again the "enter" path_wait. And again the AI goes somewhere totally else. This kind of AI can be really surprising as the AI can indeed be walking between any of the two points, giving large amount of different scenarios.

The Basic Door Guard RIT

The Basic Door Guard RIT is a good option for static guards that are supposed to guard a single critical location. In old thief games these were the guards that stay put, but turn to look the other way every now and then. With RIT version you can do exactly that but you can do so much more.

RIT door guard.png

The basic idea is that there is a normal repeating RIT cycle ("enter" targets path nodes, which target "exit" which targets "enter" again; an endless loop.) In this case the AI is guarding the door. The mapper could build an interesting RIT network for all kinds of random stuff a bored door guard might do: take leak, get a snack, walk around a bit, etc. The thing is, that the mapper simply sets the chance spawnarg on the "guard door" path nodes (a path_corner, a path_anim (look around) and a path_wait) so that the AI spends 75% or similar time of the cycle at the door. Then occasionally the AI would leave the door and take the break action the mapper defined. In practice, the mapper could set the chance spawnargs so that the important path node chance sums up to 75% near the important door. In this case, the path_corner_1 near the door would have chance 0.37 and path_corner_2 chance 0.37. Some of the remaining path nodes would then be targeted at a 26% probability.

Putting Even More Life to the AI

RIT increases the liveliness of the AI but you can push the immersion even further. For instance, you could place trigger_entityname -entities in places where the AI of a certain name walks past. When the AI walks through the trigger, a conversation would be triggered between the passing AI and a nearby AI. A good example of this are all the conversations encountered in the Phrase Book mission. Designing the conversation so that you can mix and match different lines so that the discussion still works, would create a scene where AI behave like real people and occasionally stop and have a random chat.

RIT Troubleshooting and Testing

As the networks can seem quite complex at first, one might think that troubleshooting them is very difficult. It is not. You can simply test you RIT networks by letting you map run for a long time. If there are some mistakes that break the cycle, the AI are standing near the path entity that failed to send the AI back into the RIT network cycle.

One way to efficiently test your RITs is to create temporary AIs in the map so you have large amount of AIs testing the network.

If you generate a particularily challenging RIT branch for the AI (using path_nodes you are not familiar with, for example) it might be a good idea to create a test AI or a few which directly target the branch and check ingame how they manage.

When creating separate guard partrol RITs, servant RITs and roaming RITs in your map, it might be a good idea to use the DR layer function so that you can hide all the non-related path_nodes and focus on the one RIT you are creating at that time.

Sitting and Sleeping RIT AI

This is important. If you have sitting and sleeping AI in you RIT networks, be sure to put an extra path_corner so that the AI always walks away from the bed or the chair after they finish whatever they are doing there. If such a path is not set the situation might go like this:

1) AI comes to bed, goes to sleep
2) AI gets up, targets decision node
3) By chance, decision node tells AI to go back to sleep
4) AI goes back to sleep, but is too close to the bed and gets stuck.
5) AI gets stuck.

By adding a path_corner that makes the AI to walk away from the bed to a safe distance:

1) AI comes to bed, goes to sleep
2) AI gets up, targets the walk away path_corner. AI moves away from the bed.
3) The AI targets the decision making node.
4) By chance, decision node tells AI to go back to sleep
5) AI goes back to sleep, but is safely away from the bed so he walks to the bed and goes to sleep without issue.
6) All is well

Example map

Here is a basic map for mappers to use and learn from - Link 1, Link 2 & Link 3

Conclusion

RIT networks are a nice and relatively simple way to add liveliness and unpredictability for your AI. It also makes it easy for the mapper to inject more AI to the mission flow if needed. However, the added unpredictability increases the mission challenge and difficulty so the mapper should be careful how many AI he adds to the networks. Generally a good RIT has the possibility of sending AI to any location in the map, but the probabilities should be tuned so that the golden rule of location security levels still apply. (Meaning, that the map has areas of varying danger: low tension, medium tension and high tension)

Personal tools