Thursday 14 November 2013

AI In Games

Ever since the advent of video games there existed the concept of automating behaviour. Where an NPCs (enemies and allies) does things of their own "will". Of course we all know NPCs in video games do not have their own wills (or do they?) but instead enact certain actions depending on a predefined set of parameters.
"GOOOOMBAA! GOOOOMBAAA!"
A good example is the goomba in Super Mario Bros. Within the game the goomba's behaviour is rather simple, after it spawned or loaded into the game it acts in a specific way depending on preexisting parameters. Those most likely being:
-  move in given direction (left or right) until gooba collides with wall (or pipe) then reverse movement direction
- if collides with player, deal damage. UNLESS the player collides with the goomba from the top A.K.A the player jumps on the goomba, in that case DIE (stop movement, play death animation, and remove goomba from the game).

But as time went on and games became more and more sophisticated they required the NPCs to perform more complex behaviours such as flanking in an FPS or getting offended by a player's response in an RPG. Eventually These behaviours got around to being called artificial intelligence even though the behaviours are still being based on these predefined parameters.

Though there are still problems that arose with the increase in complexity of NPC AI such as:


OR


The field of AI is constantly improving and expanding, striving to improve itself to make NPCs more dynamic in performing complex and simple actions, such as navigating a level (but when I say "simple" I mean in terms of the action itself not the design and implementation). An old method of AI navigation through a level was to create path or a set of points or nodes in a level which the NPC would follow like a bread crumbs, though with the nodes the NPC would have to either already have the location of the next node or they would detect the location of the next node. This was created very rigid AI in that the NPCs were limited in there behaviour to a certain path. But don't get me wrong, this does not mean that this method is bad. In fact, this can be quite useful for sequence heavy games, in other words games that progress in a very controlled manner such as the Sherlock Holmes games where the player cannot really influence the environment outside what the what the game allows. Facepalm* ugh, I can't believe I just wrote that. I was going to erase that sentence but I decided to leave it in, let the world bear witness to my shame! Of course, the player can't influence the environment outside what the game allows! That would be cheating! What I meant to say was that the player cannot do much other than what the game wants them to do.



But what about games such as Resistance 2 where players are expected to move freely within a level? These games use something called a nav mesh which is, essentially, a very low poly version of the level. This mesh, which is invisible to the player, is laid on top of the actual level and is used by the NPCs to navigate the level. Each polygon of the mesh acts like a node which the NPCs can follow. But instead of being limited to one node such as in the previous method, the NPCs are capable of using most if not all the polygons on the mesh. These polygons can grouped together, sometimes denoted by different colours, to signify different features of the level such as elevated surfaces. These groups can be used to trigger behaviours such as climbing up onto a platform.



All in all, game AI helps to provides players with games where players can act freely with their environment, immersing them deeper into the game world as they walk with, talk with, and sometimes horribly murder NPCs.

sources
http://www.gdcvault.com/play/1014700/Finding-Your-Way-with-Havok

http://www.insomniacgames.com/navigation-gdc11/

http://images3.wikia.nocookie.net/__cb20121207200146/nintendo/en/images/2/2a/New_Super_Mario_Bros_Wii_Goomba.jpeg

http://www.youtube.com/watch?v=sYmSi9JWFgw

http://www.youtube.com/watch?v=MI8NxYb8A0M

http://www.youtube.com/watch?v=ns4yPqrlOdk

http://www.youtube.com/watch?v=4KtklVO84no

No comments:

Post a Comment