Thread: AI used in computer games.

  1. #1
    Registered User mmarab's Avatar
    Join Date
    Jul 2007
    Posts
    30

    Question AI used in computer games.

    Just wondering if anyone new which AI technique is the most popular? I would guess that some out these:

    MACHINE LEARNING
    EVOLUTIONARY COMPUTATION
    REINFORECEMENT LEARNING
    ARTIFICIAL NEURAL NETWORKs
    DECISION TREES

    would maybe combined. Just wondering if anyone had any information on a commonly used technique? Or what you use? The AI would be used for enemies, so that they can learn. To change the style of attack or understand the users way of playing the game to make it more difficult.

    Thanks .

  2. #2
    Registered User nempo's Avatar
    Join Date
    Aug 2007
    Posts
    39
    I believe that decision trees or rule based AI are most widely used in games. Can't answer your second question though.

  3. #3
    Registered User mmarab's Avatar
    Join Date
    Jul 2007
    Posts
    30
    Yeah, decision trees i could see being used. As they learn fast.

  4. #4
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    FSM's are used in most games. Most games do not learn from their mistakes and follow a pre-determined path for various states. Now it is possible to mix states and actions from other states and/or pass on states to other objects making the AI seem complex when it actually is not.

    For example a space game:

    Basic combat defensive moves
    • Orbit - circle player's ship
    • Retreat - vector away from player's ship at full speed
    • Rush - vector toward player's ship at full speed, veer off prior to crash
    • FlyTo/Target - target player and vector to player


    Basic combat offensive moves
    • Laser attack - vector toward player's ship and fire at targeted system on player's ship
    • Missile attack - lock on to player and fire missile


    Basic normal moves
    • Navigate - follow waypoints - dynamically generated at ship generation (as in freighters, etc)
    • FlyTo - fly to a certain location
    • Dock at/with - dock with or at a certain ship/station
    • Scan - perform scan of target vessel
    • Explore - dynamically generate random waypoints and follow them


    Basic AI states
    • Green - Pick from normal moves
    • Yellow - Pick from combat defensive moves
    • Red - Pick from combat defensive and offensive moves


    The idea is once you get the basic manuevers working for all states you can then 'build up' or 'queue up' several moves or you can create attack styles and attack loops like:

    Random rush attack
    • Orbit - till random value matches range
    • Rush - perhaps multiple times
    • Laser attack
    • Retreat - Get set back up for orbit


    Once you get this type of system working you can pretty much let the AI generate it's own types of moves. You can save data based on the success or failure of each attack and then alter the attack if the current list or current salvo of commands is not working so well.
    By doing this it appears that the AI is uber smart when in reality it is just following a set of very basic commands which execute basic manuevers.

    To make the moves look believable you could set up manuever templates so the computer knows what order the manuevers should be in. Based on this template then the computer could dynamically generate complex manuevers based on simple templates.
    Last edited by VirtualAce; 08-14-2007 at 09:58 AM.

  5. #5
    Registered User mmarab's Avatar
    Join Date
    Jul 2007
    Posts
    30
    Hey thanks, that is really interesting and makes a lot of sense.

  6. #6
    Registered User
    Join Date
    Nov 2006
    Posts
    519
    Bubba: Do you now of some literature out there describing such and related things? Thank you in advance!

  7. #7
    pwns nooblars
    Join Date
    Oct 2005
    Location
    Portland, Or
    Posts
    1,094
    Programming Game AI by Example is a good one, you learn FSMs pretty well, along with stuff for movement and even a bit of Fuzzy Logic (really cool stuff).

  8. #8
    The Right Honourable psychopath's Avatar
    Join Date
    Mar 2004
    Location
    Where circles begin.
    Posts
    1,071
    I have "AI Game Engine Programming". I haven't gotten through much of it, but it covers all the main AI techniques used in games, and it also has sections devoted to AI used in specific genres.
    M.Eng Computer Engineering Candidate
    B.Sc Computer Science

    Robotics and graphics enthusiast.

  9. #9
    Registered User mmarab's Avatar
    Join Date
    Jul 2007
    Posts
    30
    Nice one, i checked that book out, it looks really good. Should be a good starting point.

    Book = AI Game Engine Programming

  10. #10
    Registered User
    Join Date
    Aug 2007
    Posts
    13
    I've read many articles on the issue of AI, but still everything is fuzzy, especially because not many articles show the exact simple representation of those ideas on code.

    I believe a decision tree is simply like a function with a lot of switches and if/else right?

    However, I am not 100% sure about fuzzy logic, the only thing I can use to explain that is maybe, adding some Rand()s around your decision tree.

    Is it any more complex than that?

  11. #11
    pwns nooblars
    Join Date
    Oct 2005
    Location
    Portland, Or
    Posts
    1,094
    It is far more complicated than that. The book I recommended explains Finite State Machines, Goal Based AI, Fuzzy Logic, Path Finding, and how to use Scripting to assist you in your AI work.

    It also has C++ examples of everything it describes basically, I learned a lot in a short time reading it.

  12. #12
    Registered User
    Join Date
    Aug 2007
    Posts
    13
    Any chance you can enlighten us with a glimpse of what an example of AI code can be, applying one of those categories, and telling us what it could be used for?
    Learn programming and web design from professionals at FuriX.net! Join FuriX.net and apply for the FuriX Team, join the forum community, and improve your skills with FuriX articles and tutorials | Age of Empires IGZones.

  13. #13
    pwns nooblars
    Join Date
    Oct 2005
    Location
    Portland, Or
    Posts
    1,094
    What do you mean AI code can be? AI code looks like any other code, it is just logic. Your post makes no real sense other than you are wanting an example, which you can easily find with a quick google search, I know that is how I found out about AI when I wanted to learn.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Major Computer Problem
    By Olidivera in forum Tech Board
    Replies: 10
    Last Post: 07-15-2005, 11:15 AM
  2. Tabbed Windows with MDI?
    By willc0de4food in forum Windows Programming
    Replies: 25
    Last Post: 05-19-2005, 10:58 PM
  3. Which distro should I run on my old computer?
    By joshdick in forum Tech Board
    Replies: 5
    Last Post: 04-09-2003, 01:37 AM
  4. Video Games Industry. 5 years left.
    By Cheeze-It in forum A Brief History of Cprogramming.com
    Replies: 26
    Last Post: 12-10-2002, 10:52 PM
  5. Computer engineering - programming.
    By Unregistered in forum C Programming
    Replies: 10
    Last Post: 07-15-2002, 02:37 PM