Page 1 of 2

AI or clever script?

Posted: Sun Jul 08, 2012 10:31 pm
by kaos
What exactly is the difference between AI and a really clever script?
is it one in the same? or is their a real clear difference that i haven't been exposed to?

lots of mainstream games tend to make a fuss about AI features, but when I look at them, I'm not seeing much that comes off as what I imagine AI is at all.

Even Facade. not mainsteam, and it had me excited the first couple of playthroughs.
but now It seems pretty straight forward.

I'm thinking about doing some experimenting with NPC characters and personalities for a (possibly non-game) project. but I'd like to have a better understanding before I get started.

Re: AI or clever script?

Posted: Mon Jul 09, 2012 7:48 am
by Chewi
Depends what you mean by a script. It's been a long time since I studied AI but I found it fascinating. In very broad terms, it's about getting your code to look at the bigger picture instead of blindly picking what immediately appears to be the best option. In chess, for example, sure that queen looks tempting but you might inevitably lose the game in two more moves if you take it now. Another example you are probably familiar with is that scene from War Games. This kind of decision-making falls under the study of game theory. Despite the name, it's usually applied to things other than video games. It's worth reading about it but it can get quite mathematical. A somewhat separate aspect of AI is machine learning but I doubt it's applied to video games very much. A game that learns your tactics and adjusts accordingly would probably be too damn hard, if not somewhat scary.

Re: AI or clever script?

Posted: Mon Jul 09, 2012 11:05 am
by Matt
I have a 600 page book on AI that I need to read through.

I think the difference will be like james said, though, AI looks at the bigger picture and reacts to that...where as a clever script is just, like for instance, the crappy Snap game I made for my C# game that just reacted to what cards were in the place. It didn't "think" it just did as it knew how to.

Re: AI or clever script?

Posted: Mon Jul 09, 2012 11:34 am
by Chewi
Reading your post again, I guess you didn't mean AI in the problem-solving sense. Maybe more in the intelligent conversation sense? If the player is only able to converse with NPCs from a limited set of prompts then there are obviously only a finite set of responses. Even if your actions in the game somehow influence what they say, the responses are generally finite and this is probably what you mean by a clever script. If you are able to talk to the NPCs using free-form text or even by speaking out loud (e.g. Siri) then that is a totally different ball game and takes you into the realm of natural language processing. I didn't study this but I imagine it to be horrendously complex and that's only half the battle. Not only does the machine need to make sense of what the player said but it also needs to be able to construct and convey a meaningful response. You probably want this to be audible so that means an accurate and expressive speech synthesizer. Siri can get away with not having the expressive part because it's not supposed to be emotional.

Re: AI or clever script?

Posted: Mon Jul 09, 2012 12:11 pm
by kaos
Actually I'm looking to avoid conversation for all of the reasons you mentioned.
any dialog would probably just be limited to the NPC character telling you what its doing, unprompted.

What I'd like to do create a NPC-companion.

But I want to go beyond that, and have that NPC have its own goals and be self serving.
You wouldn't be able to ask it to join you, or have it assigned to you.
Instead I'd like it to sort of "think for itself" to see if theirs any benefit in joining you at all.(and it would also choose when to leave you.)
If it chose to join you. You wouldn't be able to tell it what to do.
you couldn't equip it, or give it items, aid. These are things I'd like for it to work out on its own.
Even as a traveling companion, I don't want to strictly follow you around the world map.

Re: AI or clever script?

Posted: Tue Jul 10, 2012 11:20 pm
by Matt
Chewi wrote:Reading your post again, I guess you didn't mean AI in the problem-solving sense. Maybe more in the intelligent conversation sense? If the player is only able to converse with NPCs from a limited set of prompts then there are obviously only a finite set of responses. Even if your actions in the game somehow influence what they say, the responses are generally finite and this is probably what you mean by a clever script. If you are able to talk to the NPCs using free-form text or even by speaking out loud (e.g. Siri) then that is a totally different ball game and takes you into the realm of natural language processing. I didn't study this but I imagine it to be horrendously complex and that's only half the battle. Not only does the machine need to make sense of what the player said but it also needs to be able to construct and convey a meaningful response. You probably want this to be audible so that means an accurate and expressive speech synthesizer. Siri can get away with not having the expressive part because it's not supposed to be emotional.
Siriis just as finite as the first half of your post, though. It's not a proper conversation AI like some of the ones that passed the Turing test.

Re: AI or clever script?

Posted: Sat Jul 14, 2012 10:17 pm
by Mik
Combat AI, generally boils down to a lot of, or some very advanced, scripts anything from taking cover to not blindly waking into you. Screaming "Jihad!" before exploding into giblets is considered awesome these days.

Your companion-but not really example; Isn't that basically Barney from Half-life ? they just had him be your companion till (story)script wise he'd had enough (or you murdered him for the clip of 9mm ammo).

If you hooked the dialogue into making the decision rather than a scan of an assortment of facts it becomes.

Hey Traveller, sure are a lot of bad guys today, I'm headed to Town B, if your heading that way teaming up would be acceptable, post haste.

Player response.

1. Yeah, sure. (make it follow until town B)

2. GET DOWN ON THE FLOOR, BITCH!!! GIMMME YOUR FUKING WATCH!. (despawn in some way)

Gives the illusion on some intelligent AI if you pad the story out, into a number of questions, say 4-5 if they don't get about 4 (companion pisses off), below 2 (fight breaks out)

Re: AI or clever script?

Posted: Sun Jul 15, 2012 9:25 pm
by kaos
I dunno. I think in a multiple choice style dialog responses on the plays end, would give the player the wrong impression. I think they would feel that they were making the choice, even though the choice is really up to the AI.

maybe it should be the other way around and have the player answer by action instead of by text.

NPC: I'm headed to Town B, if you wanna tag along I'll be leaving through the west gate in 5 minutes.
m'kay, bye.

Player: (either shows up at the west gate in 5 minutes or doesn't.)

(if player shows up)
NPC: Glad you decided to come along

(if player doesnt show up)
its a lot like missing the bus... you could probably still catch up if you wanted to though.

I dunno how intelligent it'd make the AI seem.
but It'd make it seem like its not dependent on you...which is a bit of what I'm going for.

Re: AI or clever script?

Posted: Sun Jul 15, 2012 10:22 pm
by Mik
I think we talked about something similar a million years ago.

A think it was about a true sandbox game but with a storyline or something, basically it were all the NPC's and mobs were on timers to be at certain places at certain times but apart from that they could be anywhere. Theoretically they could be behind you.

Imagine hunting a guy down, you could ask someone and they could tell you rough information even though they wouldn't have to be hard written. I've already seen a simple version of this in WoW.

If your waiting on a boat you ask the Goblin and he says some basic shit like "it's almost at X" or "it'll on it's way back here".

Re: AI or clever script?

Posted: Sun Jul 15, 2012 10:52 pm
by kaos
I remember that.
In that sense a time based script is great.

but I think a time based script otherwise isnt quite what im looking for.
I want NPC's to do things because the want to do them, not because its time to do them.

(NPC from elder scrolls)
its 8pm...i gotta go to bed.

(NPC from my game)
its 8pm...I dont give a fuck about no 8pm.

Re: AI or clever script?

Posted: Sun Jul 15, 2012 11:15 pm
by Mik
In order for that to happen there needs to be something else that's dictating the events. All scripting surely breaks down into a series of IF statements.

In your bedtime scenario, some sort of 'tiredness' meter on the NPC, then some sort of script to sleep or get some cocaine.

Re: AI or clever script?

Posted: Mon Jul 16, 2012 12:44 am
by kaos
yeah.
shortly after typing that up, I started looking at the sims.
I think it could work.

Re: AI or clever script?

Posted: Mon Jul 16, 2012 8:03 pm
by Chewi
You're on the right track with The Sims. It's not so much about "if statements" but a priority list. I have a bunch of goals. The bigger, long term goals will probably break down into small sub-goals. What do I need to do in order to achieve those goals? Which of those tasks would be the most effective versus how much effort/resources/time they'd take? Does achieving those goals take priority over other short term goals like eating? Boil all this down into a numerical point system and you're set.

Re: AI or clever script?

Posted: Mon Jul 16, 2012 8:44 pm
by Mik
So by weighting the stats, you can almost dictate behaviour ? I guess it would be similar to a giant graphical game of Championship Manager.

Image

Each player has a sheet, but even if you set it all to max score, the behaviour is random or at least heavily varied because of the level of combinations and the emergent environment (other players). The game seems to rebel against max score characters too and they usually degrade over time anyway.

But using the same principles you could have a world were your actions as a player could directly effect the behaviour of all the games NPC's indirectly.

Like you blow up the only bridge into town, cutting off the food supply, you could cause a riot due to food shortages or something.

This is interesting.

Re: AI or clever script?

Posted: Mon Jul 16, 2012 9:50 pm
by kaos
yeah, that is interesting.

but for now I'll keep it simple and limit it to a single character and grow it from there.

W.I.P.
Image