Artificial Intelligence Code

rated by 0 users
This post has 30 Replies | 4 Followers

Top 25 Contributor
Posts 204
Megahand Posted: Mon, Feb 8 2010 11:17 AM

I was wondering how to make an AI. The most obvious one is to just write every concievable situation and then run. I would rather have an AI that has at least some idea of what's going on around it and makes logical decisions. I also want it to be able to logically predict what might happen, as well. Any ideas?

1.618033988749894848204586834365
Top 10 Contributor
Posts 826

The AI you use really depends on your game, but there are a some cases where you can use a "generic" AI and then add or remove components based on what it needs to do.

Several good examples of the types of generic behavior that can be implemented are found in Craig Reynolds' GDC paper entitled "Steering Behaviors for Autonomous Characters". I've found it quite useful and am working on a Phrogram implementation of a basic AI agent that follows most of these behaviors. However, it's more directed towards games with AI units that roam about in real-time and are not confined to a game board, and is therefore only useful in a handful of games. RTS/Action-RPG/MMO-RPG games are the most likely to need something like this.

I think the overall gist of the paper applies to most AI though...You have a set of rules that you follow and use to adapt to any given scenario. In most cases, hard-coding each and every possible scenario is simply too time-consuming.

I don't really know much more on the subject, other than it's challenging to make a smart computer player.

Top 10 Contributor
Posts 692
ZMan replied on Fri, Feb 12 2010 11:43 AM

Often you don't need 'real ai' as the players won't notice all your clever stuff. What you will need will depend greatly on the type of game - there is no general answer.

This is the main site on the subject http://aigamedev.com/ though I'm not expert enough to know where the best place to start is. I have heard good things about this book too http://www.amazon.com/AI-Game-Developers-David-Bourg

Managed DirectX and XNA ? Check out http://www.thezbuffer.com
Top 10 Contributor
Posts 246
FlightSim replied on Thu, Apr 22 2010 3:44 PM

well after hearing of your real time strategy game, megehand,  if it was a shotting game for example, i'd make it so that if you aim at a dude, he hides, else he aims ate you, giving a few seconds and on purpose bumbness to make it a tadd easier...

my youtube's PhrogramDude

Top 25 Contributor
Posts 204
Megahand replied on Fri, Apr 23 2010 5:51 AM

Unfortunately, making the AI bad at shooting is the really hard part (illogical, huh?).

1.618033988749894848204586834365
Top 10 Contributor
Posts 692
ZMan replied on Fri, Apr 23 2010 8:19 AM
Its the same for games like POng. Its trivial to make a computer opponent that is perfect at pong. But try to make one that has skill leves, that a human can beat sometimes and make the game fun and you can spend days on the problem. The problem here isn't so much of artificial intelligence - the term is probably being used wrong here. What you are looking for is 'human simulation'... AI is normally about determining meaning from a sey of fuzzy inputs. e.g. feed me some audio of text and let me try to intepret it it. In this case you actually know how to solve the problem - how to make the enemy shoot you perfectly every time. You are trying simulate how a human would play the game.
Managed DirectX and XNA ? Check out http://www.thezbuffer.com
Top 10 Contributor
Posts 246
FlightSim replied on Fri, Apr 23 2010 5:03 PM
true. but you could make it shoot a random number of degrees off, excluding shooting at the target. and if a random number value equaled a certain value, those other rules wouldn't follow...

my youtube's PhrogramDude

Top 10 Contributor
Posts 692
ZMan replied on Fri, Apr 23 2010 5:33 PM
You could but what could the certain value be. How do you make the bat look like it 'just' missed the ball. How often do you do it. Think about the different ways a human can mis and try to simulate it. Maybe we should have a competion when everyone tries to write a pong AI and we can apply a turing test to it... http://en.wikipedia.org/wiki/Turing_test
Managed DirectX and XNA ? Check out http://www.thezbuffer.com
Top 10 Contributor
Posts 246
FlightSim replied on Fri, Apr 23 2010 9:59 PM
good idea! first contest i'd be involved in Big Smile but who would we compare, say the bat swinging of the program to? but good idea!

my youtube's PhrogramDude

Top 10 Contributor
Posts 692
ZMan replied on Fri, Apr 23 2010 10:56 PM
We would compare it to a human... but it would be a blind test so the judges wouldn't know which player was human and which was computer. What I would do would be to write a 2 player pong game where I could choose to play either player and an AI would always play the other. I'd leave the AI function empty so that by default the computer player would do nothing. Your jobs would be to fill that in with something that you think makes it look human. Then I would plug in the AI and play some games. And I'll take a video. Then I put the videos up for the judges and everyone chooses which player they think is human. If you did a good enough job then the judges response should be 50-50. If you did a bad job then 100% of them would choose me. I think about it over the next week and see how east it would be to set up. Might be fun.
Managed DirectX and XNA ? Check out http://www.thezbuffer.com
Top 10 Contributor
Posts 246
FlightSim replied on Sat, Apr 24 2010 8:28 AM

interesting idea! does sound fun! so we would just write some AI code and you would integerate it into the program you wrote? if so, i think it might be a good idea to just send us the source code of the AI-less pong game and we could then test our code to see if it works Stick out tongue  i'm also making a player vs. computer tic tac toe, so it'll be fun to see how that goes...

my youtube's PhrogramDude

Top 10 Contributor
Posts 692
ZMan replied on Sat, Apr 24 2010 11:44 AM
Absolutly - I wouldn't expect anyone to do it blind... but I'm busy on Phrogram 3 right now so there's a time issue. Watch this space.
Managed DirectX and XNA ? Check out http://www.thezbuffer.com
Page 1 of 3 (31 items) 1 2 3 Next > | RSS