Sign in to follow this  
unit187

AI programming quick start Q

Recommended Posts

Hello,

 

I would be happy if someone would be so kind to answer my question.

I am quite interested in learning artificial intelligence for games, but I am not sure if I will like it and if I am ready to dive into it and invest monthes (for start) learning something I will not like.

So the question is, what approach should I take to do some basic AI programming and quickly achieve visible results to get the taste of it?

 

My programming background: some Python, mostly UI and tools developing inside Autodesk Maya. Never programmed games.

 

Thanks!

Share this post


Link to post
Share on other sites

@frob: +1'd because that Conditional-Action based architecture at the bottom of the link - very interesting idea, and I think I'll use that for my game since I haven't coded the AI for it yet.

 

Your welcome.  I added that gpwiki article ages ago.  

 

That particular pattern has served me well many times.  In fact, I'm implementing yet another instance of it based roughly on those same ideas right at this very moment --- currently with 72 conditionals.  :-)

Share this post


Link to post
Share on other sites

Most game AI systems are implemented as simple state machines.

It is extremely rare for a game to use an advanced machine learning algorithm. They are great for many real-world problems where you need to make the decision mirror reality. Games to the opposite; you need to tweek and tune and manually adjust them.

Clicky

Thank you.

 

So, as I understand, AI in games often is a system of 'if... then' statements.

if a player has big gun and full health: do that

if a player has small gun and low health: do that

 

It seems to me that a programmer who does AI most of the time will code conditions. For example, AI needs to react somehow when a player runs away. The hardest part to code here is to code what does it mean to 'run away'. Is it correct?

And it leads me to the point that AI programmer must have the same knowledge as general programmer who can code a game, but specializes in AI.

Do I get it right?

Share this post


Link to post
Share on other sites

So, as I understand, AI in games often is a system of 'if... then' statements.
if a player has big gun and full health: do that
if a player has small gun and low health: do that

 

Basically correct.

 

The If/Then table was to make the example clear.  That only works well for small systems; it quickly grows to become unmaintainable.

 

 

In a major AI system is more likely to be driven by data, not by code.  Rather than complex If/Else trees it is more likely to be handled by an array of conditions, and the conditions are actually objects derived off a basic state class.  The programmer would create the framework for the rules.  The designers would likely have either a spreadsheet or a tool that lets them enter whatever data fields they want.  During the game load process the data would end up loading that data and creating whatever data-driven implementation the designers want.

 

If you have a copy of Final Fantasy 12 available, their AI system is completely exposed to the player.  If you don't have a copy of the game available, the Wikipedia article describes it as the AI "consists of three parts: a target, an action, and a priority. The target specifies which ally or foe to act on and the condition for applying the action. For example, the target "Ally: HP < 70%" causes the character to target any ally whose hit points have fallen below 70%. The action is the command to be performed on the target. The priority order determines which action to perform when multiple actions are triggered."

Share this post


Link to post
Share on other sites

Visit www.edx.org and checkout the AI online course (Starts 18th Feb and it is free). It should give you an idea if you like it or not.

Share this post


Link to post
Share on other sites

In a major AI system is more likely to be driven by data, not by code.  Rather than complex If/Else trees it is more likely to be handled by an array of conditions, and the conditions are actually objects derived off a basic state class.  The programmer would create the framework for the rules.  The designers would likely have either a spreadsheet or a tool that lets them enter whatever data fields they want.  During the game load process the data would end up loading that data and creating whatever data-driven implementation the designers want.
 
If you have a copy of Final Fantasy 12 available, their AI system is completely exposed to the player.  If you don't have a copy of the game available, the Wikipedia article describes it as the AI "consists of three parts: a target, an action, and a priority. The target specifies which ally or foe to act on and the condition for applying the action. For example, the target "Ally: HP < 70%" causes the character to target any ally whose hit points have fallen below 70%. The action is the command to be performed on the target. The priority order determines which action to perform when multiple actions are triggered."

 

Can you expand a little bit more on 'driven by data' thing? Because I still see this as IF-THEN (or Switch).

I mean, we have a class that gathers information and spits out data like how much health does a bot have, how many enemies are around, whats in the bot's inventory, etc. And then we operate with this data to make the bot do some action, for instance, if he has low health and if he has Health Potion in the inventory, he drinks it.

 

 

 

 

Visit www.edx.org and checkout the AI online course (Starts 18th Feb and it is free). It should give you an idea if you like it or not.

 

Eh, they ask for quite good math knowledge. I finished my formal education like 8 years ago and now am relearning math and steamrolling through it, but I don't have that high level yet. And yes, I know that AI is all about math. :)

Share this post


Link to post
Share on other sites

There are some good books on this,

http://www.amazon.com/Programming-Game-Example-Mat-Buckland/dp/1556220782/ref=sr_1_1?ie=UTF8&qid=1360368728&sr=8-1&keywords=ai+programming

that one got good reviews, I own it, but haven't gotten around to reading it yet.

 

Also gameinstitute has tutorials for game AI

http://www.gameinstitute.com/game-development/game-programming.php

 

GI does a 1 time payment to join, you get access to all there materials for the 99$ which is a steal, the programming aspects are in c++.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this