Monday 6 November 2017

Introduction to: NWC603COM – Using AI in Computer Games Assignment 1



Introduction to: NWC603COM – Using AI in Computer Games Assignment 1


Artificial intelligence (AI) in the gaming world today has become the sole reason games become either a massive success, or flop, and become a failed enterprise. AI can make or break a game, and the methods and techniques used by developers to give us the illusion that AI is intelligent is what we will be investigating in this blog.

I will be researching and reviewing the many techniques of AI in Computer games, how they work, where they are used, what purpose they serve and when and when not to use them. I have decided to fulfil this task ahead by creating a blog, I feel I can give you the reader, a much more personal opinion of my views of AI in Computer Games.

AI Techniques I will be reviewing:

1.1 Algorithms
1.2 Heuristics
1.3 Hacks

2.1 Hardware Constraints in AI Engines
2.2 The Priorities of a Games Developer
2.3 Mobile Devices & Tablets

Pathfinding Concepts
3.1 A* Algorithm
3.2 Dijkstra

4.1 State Machine
4.2 Fuzzy Logic
4.3 Boids Flocking
4.4 Decision Tree

5.1 Tactics & Strategy's
5.2 Learning Technologies - Artificial Neural Networks
5.3 Learning Technologies - Q-Learning

6.1 Conclusion
6.2 References


Introduction to: NWC603COM – Assignment Brief




Sunday 5 November 2017

6.1 Conclusion


Conclusion

So in this assignment, I was tasked to create a blog covering "Using AI in Computer Games", the fields of AI I chose to talk about was: Algorithms, Heuristics, Hacks, Hardware Constraints in AI Engines, The Priorities of a Games Developer, Mobile Devices & Tablets, Pathfinding Concepts such as A* Algorithm, Dijkstra, Decision Tree, State Machine, Fuzzy Logic, Boids Flocking, Tactics & Strategy's, Learning Technologies - Artificial Neural Networks and Learning Technologies - Q-Learning. The initial idea was to finish with a good overall understanding of all the AI techniques mentioned above, along with descriptions, pro's, con's and example of when that method of algorithm is used in today's games. I'd like to finish my blog by covering my vital three features of AI in computer gaming that without them, there wouldn't be the amazing in-depth games we play today:

Learning:
A portion of this blog that I have covered is that of learning in gaming AI, I have talk about the learning algorithms such as Heuristics (1.2 Heuristics), artificial neural networks (5.2 Learning Technologies - Artificial Neural Networks) and Q-Learning (5.3 Learning Technologies - Q-Learning). Covering these features has allow me to grasp just how amazing we have come in the world of gaming AI, knowing that now in our everyday games, Madden and Call of Duty that developers are integrating these algorithms to allow the AI to learn from trial and error, learn to not make the same mistake twice and around human like behaviour. It's because of algorithms such as these is the reason our games today seem so real, it makes the user experience all that more enjoyable.

Pathfinding:
Another vital feature in gaming AI is that of pathfinding: techniques covered are that of A* (3.1 Pathfinding Concepts - A* Algorithm) and Dijkstra (3.2 Pathfinding Concepts - Dijkstra Algorithm), the soul of contributors of how AI in gaming finds where it's next move is going to be based on the lowest cost, fastest outcome and uses a node to node techniques to find the best resolve. If it wasnt for pathfinding in our AI, AI characters wouldn't be able to make decisions, well maybe they would but it wouldn't always be the correct, fastest option. It's the first step in giving the AI character a brain, giving it the ability to think like a human.

Decision Making Concepts:
My third and final feature is decision making: The decision tree (4.4 Decision Tree), the state machine (4.1 State Machine) and Fuzzy logic (4.2 Fuzzy Logic) make up three decision concepts used in gaming AI, without them the AI wouldn't have a function, it would no what to do, it would have no ability to think and therefore take action. It does sound a lot like pathfinding no? Together these elements make up the ability for the AI to ask itself, is it hurt? Where do I go if i'm hurt? Am I healthy enough to fight or evade the current event? The AI can answer all these questions by itself with these decision making concepts.

I started off my blog by saying "Artificial intelligence (AI) in the gaming world today has become the sole reason games become either a massive success, or flop, and become a failed enterprise. AI can make or break a game, and the methods and techniques used by developers to give us the illusion that AI is intelligent is what we will be investigating in this blog." (Introduction to: NWC603COM – Using AI in Computer Games Assignment 1) and its hard to argue that with all of the elements I have talked about in this blog that they make up and are the sole reason gaming today is so good, the end user experience is still progressing and getting better, with the use of these algorithm techniques, its only going to expand and make AI in gaming so much better and more real. As gamers that's all were asking for, with other techniques such as boids (4.3 Boids Flocking) we can really emerge and to feel like were part of the experience.

Its fair to say that all of the these features play some or an important role of an AI in computer games, I feel I've learnt a lot from this blog and being able to research how vital all these aspects are in making a game have given an insight into the time and hard work goes into making the games I spend a majority of my free time playing.

6.2 References


References

(1) K.Smallwood, How do the Ghosts in PAC-MAN Decide where to go?, Today I Found Out, Oct 1st 2015, http://www.todayifoundout.com/index.php/2015/10/ghosts-pac-man-work/

(2) S Agrawal, Artificial Intelligence - Search Heuristics, Algorithmic Thoughts, Dec 21st 2012, https://algorithmicthoughts.wordpress.com/2012/12/21/artificial-intelligence-search-heuristics/

(3) A Chalk, Overwatch System Requirements, PC Gamer, Oct 27th 2015, http://www.pcgamer.com/overwatch-system-requirements-revealed/

(4) L Kittmer, The Advantages of Mobile Phone Games, Techwalla, Date Unknown, https://www.techwalla.com/articles/differences-between-generations-of-computers

(5) A Sowards, Mobile vs. Console vs. PC Gaming, InfiniGeek, Mar 18th 2014, http://infinigeek.com/mobile-vs-console-vs-pc-gaming/

(6) Robin, A Star Algorithm, Artificial Intelligence, Dec 18th 2009 http://intelligence.worldofcomputing.net/ai-search/a-star-algorithm.html#.WfXn2Wi0PIU

(7) Dennis, The Difference Between Dijkstra's Algorithm and A*, All My Brain, Jun 2nd 2008
http://allmybrain.com/2008/06/02/the-difference-between-dijkstras-algorithm-and-a/

(8) C Reynolds, Boids, Red3D, Sept 6th 2001, https://www.red3d.com/cwr/boids/

(9) Uknown, Hyperboid - Flocking Themed, TIG, July 19th 2017, https://forums.tigsource.com/index.php?topic=61768.0

(10) M Pirovano, The use of Fuzzy Logic for Artificial Intelligence in Games, Michele Pirovano.com, Dec 7th 2012, http://www.michelepirovano.com/pdf/fuzzy_ai_in_games.pdf

(11) F Bevilacqua, Finite-State Machine: Theory and Implementation, EnvatoTuts+, Oct 24th 2013, https://gamedevelopment.tutsplus.com/tutorials/finite-state-machines-theory-and-implementation--gamedev-11867

(12) Barrera, Kyaw, Peters, Swe, Finite State MachinesUnity AI Game Programming - Second Edition, Sept 2015, https://www.packtpub.com/mapt/book/game_development/9781785288272

(13) E Dezhic, Understanding Decision Trees, Becoming Human, June 25th 2016, https://becominghuman.ai/understanding-decision-trees-43032111380f

(14) G Dvorsky, Hackers Have Already Started To Weaponise Artificial Intelligence, Gizmodo, Sept 13th 2017, https://www.gizmodo.com.au/2017/09/hackers-have-already-started-to-weaponize-artificial-intelligence/

(15) Lord of the Rings, The Video Game Critic, 2017, http://videogamecritic.com/xboxhl.htm

(16) A Solo, Strategy vs. Tactics in Video Games, Space Sector, Dec 16th 2011, https://www.spacesector.com/blog/2011/12/strategy-vs-tactics-in-video-games-a-small-essay/

(17) J Nielsen, Hardware Specs vs. User ExperienceNielsen Norman Group, Nov 5th 2012, https://www.nngroup.com/articles/hardware-specs-vs-user-experience/

(18) A Hoffman, Career Spotlight: Game Programmer, Monster, 2017, https://www.monster.com/career-advice/article/career-spotlight-game-programmer


(19) D Coleway, This neural network could make animations in games a little less awkward, TC, May 1st 2017, https://techcrunch.com/2017/05/01/this-neural-network-could-make-animations-in-games-a-little-less-awkward/

(20) Soren D,  Teaching an AI to play a simple game using Q-learningPractical Artificial Intelligence,  Aug 13th 2017, https://www.practicalai.io/teaching-ai-play-simple-game-using-q-learning/#q-learning-algorithm

Friday 3 November 2017

1.1 Algorithms


1.1 Algorithms

In the field of AI in gaming, the first technique used by developers is the algorithm method, Why?
Because it is the most used method because its simple, and the code is not difficult or time consuming. So what is an algorithm in AI you ask, well an algorithm is a very basic set of rules that the AI character follows during game play... In a little greater depth, the rules are triggered in instances which could instructed the AI to move up, down, left or right, a perfect example of a game which uses this AI technique would be Pacman.

all of the ghosts in Pac-Man have their own distinct personality which influences the movements they make.(1) the point which is made in this post by Karl Smallwood is that because the algorithm used in Pacman, the AI charters all don't carry out the exact same task such as follow each other or all go after the playing character at the same time. If this was the case then the AI technique used would be a hack which forces the AI to respond to the player character in a predictable way, from using the algorithm method tool, Pacman creatures have their own set of rules to follow along with what Smallwood says by mentioning each AI has its own personalty.

We have all played Pacman and we all find the game simple but fun, again Why? Because its unpredictable, we as the player do not know which direction those little characters are heading which makes the player focus and keeps this constantly on the edge. In the more modern and in-depth video games we play today, you find that algorithms are applied to AI bots in much greater detail. An advantage of this is that it makes the game so much more realistic which improves the user experience. These bots will react to light, sound and other types of interactive features, again these features are all implement into the gaming AI to simulate real life.

Pro's of an algorithm - its very simple to code and is applied in every gaming using AI today, its reliable code which can direct, teach and even give an AI feelings. throughout my blog we will be covering many types of algorithms, what purpose they have in a game and how they can increase the realism in the user experience.


1.2 Heuristics


1.2 Heuristics

Heuristics, the trail and error of the AI algorithmic world. What I mean is this technique used in gaming AI, will be how the AI learns from its previous experience; and it does this by a simple trial and error rule. An example of this would be if you were playing the first person shooter and if a AI character ran towards you and you were to shoot at the AI, the AI would then trigger that it was under attack and take for cover. Heuristics is where the AI learns from its mistakes or from the situation it is in, it is a trail an error process.

"Heuristics can be said to be estimates of how far the goal state is. Heuristics basically predict how far the goal state maybe or how much it will cost to get to the goal state from a particular node."(2) I can see that Agrawal mentions that the heuristic method is that of a goal state and that its a prediction, I don't feel that in this method of artificial intelligence that it is the heuristics that predict how a goal is met, I feel that the AI using the heuristics algorithm will know exactly what its goal is and it wont be a prediction. An example would be a AI soldier in a game like Battlefield, if the AI is in an attack state then the AI will charge at the playing character but once the AI was under attack from the player character, then the AI would look for cover, somewhere to hide. If the heuristic method is that of a prediction, then we or even the AI would not know what to do when it was under attack. 

What Argrawal does say that I agree with in his paper is how much it will cost to get to a particular goal state. Now what he means is what will it cost the AI to move from one place to another and this is a algorithm know as pathfinding and the preferred method used is the A* technique. I cover the A* algorithm is section 3.1 of my blog (3.1 Pathfinding Concepts - A* Algorithm). To close up this function, there is not much to the heuristic algorithm. It's main priority is that of sending the AI information, is the other algorithm that feed of which helps the AI on its way.

I like to say that there are four features that make up heuristics which make up its advantages and disadvantages... Optimality - this will link to a problem in real time in a game in which a solution will be given to the AI, sometimes this might not always be the best outcome as the heuristic algorithm will find out the best solution, the best solution might not always be the right solution. Completeness - when all the solutions are found with a problem, can we rely on heuristics to find all the solutions and in the end heuristics are only used to find the best outcome. Accuracy - It's important to feel like the heuristic measures each outcome using the best method, is the heuristic giving you the most reliable data? Can you rely on the best outcome given? Execution - Now we know that heuristics are know for finding the best possible solution, can it be executed quickly to an AI? Some heuristics are faster than others and some can take longer, its an algorithm we need to depend on to get the best outcome for our AI.

Thursday 2 November 2017

1.3 Hacks


1.3 Hacks

What is a hack in gaming AI? Well a hack or also known to be called lazy code, is code that forces the AI to respond in a predictable way. In other words we know what the AI is going to do before the instance is triggered. Lets say we are playing a zombie game and you, the payer character is about to enter a room but before you enter the room you know a load of zombie AI is going to come chasing after you. Well that's what a hack is, its the same code applied to all AI in that sequence of play. Now a more experience coder or maybe someone with more time could apply each AI character its own sequence but with a hack that's not the case, so because of the hack all the zombie AI would just come chasing after the player character.

Another form of hacking is that of a person using cheat codes or cheat hacks to disrupt the flow of a game by disobeying  the initial intent of the games structure, this happens a lot in older games where the code to reduce hacking is less effective. "hackers are already in a position to use AI for their nefarious ends. And in fact, they're probably already using it"(14) Dvorsky has made the point that hacking is already apart of the AI world, this can result to games not working as they should, especially when a game goes online and this can effect the final outcome of a game, the score and overall game satisfaction of the user.

Now hacks that have been put in on purpose and implemented into the game for the satisfactions of the players is a totally new kettle of fish and that can come with pro's and some massive con's. Now the advantages of hacks is that developers will use them to emulate zombies which only really have one goal and that's to chase the user character and and kill him, so in this situation applying a hack to a load of zombies which you know full well are going to chase you down does work. Now a disadvantage would be in places of a game where there shouldn't be hacks at all, now a bad hack would be where we can predict what the AI character will do before it already happens, this is not good if the developers goal is realism and user experience.  

(15)

Now your probable wondering why I have inserted a image from the PlayStation 2 game Lord of the Rings, well I remember playing this game and when you the play character ran to this location in the screenshot above, an AI character would take over and in this case the AI would then run of the edge of the cliff. An ideal con of a bad hack in a game, this takes away the realism and also killing the main character in the game.



Introduction to: NWC603COM – Using AI in Computer Games Assignment 1

Introduction to: NWC603COM – Using AI in Computer Games Assignment 1 Artificial intelligence (AI) in the gaming world today has become ...