AI Basics

    Artificial Intelligence [AI] is a fundamental requirement of any game development. There are several aspects that must be in place before the developer can produce the AI. The developer first must have a working environment that could be a 2D slide scroller or a complex 3D Online Game. The actual game style has little control on what an AI can or could do. This is because the AI is independent from the visual effects that the player will see. Before the developers can create the AI for the computer controlled or Non-Player Characters [NPCs], so they must think through what the NPC will need to do and what it should do.

    Since the developer has an NPC that needs to respond it is important to know more about what an NPC is. The NPC is any object within the game that is not directly controlled by the player. In order for the NPC to be interactive it must have some programming logic allowing it to react to external stimulus. That means that when the player performs the action of talking, attacking, or other action the NPC must have a corresponding action or actions. The simple way to perform the task is to create an association list between the action performed and the action taken [Table1].

Table1
Player Action NPC Response
Talk Dialog Conversation
Attacks NPC Fights Back
Attacks NPC Home Fights Player to Defend Home

    As the table displays there is only one action the NPC can take that is a reaction to the player. This form of AI is the simplest form because the AI does not have to think since there is only one option. Because of the design this is as basic of an AI that can be created. However, what if the developer wanted to make it more complex creating a scenario that could change from fight to fight. To do this there would be more the one response based on the players action [Table2]

Table2
Player Action NPC Response
Talk Dialog Conversation
Attacks NPC Fights Back
Attacks NPC Home Fights Player to Defend Home
Talk Attacks Player
Attacks NPC Runs Away
Attacks NPC Home Ignores Player

    As the table displays there is more the one action the NPC could take per action the player performs. How will the NPC react? That is the logic code. To do this the developer creates a MOB or a Mobile Object that can be anything within the game environment. The first MOB will be normally something the player will interact with such as a Monster. The monster AI will use the above table depending on the logic created. In order for the monster to choose the correct action it needs some rules [Table3].

Table3
Rule Action
Attacked with Health >= 50% Attacks Player
Attacked with Health < 50% Runs Away
Home Attacked but Health > 50% Ignores Player
Home Attacked and Health <= 50% Attacks Player

    The first two Rules are strait forward the monster will either attack the player or run away from the player. However the third and forth rules the NPC will wait until the Health of the Home is at 50% then it will attack the player. The rules allow the NPC to be more than a static object. However, if every monster reacts the exact same way then the AI is too simple and highly predictable. It is best to have variety with the AI’s that allows the player to have a different experience for each monster type.

    Is predictability good or bad? That is a point of view that is relative to the developer and the gamer. What a developer may consider complicated the player may find it predictable. However if the developer throws a random into the AI to simplify the logic required this becomes a less predictable monster from the players perspective. Many developers find the best way to program the AI is to create a large list of actions and responses then pick and choose which the MOB will react to.

    This allows the MOB to act as a vender or a quest giver which cannot be attacked. But it could also create a highly aggressive MOB that will attack the player when the avatar is within view. These two different AI’s stem from the same basic architecture which makes it simplistic to program and yet provide the diversity that the player needs to remain interested. Most games are written with this style AI because it can be written once and then the MOBs can be created statically or dynamically depending on the design of the game environment. In the end, there are many ways to program a simple AI but the table logic method is the first step into the world of writing an AI for any game.



29 comments so far

  1. aukatrau on

    Thanks for this. I’m making a small game with some friends as a side project, and I’m going to incorporate a few of these methods into the project!

  2. Angela on

    This is a massive and a very interesting post to check on this awesome site! Almost never post any feedback but now i just did not resist

  3. Jun Natsukawa on

    Write a lot more, thats all I’ve to say. Literally, it seems as although you relied on the video to make your point. You clearly know what youre talking about, why waste your intelligence on just posting videos to your blog once you could possibly be giving us some thing enlightening to read?

  4. Haydee Munnis on

    Would you mind if I shared this blog post on my webpage? I would certainly give you credit and a link back to your site. Thank you, and don’t hesitate to let me know here!

  5. Brady Palmisciano on

    You have presented some interesting points in this article. It’s a lot of information to take in, but it’s so well-formatted that it’s easy to grasp. Thank you for writing this kind of quality material.

  6. Samantha Darville on

    Love your blog!

  7. Sylvester Brzostowski on

    Great post!

  8. LambiaseHazelbush19 on

    Hi my loved one! I wish to say that this post is awesome, great written and include approximately all vital infos. I would like to peer more posts like this .

  9. SmealKolinsky9931 on

    Hi there, I discovered your site by way of Google at the same time as looking for a comparable subject, your web site came up, it appears to be like great. I’ve bookmarked to favourites|added to bookmarks.

  10. matt gorden on

    Thought I would comment and say cool theme, did you code it on your own? It looks really good!

  11. Vender ouro on

    I used to be more than happy to find this internet-site.I wished to thanks to your time for this excellent learn!! I definitely having fun with every little little bit of it and I’ve you bookmarked to take a look at new stuff you blog post.

  12. Florentino Trivette on

    fascinating aspect youve completed here – blogesaurus convertxtodvd free download Artificial Intelligence Basics Game Developers

  13. Roseanna Sayres on

    Thanks a lot for giving everyone a very splendid chance to discover important secrets from this site. It is always so cool plus packed with a good time for me personally and my office co-workers to visit your site at minimum thrice every week to find out the new things you will have. Of course, we’re usually fulfilled concerning the dazzling concepts served by you. Selected 4 areas in this posting are in fact the most effective we have ever had.

  14. Jose Dunomes on

    Hiya, I’m really glad I have found this info. Today bloggers publish just about gossips and net and this is actually irritating. A good web site with exciting content, that is what I need. Thank you for keeping this web-site, I will be visiting it. Do you do newsletters? Can’t find it.

  15. Rebecca on

    Great take on this topic, mind if I reference you on my article?

  16. Sophie on

    Cool story, bro!

  17. shandschuh on

    Yes AI is very complex but this article is meant to keep the ideas minimal and grow with later articles.

  18. shandschuh on

    I always allow references. Please keep the information intact with accurate references. If the article is going to be reposted please provide the site for verification.

  19. Adrianna on

    Cool story, bro!

  20. Fabian Baugus on

    I simply want to say I am new to blogs and actually liked your web page. Probably I’m likely to bookmark your site . You surely have beneficial stories. Many thanks for sharing with us your webpage.

  21. Cinthia Gottdenger on

    Great website! I am loving it!! Will come back again. I am taking your feeds also

  22. Ema Acerno on

    Thanks a lot for sharing this with all folks you really recognise what you’re talking about! Bookmarked. Please additionally consult with my web site =). We can have a link exchange contract between us!

  23. Javier Rentie on

    Just desire to say your article is as astounding. The clarity in your post is just excellent and i can assume you are an expert on this subject. Well with your permission allow me to grab your feed to keep up to date with forthcoming post. Thanks a million and please continue the gratifying work.

  24. Bette Holka on

    I’m very happy to read this. This is the kind of manual that needs to be given and not the random misinformation that’s at the other blogs. Appreciate your sharing this best doc.

  25. Cyrus Tyger on

    I do not even know how I ended up here, but I thought this post was good. I don’t know who you are but definitely you’re going to a famous blogger if you are not already 😉 Cheers!

  26. Christal Olverson on

    Hello there, You’ve done a great job. I’ll definitely digg it and personally suggest to my friends. I’m sure they’ll be benefited from this site.

  27. Ashley Ulcena on

    Hello.This article was really remarkable, especially since I was searching for thoughts on this issue last Sunday.

  28. Markus Fitchette on

    I have been surfing online more than three hours today, yet I never found any interesting article like yours. It is pretty worth enough for me. In my view, if all site owners and bloggers made good content as you did, the web will be a lot more useful than ever before.

  29. Otis Sanyaro on

    I wish to get across my passion for your generosity for people that require help with in this content. Your real dedication to getting the solution up and down turned out to be extremely interesting and have truly permitted guys and women much like me to achieve their targets. Your entire insightful tips and hints denotes a lot to me and even more to my fellow workers. Thanks a lot; from each one of us.


Leave a reply to Roseanna Sayres Cancel reply