Best way of defining NPC behaviour

Started by
41 comments, last by C-Junkie 19 years, 7 months ago
Hrm, well, we could use a simple model, like this one:
Maslow's Hierarchy of Needs

As for goals...that one is harder, I mean there are the obvious ones, greed, lust, power, fame, fortune (difference between this and greed is that one should be considered more evil, while the other is neutral/good), hrm, many others do exist.

One of the main problems I can see is that as our list grows, so does the computational power required to actuate that list. So the more concise it is, the more power we can spend on accurately modeling it. Then again, the more complex the model, the more accurately it will model reality. Choices, choices...

In time the project grows, the ignorance of its devs it shows, with many a convoluted function, it plunges into deep compunction, the price of failure is high, Washu's mirth is nigh.

Advertisement
Quote:Original post by dwarfsoft
Or instead do we just have a single queue with needs and goals intermixed and individual needs or goals are weighted to be more important than others. This would be more process intensive I would believe but I think this might be the balance that would create the most interesting characters.

I am actually implementing a need driven behavior model for our NPCs myself.
Basically needs are used to calculate the actions an agent will perform, but the agent goals will be used to calculate (or better: modify) the weights of the needs.
Say an agent has the goal to be the MOST FAMOUS agent on the world. That's the goal. There may be a rule set saying you gain fame when surviving danger (for example slaying a dragon) or you gain a high ranked political position.
Let's asume the agent decides to head out for danger (As he is strong and no whimp but not rich to brible himself into a political position.)
The need for DANGER of the agent now is set to a higher level, as he now heads out for dangerous places.
Now there is a rumor spreading in the city telling about some bandits bringing DANGER in a forest outside the city. This is being added to the knowledge of the agent, and matches his need for DANGER.
Finally the rumor about bandits in the woods will attract the agent in his search for becoming famous.

Maybe he kills the bandits in the woods and gets his hands on some money, and suddenly the next rule for modifiying needs fires: the agent has money and will bribe into a political position.
-----The scheduled downtime is omitted cause of technical problems.
Quote:Original post by dwarfsoft
The way I see it, every character in the game should have their own personal story, no matter how mundane. The player simply must interact with NPC's until she finds herself an interesting story in which to participate.

I agree. In fact, I think that for such a game, the background story should be very fleshed out. Something that I always dislike about modern RPG games, pen and pencil included, is that the background isn't really that well fleshed out. It's hard to get immersed in the world when you can't even relate to the NPCs backgrounds because you know nothing really about the world they grew up in.

Things like bandits, why are they bandits? is it just because they are inheritly evil? not likely. Most often it would probably be some great loss, like their homes being destroyed, war, etc. These things would drive the person to become a bandit.

Now taking that into account, is it right to kill the bandits? Perhaps if you solved a problem elsewhere, the issue might disolve on its own. Such as deposing of an evil king.

Take magic for instance. How and why? Who discovered it? If no one knows, fine, that works for me. But things like: why did they have powerful magic way back when, but not now? Did it somehow decline in power? Or is it just that all of the great wizards died out in some war, leaving only partially trained apprentices behind to salvage their work?

It's things like that which make me grind my teeth. I don't feel as drawn into the story as I would if i had the same amount of information on the background of the place as the average child in such a place would.
Quote:
One way or another, the player will eventually find an NPC that knows of an important story of another NPC (this is what I'd like to see: NPC's communicating information with each other).

EXACTLY!!!!
How do you hear about this great evil dragon? How did the villager that told you hear about it? Presumably he was told by a traveller, what kind of a traveller? well, a trader most likely. How did the trader hear about it? Well maybe he was in the village when it happened. So as he's travelling, he tells others, and in turn attracts hero's, not just you, but many others. Some drawn by the lure of the dragons treasure (they always have treasure.), others by their good hearts (HAHAHAHAHA! Yeah right.), and still others by the fame that they will get for killing this evil dragon. Thus we have setup the scene for a competition, whereby whomever can kill the dragon wins...or do they? I mean remember, what happens in the dragons cave stays in the dragons cave...so should you happen upon the hero fresh from his slaying of the dragon, and slay him...you might very well claim credit!

In time the project grows, the ignorance of its devs it shows, with many a convoluted function, it plunges into deep compunction, the price of failure is high, Washu's mirth is nigh.

The game that I'd most like to see done would be an MMO that's populated by NPCs and players can immerse themselves in a world that lives and breathes even without their intervention. Like some have said, there would be heroes and villians in the world.

It would be pretty grand, with different cities and races and governing bodies. So the goals of NPCs wouldn't just be living and killing. They would have political agendas and kings could declare war on other nations or improve the social lives of their subjects by building up their cities. Perhaps the player might even play the king and take on these responsibilities on their own.

We would make this game go without restrictions but the world will react accordingly to players' and NPCs actions. So if you're a PKer, you'll have to fight off the guards if they see you. If you're too powerful, then vigilante groups or other higher powers will intervene.

In fact, perhaps someone who is cunning enough may try to plot the end of the world by turning nations upon each other with some treachery. So there wouldn't be a single goal for players to reach, but they can certainly form their own.

However this kind of seems to be rather unrealistic when looking at the games of today. Plus we might need very powerful servers in order to support the simulation of the game world and its NPCs. But how feasible would a game like this be in 5 or so years?
Quote:Original post by Washu
EXACTLY!!!!
How do you hear about this great evil dragon? How did the villager that told you hear about it? Presumably he was told by a traveller, what kind of a traveller? well, a trader most likely. How did the trader hear about it? Well maybe he was in the village when it happened.

I think this was discussed already multiple times here.
For each information you had not only remember the information itself, but who told you, and further more, you have to remember who told you who told them about it, and so forth...
After this, you had to set up a network of trust so you can ignore information from people you know they are lying (but on the other hand, they may only be lying to you but they tell the truth to others...)
It CAN be done, but I doubt you will have much resources left to do the actual game itself. Maybe you place all this knowledge handling on a dedicated pc...

On the other hand, if you only want the game to envolve and have the spreading about the information, this would be pretty manageable.
-----The scheduled downtime is omitted cause of technical problems.
Like I was attempting to say before my computer crashed: I really am not looking at getting this idea at all put into a game with current technology the way it is (it is quite literally unfeasible to get it working realtime, at least for large numbers of autonomous NPCs). Instead I am thinking of just developing a proof of concept for a smaller cluster of NPC's and then see if it is at all possible to expand that to a cluster (or few) of those NPC clusters.

Although, if there were a working p2p game network that was running the services accross multiple machines it may indeed be possible with as much as 20 NPC's per PC. In theory it should be possible (given enough users), but of course then comes technical implications like hacking and cross-checks ...

Anyway back on topic. Even with a large list of possible goals or needs really each character only requires a few of them to become interesting. A maximum of 10 would give them enough diversity to be individual (especially with different weightings) and then anything that was going to be too intensive to add can be fudged if need be.
Quote:Original post by dwarfsoft
Anyway back on topic. Even with a large list of possible goals or needs really each character only requires a few of them to become interesting. A maximum of 10 would give them enough diversity to be individual (especially with different weightings) and then anything that was going to be too intensive to add can be fudged if need be.

That's the idea I am trying to bring to life in our project. There is a customizeable set of needs, and each need will modify the behavior of the agents.
Some will be lazy and try not to move at all, while other are curious enough to run around the world, exploring the last point on the map. Some are whimpy and walk only beside the city guard, while other are sneaky and even avoid to be close to any guard.
And actually it is working out nice (for a few agents), I am heading to do some bigger population with more different behaviors in the coming month.

Biggest pro for need driven behavior is you (or the designer) don't have to script your NPCs but rather describe their behavior (wow, what a surprise).
But this is the biggest contra too: you can't have them move from place A to B and back again. The NPC may suddenly leave the path and head somewhere else.

Asking me as a designer I would prefer not having to script each seperate NPC on it's own, and as a gamer I prefer some more unpredictable behavior.

Also I don't like to kill a NPC and see it sespawn a minute later. With respawning you can simply run a single script on every instance of a guard.
I prefer the "perma death" of NPCs. They may respawn (or been reborn), but at another location and have to be asigned by some instance to their job. With this aproach you can't rely on scripting, as you never know how many instances of guards are around, so a reasonable solution is to work with the flexible need driven behavior.

Hope this makes any sense at all, heading home from work now ;)
-----The scheduled downtime is omitted cause of technical problems.
Well, really there is no need to wory about "forcing" an NPC to do what you tell it. All you need to do is give that particular goal or need a high priority. It will happen sooner rather than later, but at least it will still seem like the NPC has a mind of its own in the meantime.

What I would like to see is some not so common goals to be altered by events that happen to the NPC. So they decide they want to go and see the city of the juggernauts for example. Once they get there they find out that there is a great tale in the making and that many heros are fighting to invade Kingdom X because of the long hatred between your people.

Now depending on whether the personality of the NPC decides that these Kingdom X folk aren't to be trusted then suddenly the NPC gets the bright idea to fight them (or at least enlist). If it knew someone from Kingdom X and disagreed with this philosophy then there might be more diplomatic choices... But wouldn't it be fun to see the difference in the world that this could create.
Quote:Original post by dwarfsoft
Like I was attempting to say before my computer crashed: I really am not looking at getting this idea at all put into a game with current technology the way it is (it is quite literally unfeasible to get it working realtime, at least for large numbers of autonomous NPCs). Instead I am thinking of just developing a proof of concept for a smaller cluster of NPC's and then see if it is at all possible to expand that to a cluster (or few) of those NPC clusters.

As far as I can tell, I'm working on exactly the same concept you're talking about. One difference, however, is that I am taking a top-down approach in implementing ambitions. I'm giving priority to noteworthy, big-story types of ambitions (whether it be the nature of the ambition, or because the agent is powerful/resourceful), and spreading them wide across the game world. I've never been one to be impressed by having NPCs making trips to the fridge or whatever. I haven't decided yet if I'm going to make the more mundane things dynamic or scripted, but I have decided that only characters within relevant range of the player will get processing time for such things. I suppose it's possible the mundane could have a butterfly effect and possibly seed a heroic story, so in that sense I would be limiting story generation, but if I make it that far, a handful of templated scripts could compensate for that to a degree.
Quote:Original post by dwarfsoft
Well, really there is no need to wory about "forcing" an NPC to do what you tell it. All you need to do is give that particular goal or need a high priority. It will happen sooner rather than later, but at least it will still seem like the NPC has a mind of its own in the meantime.

Glad you see it the same way like me. Personally I HATE NPCs doing their scripted business and never care about changed environment.
And as a plus I like to play my own game and being surprised about the action of the NPCs. Giving them just a goal and some behavior parameters and finally watch this turn out into actions I didn't think about is almost a game itself to me.

Quote:Original post by dwarfsoft
What I would like to see is some not so common goals to be altered by events that happen to the NPC. So they decide they want to go and see the city of the juggernauts for example. Once they get there they find out that there is a great tale in the making and that many heros are fighting to invade Kingdom X because of the long hatred between your people.

Now depending on whether the personality of the NPC decides that these Kingdom X folk aren't to be trusted then suddenly the NPC gets the bright idea to fight them (or at least enlist). If it knew someone from Kingdom X and disagreed with this philosophy then there might be more diplomatic choices... But wouldn't it be fun to see the difference in the world that this could create.

Probably the control of a single agent is the same like playing a complete army in an RTS.
In a RTS you as the comander have global GOALS (usually survive and destroy the enemy). You pick some STRATEGIES for your army that are fit to help you getting closer to your GOAL, and on the lower level you have to pick some TACTICS that help you to perform your STRATEGY.

Now how can this mapped to NPC behavior?
As there are multiple layers of comand in military, there are multiple layers of decision finding with agents:
An agent has GOALS (survive, become rich, kill the murders of his parents).
To survive, the STRATEGY is to stay away from danger, and drink/eat regulary.
To drink regulary the agents TACTIC may be to stay close to a river.
The goal of "become rich" will make the agent move to locations with much business, or to areas with resources that can be sold for a good price elsewhere.

(The "kill murder of parents" goal for agents is really a big task and I probably have reached goal "become rich" when I can code this behavior in a few lines of code with taking less than 1% of CPU time. :)
-----The scheduled downtime is omitted cause of technical problems.

This topic is closed to new replies.

Advertisement