AI programming quick start Q

Started by
7 comments, last by EddieV223 11 years, 2 months ago

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!

Advertisement
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

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

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

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?

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

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.

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

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.2 Download http://www.sfml-dev.org/download.php

SFML2.2 Tutorials http://www.sfml-dev.org/tutorials/2.2/

// Excellent 2d physics library Box2D

http://box2d.org/about/

// 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

This topic is closed to new replies.

Advertisement