#### Archived

This topic is now archived and is closed to further replies.

# Incredible AI - Could it be possible???

This topic is 5663 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi all, I got this game in the works (Who Doesn''t ?) and i''ve been dooing some huge brainstorming. Most of my ideas are large, so large that i wonder if today''s hardware could handle them. But what i''ve been thinking on artificial intelligence sounds pretty.. well... cool! Imagine, an action adventure game, where youre walking into a bar. The bartender greets you and asks if you desire anything. you could reply, but instead, you pull out your guns and point it right at his head. What will he do!?! He could pray for his life, give the player what he wants, he could grab the shotgun stored under the counter and try to fight back. He could talk you out of doing some stupid. He could also start beeing *smart* and mouthing you off because he "knows" he''s got big strong freinds sitting around in the crowd.. What if the AI could respond to it''s best advantage, whether he knows he''s got freinds willing to back it up or if it could or not handle the situation. You know... something like Neural Net or something. Wouldn''t that be groovy? Post your comments so everyone can hear them, don''t keep them to yourself :-)

##### Share on other sites
You seek a minimaxed game tree. The computer evaluates it''s options up to a certain depth of the tree. It works like this:

Computer is faced with situation A. From this situation, he can do one of 3 things: X, Y, or Z The computer evaluates X to see if it''s to his advantage. He figures on a weighted scale that option X is worth 5. He then looks down at option Y, and figures it''s worth -9. He then looks at option Z and sees that it''s worth 0. The computer will pick option X, since it''s to his greatest advantage. This is a single-depth search.

Double depth means he looks at his advantage and the next opponent''s move off that to the opponent''s disadvantage. It''s really quite complex, but know that IBM''s computer "Deep Blue" used this to win the chess game. It had enough processing power to think out 1 million plus solutions per second. Meaning if it had 10 moves each level, it could search out a six level tree in a second. It also used comparitive advantage. It keeps track of it''s best move so far. If it finds a place where the computer can gain ground on it, it will automatically discount that route. That''s because it''s obivous that if the computer picked that route, the other side would pick it''s best route which would end up WORSE for the computer. This is assuming that all sides can think optimally The computer can literally tell that you''re going to pick your best move, so if it picks this one, it will actually lose out in the long run. It''s a very awesome search principle But it''s hardware dependant..

If you want more help on this, lemme know. i just took a DB programming class involving this. I made a really awesome game in Unix based on it.. kinda a clone off Global Thermonuclear War from WarGames they wiped the accounts afore i could save the code :/ my girlfriend and i had like 25 hours and 2k lines of code invested in it :/ oh well though.. hehe.

J

##### Share on other sites
Oh yeah, lemme mention.. minimaxed game trees is a LOT to code yeah, a LOT
So.. if you want to, go for it. Games like Chess, etc use it. And it''s been shown to be a good way to do AI. I can give you resources for info on it

J

##### Share on other sites
Another option is to use scripts. They''re probably not as mathematically powerful though. Example:
If NPC''s morale = 15 or higher then goto script 10a
If NPC''s morale = 12,13,14 then goto script 10b
If NPC''s morale = 11 or lower then goto script 10c

script 10a is npc violent script
script 10b is npc talk script
script 10c is npc cry script
etc

Scripts really are just i higher level of what Niphty was talking about though, you''ll still need the minimaxed logic tree if you want something truely dynamic and versitile.
just a thought...

##### Share on other sites
Well, Minimax itself is not such a big deal to code. Maybe 60 lines if you do not put any fancy optimization. What is hard is the evaluation function.

Also, what is hard, is that Minimax cannot work with a too big depth. I just finished an othello AI : in blitz-mode (max 5 minutes for the whole game) my Minimax can work with depth 3, alpha-beta pruning with depth 5, optimized alpha-beta with depth 8-9, and a Scout with depth 8-12.

Btw. in my opinion, you want more something like programming by constraints for your AI. In other words, defining rules and letting the AI engine assemble them for you.

David

--
===
Am I the keeper of my brother ?

##### Share on other sites
Paul, scripts are fun to play with, but i think they''re harder for most people to comprehend in the begining. The simple reason is because they don''t have a truely apparant structure. If this, do this. And a lot of those are there It seems daunting the number if-then''s! The minimaxed tree just assigns it some sort of functional logic.. lol and they all tie together. if you actually looked, there''s no real difference, since a minimax tree will look about the same as all those if-thens put into a tree

Altmann, true.. minimax is a snap to code, but hard as hell to run the eval routine. It''s near impossible to imagine all the variables you could possibly use How did you run the scouting routine? I was considering having the computer scout ahead while the player was making their move.. just to model how a human looks ahead while waiting. I never had time to get around to coding it though :/ Had to get to work on a hash table lab almost immediately after i got done with this one, so i didn''t have much spare time.. lol All kinds of features we wanted to add, that''s why we''re pissed we didn''t get it off the server afore they wiped it. Oh well though

I like the idea ofallowing the AI to build its own choices. I''m unsure how to program this very effectively and effciently, however. So if you wanna toss us some tips on it, other than "i like this way better" lol Does it use up more or less CPU time than the minimaxed tree does? And does it model how people will consider options before actually doing something? I don''t like how most things simply have the AI check a value and compare it to certain routes. I personally would have the AI''s intelligence score or whatever modified to determine the search level it would perform. And i''d try to keep the program from using total CPU time by making it take pauses This way it''s actually like a human, waits and considers it''s options.. hehe There''s some devilish programming to be had here It might decide "if player looks away, then grab gun regardless" even if it sees that as a bad option. When the player looks away, then that option''s value suddenly increases The problem is foresight enough to plan for all these variables and to assign them space in memory.. hehe

J

##### Share on other sites
Ideally, you would have more than one variable in that tree. Maybe one for "fear" and one for "confidence" and one for "familiarity"... however many you can make. That way, it''s not just a point value thing. The computer would now be cross-referencing several emotions and if properly written, this technique creates a pretty life-like output.

##### Share on other sites
Well, I must say. Minimax is very interesting and I will defenitley consider looking up more on it. Although processor power is always a key element, I hope it doesn''t suck up all it''s juices.

My ultimate goal is to get a world filled with NPs that can react to players actions in very realistic ways. But if Minimax can run AI for 50 different NPs is a mystery to me.

Keep me informed on this, It''s extremeley interesting and sounds exactley like what I might be looking for :-)

##### Share on other sites
Processor power? Isn''t this all cheese compared to a single polygon?

##### Share on other sites
Cheese? as in, it''s nothing compared to rendering polygons? LOL! far from. I brought our comp system to it''s knees with the first tree i implimented in the game. I had it just go buckwild on an exhaustive search using MPI to run on multiple computers.. hehe. Brought two of our labs and the two main PII 450 1 gig memory machines to their knees.. muahahha! but damn.. it was cool as hell You can kill a processor with any simply algorithm.. hell.. try this:

main()
{
while(1)
fork;

return;
}

HEHEHEHE!

J

##### Share on other sites

This topic is 5663 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

This topic is now closed to further replies.

• ### Game Developer Survey

We are looking for qualified game developers to participate in a 10-minute online survey. Qualified participants will be offered a \$15 incentive for your time and insights. Click here to start!

• 16
• 11
• 23
• 42
• 75
×

## Important Information

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!