Jump to content

  • Log In with Google      Sign In   
  • Create Account


AI programming quick start Q


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
8 replies to this topic

#1 unit187   Members   -  Reputation: 274

Like
0Likes
Like

Posted 04 February 2013 - 07:05 PM

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!



Sponsor:

#2 frob   Moderators   -  Reputation: 19629

Like
9Likes
Like

Posted 04 February 2013 - 07:39 PM

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
Check out my personal indie blog at bryanwagstaff.com.

#3 Servant of the Lord   Crossbones+   -  Reputation: 17960

Like
0Likes
Like

Posted 04 February 2013 - 10:26 PM

@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.


It's perfectly fine to abbreviate my username to 'Servant' rather than copy+pasting it all the time.

[Fly with me on Twitter] [Google+] [My broken website]

All glory be to the Man at the right hand... On David's throne the King will reign, and the Government will rest upon His shoulders. All the earth will see the salvation of God.                                                                                                                                                            [Need web hosting? I personally like A Small Orange]
Of Stranger Flames - [indie turn-based rpg set in a para-historical French colony] | Indie RPG development journal


#4 frob   Moderators   -  Reputation: 19629

Like
0Likes
Like

Posted 05 February 2013 - 10:48 AM

@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.  :-)


Check out my personal indie blog at bryanwagstaff.com.

#5 unit187   Members   -  Reputation: 274

Like
0Likes
Like

Posted 05 February 2013 - 11:25 AM

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?



#6 frob   Moderators   -  Reputation: 19629

Like
2Likes
Like

Posted 05 February 2013 - 12:34 PM

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."


Check out my personal indie blog at bryanwagstaff.com.

#7 GWDev   Members   -  Reputation: 279

Like
0Likes
Like

Posted 06 February 2013 - 04:27 AM

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.



#8 unit187   Members   -  Reputation: 274

Like
0Likes
Like

Posted 08 February 2013 - 05:15 PM

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. :)



#9 EddieV223   Members   -  Reputation: 1404

Like
0Likes
Like

Posted 08 February 2013 - 06:14 PM

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++.


If this post or signature was helpful and/or constructive please give rep.

 

// C++ Video tutorials

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

 

// Easy to learn 2D Game Library c++

SFML2.1 Download http://www.sfml-dev.org/download.php

SFML2.1 Tutorials http://www.sfml-dev.org/tutorials/2.1/

 

// SFML 2 book

http://www.amazon.com/gp/product/1849696845/ref=as_li_ss_tl?ie=UTF8&camp=1789&creative=390957&creativeASIN=1849696845&linkCode=as2&tag=gamer2creator-20

 





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS