University Projects

NAIN - Artificial Intelligence Project

NAIN

Intro.

This is one of our project for Artificial Intelligence subject at the Jaume I University, in January 2019.

Summary of the game

This a video game about a Jewish man who is imprisoned in a concentration camp from which he will have to escape. In order to do so, he must avoid being seen by the guards as he goes through the different labyrinths in search of his mates and the switches that open the doors to his freedom.

Requirements

The game should contain:

  • Different movement mechanics for NPCs
  • Use of trajectory planning
  • Sensors and perception of NPCs
  • Decision making
  • Coordination of the NPCs

The team

This project was made with a group of 5 students from Jaume I University.

  • Verónica Martuscello
  • Alejandro Juan Peral
  • José Fenollera Faustino
  • Marcos de la Cruz Soler

Design Description

The visual design of the game is based on the use of 3D low poly models, among which we count the two figures of the Guards and the Prisoners, as well as the different scenarios in the form of labyrinths. All characters have various animations, so the guards can run, patrol and attack with different weapons (gun and bludgeon), and confined Jews can run, evade attacks and operate the buttons that enable the different actions that the game proposes.

As far as the conceptual design is concerned, every level will have a final door that the player will have to cross to pass the level. To open the door there will be several switches along the labyrinth. We can also find other types of switches that will turn off the light in the area, implementing a new mechanics that will help the player / prisoner to pass near a guard without being seen or alerted. In the same way, some levels have a trap for the player in form of a "plate" located at ground level, which will emit a noise alerting the guards of the area to come to that point, whenever the player passes over it, which is quite probable because it is mixed up with the ground and only a very slight brightness reveals its situation to the player.

The limitations that the player has as a Jewish prisoner are linked to his narrative "situation", that is to say, the character that controls the player cannot attack, because he doesn't have any weapon or enough physical force to do any damage to the guards vigilant; this is justified by aspect of truthfulness that we wanted to breathe into the game. Nor does it have more than one life, so if it receives a shot or a couple of direct blows, the prisoner dies ... and the level is reset.

Finally, it is worth mentioning the fellow prisoners that the player must rescue in the last level; without them, the final door will not open, forcing the player to look for them, guide and protect them until the last exit. These companions will be in position of "followers", reason why they will not be able to avoid any attack, and if in some moment they stop seeing the character player, they will go to the last point where they saw him and they will remain waiting for him until he comes back for them; said this, once they see him again, they will follow him again.

Artificial Intelligence techniques implemented at each level

In this game, pathfinding is the most important part since we control all the behaviors with it. For that, we implemented A* (A star) algorithm.

Pathfinding is the plotting of the shortest route between two points. The best path possibly is not the shortest way. A* combines the pieces of information that Dijkstra’s Algorithm uses (favoring nodes that are close to the starting point) and information that Greedy Best-First-Search uses (favoring nodes that are close to the goal) A* assigns a weight to each open node equal to the weight of the edge to that node plus the approximate distance between that node and the finish. This approximate distance is found by the heuristic. In other words, the heuristic decides which is the best way. There are many different heuristics that can be possible in one problem, but we used euclidean heuristic. To calculate the path we need this information in each node:

  • G Cost: Represent the exact cost of the path from the starting node to actual node
  • H Cost (Heuristic): Represent the heuristic estimated cost from actual node to the goal node.
  • F Cost: G Cost plus H Cost
  • To calculate the euclidean distance of our heuristics, we use the following function:

    D and d is a scale that matches our cost function: d is the minimum cost for moving from one space to an adjacent space and D in the cost of moving from one space to a diagonal space (octile distance).

    For the implementation of A* we need two sets of nodes: Open and Closed. The open set contains those nodes that are candidates for examining. Initially, the open set contains only one element, the starting node. The close set contains those nodes that have already been examined. Initially, the closed set is empty. Because we required a path at the end of the search, we keep with each node a reference to that node’s parent. At the end of the search these references can be used to recover the optimal path.

    Our grid of nodes is a square grid. We decided the size of the grid and the size of each node. Then, we create the grid of nodes taking into account the size of the nodes and the size of the grid. Also, there are unwalkable objects that we avoid when we calculate the path.

    Steering behaviours

  • In alert state is triggered when the enemy see the player, the enemy makes a pathfinding with the A* algorithm to the last known position of the player, then follows the path and also updates the position if he can see the player.
  • Patrol state is the enemy’s basic state in which he follows a route of points until he receives an alert, because the player has made a sound or because another enemy can see the player.
  • Attack state is the action of hitting the player in specific circumstances, when the enemy is a melee type, It should be in a closer range than X units to make the attack. If it is a shooter, it should be further away than X units and closer than Y to shoot (X and Y change between levels)
  • Searching state is the state in which the enemies have seen the player but they can’t see him right now so they look for him in an area around the last position where they saw him.
  • Alert is produced when an enemy hear a sound and it go to the position of the origin of the sound in a range of X units, they do this work with the A* algorithm and they can hear the sound even if they are behind a wall.
  • Follow the leader is the behavior that the hostage has when it is released by the player and consist of following the player with the A* in order to dodge obstacles.
  • Communication and coordination between enemies: Sounds and round up

    The enemies have got “walkies” to send warnings between them, we have represented this with a range in which the enemies detect the playero chen another enemy has detected him, they try to go through different paths to overthrow the player.

    Detection systems

  • Metallic griddle: It is a griddle on the floor that makes sound when the player walks over it, alerting nearby enemies of the player’s position.
  • Light switch: Is a switch on the wall that allows the player to turn off the light and disorient the enemies for a few seconds. If the player was being chased by an enemy, It stops the pursuit.
  • Door switch: Is a switch that open the door to the room that connects with the next level.
  • Vision cone: Is the graphic representation of the enemy vision in the game, when the player enters inside he is detected and the pursuit begins.
  • Hearing radios: Is the zone around the enemy where it can detect the player even if it isn’t looking at him. As with the vision cone, if the player enters the range, the enemy will detect him.
  • Back to projects To main page
    Contact

    I'd Love To Hear From You.

    You can contact me by Twitter, LinkedIn or email.