Suggested Formal Description of the Behavior/AI of Bandits

J Young Kim

New Member
Contributor
Design
Formal Description of the Behavior/AI of Bandits


Before describing the behavior or AI of bandits, we first must define what a bandit is.


I will use the following definition:

“A bandit is an NPC (can be male or female), who’s main action is to steal items from other NPC humans or the player. Since programming motives would be difficult, the crime which the bandit commits will only consist of stealing (and hard code that the motive is the bandit either wanting to sell the item for money or just wanting the item, whether it’s vital to the bandit or just for no reason. In other words, bandits will not commit murder, arson, or any other crime that requires a heavy psychological component. In other words, to reiterate, bandits will only commit the crime of robbing/stealing.”


Another key thing to note is that the world of Terasology has no sense of law or justice, meaning that there are no established court systems. Thus, the only way to stop a bandit is to actually watch the bandit break in and take items. Bandits which have items will have a different character model, one that has a sack over the shoulder. Thus, when the bandit is seen with a sack by the player, then the player can call the ‘the police,’ which will automatically result in the bandit’s arrest (if impossible, another thing to implement: the ability to call the police). To make the game more fun, we can have the player attempt to memorize the face of the bandit, and when calling the police, the police can give three faces and the player will have to decide which face was the bandit’s (again, another thing to implement to make the game more fun).


With this in mind, I will define the behaviors of the bandit.


Naturally Occurring Behaviors

  • Default/Idle: The bandit will act as a normal NPC citizen. The NPC will interact with the player as if it were an innocent person. However, especially on nights which the bandit is planning to rob a house, then the NPC will not appear in the day. During the night, the bandit will rob others (explained later in the ‘Naturally Occurring Behaviors’). The crime will occur based on a variable of the bandit, which determines the frequency the bandit will rob someone. In other words, there will be no real motivation for a robbery.
  • Sleeping: The bandit’s concept of sleeping will be the same as any other NPC. The bandit will assume a normal sleeping position, which would more or less be lying down on a bed at home. We will not consider fugitives and thus, not consider the possibility of sleeping in dumpsters or trees.
  • Eating: The bandit will eat like any normal NPC. He or she will eat via the eating animations which are made available (some examples would be drinking soup from a bowl with a spoon, eating a sandwich with the hands, and eating a steak with a fork and knife). The bandit will most likely found eating at a restaurant or at home.
  • Robbing: As a bandit, it’s only natural for the bandit to be robbing people. The robberies will primarily involve breaking into a house, and take X items out of a chest. The break-ins will primarily involve going through the window or the door. Getting caught will result in the bandit exhibiting special behaviors, and not getting caught will result in the bandit going back home and act as if nothing occurred in the next day.
  • Drinking: The bandit will drink like any normal NPC. He or she will drink out of cup or bowl (if such an animation is created). The bandit can most likely be found drinking something at a restaurant or at the bandit’s home.
Special Behavior (Situation Induced):

  • Avoidance: This occurs if the bandit successfully escapes from being arrested, but was still seen by a witness. What happens is that the criminal will attempt to avoid wherever the witness appears. For instance, in a town square, if the bandit is present and the witness arrives, the bandit will leave town square. However, after X days, the bandit will resume its normal activities, assuming that the witness forgot the crime. In other words, while the bandit believes that the witness may recognize him or her, he or she will avoid the witness’s presence.
  • Covering the Face: Covering the face is an action which the bandit does by covering its face texture with solid black, with eyes only being visible, hopes that the witness does not catch his face. This way, he or she won’t get caught if the witness phones the police and attempts to describe the bandit. Covering the face is primarily when the witness catches the bandit, or when the bandit is attempting a getaway after being caught. However, covering the face doesn’t always occur. It’ll be more like a random algorithm, with each bandit created having a boolean of ‘hasAbilityToCoverFace.’ If the boolean is true, the bandit will cover the face in the situations described earlier. Thus, if the bandit is running away or is caught, and has the ability to cover the face, then the bandit will cover the face.
  • Dropping the Sack: Dropping the sack means that the bandit will abandon the items it was trying to steal. This will allow the bandit to run much quicker, thus helping the bandit escape. Dropping the sack will mainly occur if the bandit is caught in the streets, or in a fight and flight situation. Thus, if caught, and the bandit believes that the sack will just prevent his escape, then the bandit will drop the sack and make a run for it. The players can pick up the items and either return them to the chest or just keep them (now, that wouldn’t be a good citizen).
  • Breaking Window: This is a behavior which can occur during or after a break-in. The bandit can go through the window, take the items, and escape through the door or window. Likewise, the bandit can also choose to enter through the door, but escape through the window. Breaking the window will occur if the bandit feels that it’s the best way to not get caught during break-ins. Breaking the window during an escape will occur if it’s the best way out of a situation (i.e. player is near the door). Thus, if the bandit’s pathfinding/robbing algorithm believes that breaking the window and going through it is the best method of going in or out of the house to be robbed, then break the window and go through the window. However, the window will create a loud distinct sound, which the bandit will also consider, so breaking out will mainly be used for escaping purposes.
  • Swimming: The bandit will not swim, because it lives in a city and does not need to. Swimming is something that the bandit does if in danger of getting arrested. For instance, if the bandit is being chased by an apprehender, and the pathfinding algorithm of the bandit states that swimming across of body of water is the best option, then the bandit will swim. Thus, for code: if a method regarding if it’s a good idea to swim across returns true, then swim the path.
  • Fight and Flight Mode: When the bandit’s AI believes that he or she is caught and there’s no way out, then the bandit will fight the player or NPC and try to escape after doing so. For instance, the bandit is robbing the house and a player or NPC walks through the door. Since the bandit cannot ignore the witness, and if the exit is covered by the player or NPC, the bandit will start attacking the witness and once the path is cleared, the bandit will make a run for it. The NPC or player can choose to pursue, and based on the ‘stamina’ variable of the bandit, will either run for a long time, or just stop because he or she is out of breath. We can make it that a right click on an exhausted bandit “captures” the bandit and sends him or her to the police. Killing the bandit during the fight will serve as a “knockout” to the Bandit, and right clicking a bandit in such state will also result in the arrest of the bandit. Thus, for the code, if the bandit has no escape around the player or NPC (a new application of pathfinding?) or the player or NPC starts attacking the bandit, the bandit will fight its way out of the crime scene and attempt to escape. Failing to do so by either dying or be exhausted will result in the arrest if the player right clicks the bandit (arrest automatically if it was an NPC that caught the bandit).
  • Hide: In the case that the robbery occurred in a large building, or even a small one with many hiding places, the bandit will attempt to hide when an NPC or player nears. This behavior only occurs if there is a hiding space. The bandit will ‘calculate’ the vision cone of the player or NPC, and if there is a spot where the bandit can hide effectively, then the bandit will head to the spot. Of course, if there is an upstairs, the bandit will hide upstairs. In essence, if a player or NPC is approaching and there is a feasible hiding spot, then the bandit will immediately head there, even if he is in the process of robbing a chest. However, if the bandit is already escaping (i.e. via backdoor or window), the act of hiding does not override the escape sequence.
  • Sneaking in the Night: This behavior is induced when the bandit decides to rob the people. The bandit will follow a specific pathfinding algorithm, and will favor travelling through the following: tall grass and unlit areas, and will avoid travelling through: populated areas, lit areas, the police, and the main roads. The bandit will conduct this behavior before the crime, and after the crime, will continue in this manner unless the bandit fears that he or she has been caught. In other words, this is the default behavior for robbing others. Thus, while the bandit is engaged in robbery and the bandit is not caught/aroused suspicion, then the bandit will remain in the sneaking mode.
 
Top