01/10/2018 - AI In computer games (Algorithms, Heuristics and Hacks)


AI in games:


Algorithms – The maths and coding behind it.
Simple set of rules in the form of an algorithm to simulate real world behaviour, these sets of rules come in the form of code. Pac man for example has code in the ghosts which at first seem to randomly rotate around the map until the point pacman progresses so far into the map at which point they seem to be chasing the player. This is because of an algorithm coded into the game by the creators within the code.
Another case of this is a game recently released on the Xbox one called Divinity original sin 2 where the characters can go into a stealth mode and there will be a red outline surrounding enemies, this red outline is the enemies line of site and should characters make a noise or have too low stealth the enemies will actively look for them, if not they will be detected upon entering the red zone. They also have an algorithm set to all NPC’s (non playable characters) whereas if the players should do something negative the NPC’s who witness it will react negatively and either attack or dislike the player, this has effects such as higher prices if they are a shopkeeper or the information that they will be giving out. The same effect happens if the character does something good and they can then get higher prices.
Image result for divinity original sin 2 stealth

This is the stealth mode in Divinity 2 as previously mentioned, it shows the line of sight of all enemies within an area and shows areas they cannot see due to their line of sight being blocked. 

Image result for divinity original sin 2 attitude check

This image shows the previously mentioned attitude system showing players getting a positive response, A higher attitude towards players gives benefits such as those NPC's being nicer to the player, giving discounts on items they may trade and being more willing to give information on certain subjects/missions.

Heuristics – The methods and processes behind the learning of the AI.
Heuristics are strategies that are derived from previous experiences with similar problems, for example learning what specific characters do and enemies’ movements etc. The role of heuristics is to produce a solution in a reasonable time frame that is good enough for solving the problem at hand because of the previous experiences. Trial and error is heuristics in its simplest form except at a high speed, this didn’t work so I will try this.
There needs to be some sort of line drawn where an AI actually makes the game enjoyable and challenging for the player but not just outright impossible. If the heuristics behind the AI were absolutely perfect then they would be unbeatable and players would not want to keep playing the game as the AI would be learning every way in order to beat them.
1 optimal: when several solutions exist for a given problem, does heuristics guarantee that the best solution will be found? Is it actually necessary to find the best solution?
2 completeness: When several solutions exist for a given problem can heuristics find them all? Do we need all of the solutions? Completeness is looking at every possible solution and outcome of specific actions. Completeness isn’t fully needed as there isn’t an actual need for the AI to know every single outcome of every possible action.
3 accuracy: Can heuristics provide a confidence interval for the purported solution? Is the error bar on the solution unreasonably large? As a player you want to be able to exploit mistakes of the AI to the point where it provides a challenge but isn’t too easy whereas wanting the AI to learn without making the game too difficult.
4 execution: Does it execute as you imagine it would? Does it do what you think/hope it would?

Image result for hello neighbor ai

A great game to define Heuristics is a game called Hello Neighbour where the AI gets smarter the more you play the smarter the AI gets. The aim of the game is to get into your new neighbours house and see what he is hiding in his basement which is nailed shut, your aim is to not get caught, his aim is to catch you.  The AI of this particular game is actually made to learn from actions you take so if you keep taking the same routes and hiding in the same places he is more likely to find you as he learns what actions you take and adapts his actions accordingly.




Hacks – Help to break you out of the immersion, for example they make you think oh this is OD and alter the overall perspective.
Two possible ways forwards with hacks:
A player hacking the game using hacks, this is in relation to games but not in relation to the AI.
AN AI entity which is using information which they shouldn’t have access to. For example the AI acting in a way you don’t expect them too such as the AI automatically knowing exactly where you are currently hiding as the AI knows you are there but the NPC they are controlling shouldn’t be able to see you. This can be triggered by a number of different possibilities and it’s a way in which the game can trigger a state of disbelief where the player thinks oh hang on this can’t actually happen. This is the concept of hacking in terms of the AI entity. A cut scene is a perfect example is a hack as it breaks your control of a situation for a brief amount of time. A hack is a piece of code which forces an AI character to respond in a specific manner.

Image result for halo 3 ODST drop pod scene

Whilst a slightly older game as standards go now Halo 3: ODST has a great example of a cut-scene blending perfectly into the game as the game opens with the character entering his drop pod and said drop pod colliding with some debris and being knocked off course, the character then lands in the city and their pod is lodged into the side of a building, the player is then seamlessly given control of their character and are told to move their camera to locate a lever to pull in order to release themselves from their pod. At first you don't know you are given control of the character until a button prompt pops up on the screen telling you to move the thumb stick to move the camera. 

Immersion – Being so within the game that you lose track of reality.




Comments

Popular Posts