Advertisement

Brainstorming: Social AI

Started by July 09, 2007 04:26 PM
9 comments, last by wodinoneeye 17 years, 4 months ago
I've been thinking lately about a long-neglected AI project, and could use some general suggestions on things to do with it. Here's the game setting: a basically 2D, low-tech tropical archaepelago with basic physics and some RPG mechanics like character stats. There's no particular story yet. I don't care about intense combat AI or grand strategy, as those are already being done well. What would be a fun, interesting advance in game AI that would be not too hard to achieve?
Quote: Original post by Kris Schnee
What would be a fun, interesting advance in game AI that would be not too hard to achieve?


Well.... that's a bit of a quandry. It's hard to implement a game AI to begin with. To make an advance in any field is hard, so that's already hard on top of hard. =)

It's hard to suggest ideas without flushing out your game design more. Generally AI is a response to game design and player mechanics. What does the player do? How does he do it? What purpose do the NPCs serve in this game?

-me
Advertisement
Heh. That's true. I should probably revisit the general Game Design board for that. What I've got so far for gameplay -- doing that first and not having a clear vision for the game -- is the ability to run, jump, and lift/throw objects in a very large, basically flat island landscape. The landscape is procedurally generated and distinguishes between land and water. It's also set up so that you can go to a larger-scale "sailing" screen that lets you park a boat at different spots, or leave the "zone" to visit another landscape in four directions. I also started to add an underground-exploration screen. There's also a text window where you can type messages that get sent to nearby characters.

As the topic suggests, I don't much care about doing combat AI, although I'd like to have AIs follow the PC around and helping out. I don't know if the combat should be done in a turn-based, Final Fantasy style or in real-time using the throwing mechanics. I'm very interested in doing something with non-scripted conversation and learning on the NPCs' part, but it should be fun somehow too. It shouldn't be too hard to rig things up from here such that I type "Follow me!" and an NPC says "OK" and starts doing so. Then what? My inspirations here are Morrowind for the big game world, the old NES game StarTropics for the island theme, and the Loebner Prize Contest (ie. Turing Test) that I tried one year without much success. I'd like the AIs to be doing something interesting that wasn't explicitly scripted, on an individual level rather than managing a space empire. You should be able to say things like "Where are we?" or "Go back to the village and fetch [other NPC]" and get a response.

Does all this suggest anything that you can suggest back to me? 8)
sure. decent enough starting point. You can go Black & White AI style and try to have the AI "learn" to do the things that the player does often. You're building a ship? The AI will start building more ships, or start helping you, etc. Central concept is that you are the role model, for better or for worse.

-me
you really, really need to determine your gameplay before even thinking about the AI. Your design seems very confused, like a car with no engine but 12 coffee machines. Each AI tool answers a need, but you dont know your needs yet. Thats if you want to make a game.

If you want to make an AI demo, then find the technology you want to showcase and *then* find a simple game that shows it.
If your inspiration is scripted social behaviour like NPC's in the TES games, there is indeed something you might want to try that would be of use in real games. Morrowind, Oblivion, Ultima and all other games I know of script any and all social behaviour. It is not planned in realtime. That's something you could try to do.

So, given an NPC with a set of goals, let it formulate one or several plans that will satisfy those goals. Once a plan has been formulated, execute it. Once a goal has been fulfilled, add another (perhaps randomly, perhaps scripted or whatever). Voila - an NPC that carries out its existance without scripts, instead trying to fulfill its needs in realtime.

Once you've done that, you can try to add stuff like partial and flexible planning, dealing with interruptions and failures, changing goals before they are fulfilled and, of course, optimizing.

The above is not easy. Automated planning is a huge subject. If you are going to attempt it, I suggest you read up a bit on temporal action logics and/or situation calculus.
-------------Please rate this post if it was useful.
Advertisement
Quick reply:

I played Morrowind but haven't been able to play Oblivion -- 3-year-old laptop.

This article about Oblivion's "Radiant AI" system says:
<quote>[A] character's awareness isn't strictly limited to a few hard-scripted objects or activities. It radiates out into the surrounding environment and beyond. They can choose to interact with anything they come into contact with based on parameters we set up when we create them.
This includes having conversations with one another, sitting down and reading books, buying food and supplies from shops, farming, exploring, engaging in combat with creatures or one another, and a wide range of other activities.</quote>

What I've heard about the NPCs' behavior is that they go to location A for some part of the day and pretty much sit there till a later time, when they go to location B. It seems like doing much more than that would require lots of detail in the game world's interactivity -- if a character is an official, but there isn't actually paperwork coming to him, what can he do? Can somebody point me to a more detailed description of how the AI turned out in the finished game? I know that one of the Ultima games implemented the idea of NPC schedules many years ago, so it's not a totally new idea.

On the other hand, about the NPCs' dialogue: "All of the data exists in a database file, and the NPCs pull their speech out based on numerous conditions..." That sounds pretty much like the system in Morrowind except that the words are recorded audio now. In the older game, all of the dialogue was prewritten except for plugging in variables like the player's name. The line that an NPC said in any situation was the first line in a single giant database that met certain conditions, so that chunks of dialogue could be flagged like, "If NPC is in Vivec City AND NPC is the opposite sex from the player AND the same race as the player AND a random number < 50..." All the NPCs had direct access to the game world's variables, creating bizarre results like stealing a berry and having the entire Mages' Guild instantly charging at you screaming, "Now you die!!!!1!"

What I was able to do with my own code, way back, was to record internal messages like "Person detected at [2, 1]." and parse typed input, very buggily, to respond to a few types of statement in a way that didn't use scripted answers. I found that rewarding even when the output was like "A green is an idea!" because it was being generated based on the AI's own factual data rather than something I'd written. Maybe a good context for doing a better AI would be something that emphasizes the idea that you're talking to a buggy nonhuman. Something about assembling steampunk robots or training magical creatures, maybe?
Your project sounds similar to a much more extensive simulation system that Ive been working on for the last few years.

Social AI:

Consider what intreractions will the NPCs have with each other (to act out the context that the player walks thru) and then what interactions the player will be able to have with the NPCs (they should react similarly to how they react to each other (expect the player to blunder about and destabalize a nice balanced situation).

The NPCs have roles that they play and act according to the needs and goals and tendencies of their roles. NPCs likely will have more than one role to play and there may need to be arbitration/prioritization if the needs/goals conflict at a particular point in time and current situation.

Consider that NPCs (and possibly the player) are members of larger social entities and have relations/duties/expected behaviors defined from those memberships. These higher level group entities could have their own behaviors (scripts...) that indirectly control the membership NPCs (ie- the tribe that goes on the warpath when the player insults their chief...)

A role could be something like 'stranger' which would elicit different reactions
from NPCs (there could be a goal of being wary of strangers and other uncertain/potentially dangerous characters). The goal would have monitoring logic (sensory filtering) which would classify the NPCs current situation -- and deciding what goals are currently active and what the priority is.


Goals can be met by carrying out solutions. Different solutions are available depending on skills and different skills are available to different roles/professions. A solution is just a miniplan sequence of actions and condition tests (a script) which could be made into a 'template' which could be used by any NPC who qualifies to use it. A particular NPC inherits a set of skills each of which may enable a set of solutions(to goals).

Plans are made by prioritizing goals (Im REALLY hungry, but only a little sleepy -- guess what goal has the higher priority...) Solutions usually would have a seperate component that would validate the solutions use (versus the current situation) and possibly the likelihood of its success (which could be used to pick between competing soutions for the same goal). You might apply a learning technique for a NPC instance to have and adjust a preference for one competing solution over another....)


Such a system would be a step up from the usual canned script system. It might even be interesting just to get a world situation that runs in a state of stability. And then see how well it stands up when the player walks into it.


Brainstorming:

Social relations are based on a 'deal'/contract between individuals/groups.
You get something for what you give(cost vs benefit). Paying off the evil boss with tribute in return for not being horribly killed is a kind of transaction and a continuance of the transaction can be 'worth it' as long as the loss of the tribute (the cost) is still a better deal than meeting a horrible death (or doing some other actions to 'solve' the threat -- like paying off a mercenary (the player) to kill the evil boss).

Measuring the cost/benefit in a flexible/comprehensive way can be a substantail problem to solve -- different things have different value to different individuals depending on the current situation (or potential future situatuion).

Similarly estimates of the 'payoff' of results of solutions/actions (applied to the current situation) can be evaluated by comparing them to the likely cost of carrying out those actions (and thus be used to calculate priority to pick the best solutions/actions at the current time).

Someone else mentioned that a good system would have to be able to adjust constantly to a changing world situation requiring constant reevaluation (even if it was just to confirm continuing the current plan). This constant reevaluation is one reason why future games will need alot more CPU resources allocated to AI (and one reason why game companies have avoided using such methods).
--------------------------------------------[size="1"]Ratings are Opinion, not Fact
Kris, if you own the game, downloading the Oblivion toolset would be worthwhile. You can see the Oblivion AI design-side there.

I recall looking at it (ages) ago, and it was pretty simplistic and boiled down to not much more then a few rules. I recall, but cannot find the link to either the news or source, that it was cut down radically from the initial design, due to either testing problems or unforseen consequences (NPC's being missing, quests not working, NPC's running out of things to do, eg; if they eat everything). Considering the bugs with the cut down version I can see why it might interfere - they mixed non-uniformity (Radiant AI) with rigid tasks (every single fetchquest or killquest), must have been a problem to overcome, thus the solution.

Looking at one Oblivion preview video, which seemed very scripted, it shows a better range of behaviours but isn't social at all, not in the way I presume you'd want it.

However, just pointing out that the Oblivion AI hasn't got much there really, else it might be a serious thing to take into account. It also acts very strangely a lot of the time - search google for some examples.

I like the ideas of the needs / goal / plan / solution. It could be good fun to train something if you could get it working. wodinoneeye said quite a bit on that.

An "advance" I don't see much of (and thus agree with you) is also text or voice recognition. Your idea of robots, and training, would be a pretty good one if it worked. (The robots could dynamically respond in robot voices then). Steampunk's noises would hide the breaks in words (like static does in most games with this).

Or just script it all, just so long as you might be able to command and discuss with it. That's something I've not really seen as an idea. Likely a lot of work however, but you said you'd done basics of it already. With robots you also have the ability to upgrade / change / control them, I think making game AI much more easy, since it is emulating a computer and not a biological brain, the quirks and bit limitations of game AI can be incorporated into the solution :)

I don't however know what else you'd intend with social AI, would love to know what you mean if you want more ideas. Some AI is very setting-specific (you don't need Dragon AI in a WW2 simulator) so knowing what you'd be applying it to in more detail would be nice.
Thanks, Wodin and Andrew. (And no, I don't have Oblivion and can't play it on this machine.)

Part of my problem here is that I'm coming at AI as a fiction writer and not a game designer. There's a lot of potential to do AI that's better than what's been seen before, and writing gives some insight into that, but others have pointed out that designing game AI normally means designing the game first and then making a narrowly-tailored AI for that specific purpose. I've spoken with the authors of some "chatterbots" (ELIZA descendants) and am not satisfied with that heavily scripted approach.

"Social AI" isn't a very good term; it's just meant to contrast with combat AI in FPS games, which is already pretty good. What I'm shooting for is some system that is (1) "embodied," meaning it's grounded in some kind of physical world, (2) "survivable," meaning it has to keep itself alive, and (3) "limited," meaning it only knows things through a set of senses (ie. it can't see everything). That set of rules is interesting because it's got some real-world application and it gives people a way of judging the AI besides "can it say something clever?". Ideally there'd be a program that you can hook up to different games with little modification other than plugging in new knowledge/skills.

I finally got to play Facade yesterday, and thought the authors were overreaching because they tried to simulate a complex relationship between real humans (a bickering couple with a long history). It'd be more productive to try simulating something simpler and trying to make the interaction more genuine, in that the AI really "knows" what it claims to know.

So, three possible scenarios:
1) The Islanders: There are some tribes with a simple social structure, who live by basic activities like fishing. For gameplay, you interact with them and wander around as a trader. For the islanders' AI, they should "know" how to get food and eat it, do some basic trading, offer services like healing, and be able to say what they're doing and why. They can answer questions and consider following your orders. You can get them to follow you as party members.
2) The Gadgeteer: You're building robots for some reason, and putting them to work. The gameplay involves designing/teaching them to survive in a dangerous environment and to communicate with you about what they're doing and why.
3) The Colony: There are a bunch of NPCs in a wilderness environment, and you're trying to have them build a colony from scratch while leading small parties out to explore the world and figure out what's going on.

Idea 3 sounds like it's a possible expansion on Idea 1, so that 1 would be better to do first. I've built a basic 2D graphical engine for 1, but keep thinking that it's dull because the big, open environments are empty and even having random rocks and plants to collect wouldn't be very interesting.

Starting late next week I'll have more ability to think about this stuff; important things going on at the moment.

[EDIT] As for simple robot voice synthesis, I found a Python wrapper for a version of the Festival speech synth system here, and it looks easy to use. I'd want to get different voices eventually, though.

This topic is closed to new replies.

Advertisement