Advertisement

Dynamic PLot/Adventure System Thing?

Started by July 17, 2004 11:36 AM
27 comments, last by Nazrix 20 years, 6 months ago
While writing my design and treatment docs, I realized that one of my features is probably already being done, and I need to learn more about it before I continue. I have an idea for a kind of dynamic plot/story/adventure system, and I’m looking for examples of it in existing games. So I’m turning to you guys for help finding some terminology and examples. The best I can do is to call it a “dynamic plot system thing”. :) Here is the idea: --- Essentially, the game engine keeps track of the world map not only in specific grid locations, but also in larger areas, for now lets call them zones. Something on the order of a valley, or a mountain peak, etc. Each zone has certain characteristics that make it more or less suited to different inhabitants. For example the valley would have more food than the mountain peak, but the peak would have more hiding places for inhabitants not wanting to be found. Initially, the game designer assigns an inhabitant to each zone. Perhaps a dragon is assigned to the mountain peak, and perhaps a small town of farmers in the valley. Each zone’s inhabitant affects the surrounding zones inhabitants. For example, the valley farmers will have little effect on the dragon, but the dragon will definitely affect the farmers. Now lets assume time starts passing, and the inhabitants start interacting with each other. If, for example, the player visits the valley, then the inhabitants (the farmers) will complain about the dragon. Here already is a quest or sub-plot. If the player kills the dragon, then the valley zone is no longer effected by the mountain peak zone, the farmers will say they are happy, and the quest can be considered complete. But before too long, the game engine will try to re-assign an inhabitant to the mountain peak zone. This new resident of the peak could be friendly such as miners, which make the valley farms rich and grow, or it could be unfriendly such as thieves, which hide in the mountains and prey on the farms making them discontent again, and a new quest would be born. --- This is a very simplified summary, but already you can see what I’m getting at. The system is based on simple rules of zone resources, and inhabitant interaction. This is essentially a cellular automaton construct that be made to cycle in controlled patterns, for example as the seasons change the characteristics of the zone terrain. So here are the questions: --- So who is doing this kind of thing now, or historically? How did it turn out? What is the accepted game industry terminology? Are there any threads on this here in GameDev that eluded my searches? Any books? Much thanks for any help, zTn [Edited by - ztn on July 17, 2004 12:36:22 PM]
You may be interested in checking out game design luminary Chris Crawford's Erasmatron Project. It inspired me to try out a couple of angles some time ago, but many of them I abandoned because of complexity and strategic dependencies between actors and the environment.

There were two major problems I ran into: First, how variegated should the actions of actors be? The more detailed and atomic, the more flexibility you have, but also the larger the number of complications and potential for nonsensical plots.

The second, more serious problem I had was in how actors would strategize, which would involve some map analysis and weighting of future possibilities. If you're planning on having the AI actors simply duke it out with other AI behind the scenes, then you'll probably avoid this headache. But if the player can intervene in any one plot thread, especially if they can do so at any point, then there'll be alot of detail to handle.

An example, in case this makes no sense, is this: You've got a the thieves in the mountains, and they're raiding the village. Maybe in one plot possibility you have them kidnap and ransome the mayor's daughter.

Now does this just happen behind the scenes (which I think is fine and much easier to do, but inflexible) or is it played out through on-the-map AI? If the latter, then does the AI plan AROUND the player, say sneaking into the town and avoiding him? What if the player decides they're going to guard the mayor around the clock? If the player can alter the environment to any extent, such as casting spells, posting defenses or moving other actors around, then the villains need to plan for this.

One thing I noticed about pregenerated plots is that they have an easy time of setting up all the pieces just right. When plot points repeat, it can become meaningless. So a good question to consider if you haven't is what happens the fifth or tenth time that thieves have been spawned on the mountain? What is different about it? Will the thieves have learned from the mistakes of the past, and bring to the fore weapons and strategies that prior villains didn't have?

If you go the more abstract route, you'll have an easier time, but you'll sacrifice player interactivity in the process. But even still, it'll be different from most games out there, the vast majority of which dictate story to you with little input on your part.


--------------------Just waiting for the mothership...
Advertisement
Thanks for the link. I’ve come across these pages before, but never given them the reading they deserve. (A mistake I intend to fix shortly…)

Regardless, you are quite right about the inherent complexities of this type of system, and how they can spiral out of control as the number of “possible” interactions increases. However, this will not be the central feature of my game, and just as you hinted, I will err on the side of generality to avoid problems. But its still gonna be fun to play with…

I thought for sure that some MMORPGs or even single player games were doing this by now, but I’m starting to think I’m wrong. This seems less of a new path to take, but instead one most developers intentionally avoid.

But like I said, I’m going to do it anyway. Once I started keeping this kind of information in the game engine, so many cool uses for it started appearing.

Wish me luck,
zTn
I'm interested in doing similiar things with my RPG. :)

Anyways, I got a little inspiration from your post and wrote a small program which is very basic but still is interesting because it shows that getting relationships between people is not that hard to generate.

The program generates three people; a mechanic, a farmer and a cook. The mechanic makes tools which the farmer needs. The farmer makes grain which the cook needs. The cook makes food which both the mechanic and the farmer needs.

In forty lines of Python code, this sort of relationship was supersimple to make. Simply create the three characters, and let them find out about eachother. They then realize who they can get their stuff from.

Here is the code for your pleasure ;)

class Person:	def __init__(self, title, desires, provide):		self.title = title		self.provide = provide		self.desires = desires		self.contacts = []		self.buyFrom = {}	def addContact(self, person):		self.contacts += [person]		for desire in self.desires:			if (person.provide == desire): 			# and (self.buyFrom[desire] == None):				self.buyFrom[desire] = personpeople = []def init():	global people	people += [Person("cook", 		["grain"], 			"food")]	people += [Person("farmer", 	["tools", "food"], 	"grain")]	people += [Person("mechanic", 	["food"], 			"tools")]	for person in people:		for otherPerson in people:			if person != otherPerson:				person.addContact(otherPerson)def printRelations():	global people	for person in people:		print "The %-9s supplies: %-6s" % (person.title, person.provide)		for desire in person.desires:			print "The %-9s wants:    %-6s from the %s." % (person.title, desire, person.buyFrom[desire].title)if __name__ == '__main__':	init()	printRelations()



EDIT: Oh, nearly forgot. Here is the output of the program:
> Executing: C:\Program\ConTEXT\ConExec.exe "C:\Program\Python\python.exe" "settlers.py"The cook      supplies: food  The cook      wants:    grain  from the farmer.The farmer    supplies: grain The farmer    wants:    tools  from the mechanic.The farmer    wants:    food   from the cook.The mechanic  supplies: tools The mechanic  wants:    food   from the cook.> Execution finished.


[Edited by - Srekel on July 18, 2004 5:32:24 AM]
------------------"Kaka e gott" - Me
There is no doubt in my mind that these types of systems are easy to implement in software. In fact, if you follow any basic OO design principles at all, it should be as easy as your example above in just about any language.

Instead, I think the hard part is foreseeing all possibilities and play balancing issues. Wavinator’s post above does an excellent job of highlighting the some of the biggest issues. For Srekel’s example above, is the need for food enforced? That is, will everybody in the town die if all the cooks are dead, or will they just complain about it?

In short, I think creating a system that player’s can understand intuitively, and depend upon logically will be difficult to achieve. This is why I’m sticking to very high-level concepts with few interactions at first, such as weather patters and zones of inhabitants that determine random encounters etc.

But regardless of what you are doing, or how you implement it, I think the system should be designed from the perspective of cellular automatons. This forces you to think generally about the rules that govern interaction between the cells, and at least in my case, helps me to visualize all possible behaviors. In addition, I can use general FSM toolsets to visualize their relationships on screen, and even simulate/test their behavior. In short, if you stick to simple generalized rules, I think your chances of making an intuitive and dependable system are higher.

I think this kind of system is the opposite of what is typically called “scripted” systems, and that using the emergent behavior of these new systems is what will define the next revolution in gaming. Already I can see small scale examples in games like The Sims which use individual people as nodes, or console games with teaming small creatures that player’s can heard around. I’m using these systems in an RPG design, where I think players can better exploit them, but I still looking for others who are doing the same.
Hey, it's nice to see someone else with the same opinion :) I thought that this topic was avoided by all programmers like some kind of a disease but I was wrong ;) Your approach does a really good job at abstracting the quests into more high-level stuff, as you pointed out. I'll try to find a way to meld this with the system I have, that could be a bit too CPU-intensive. The needs of each creature in the world is under the form of conditions that need to be satisfied ("find food", "rescue daughter"...). A REALLY basic planning system looks at the conditions that it needs to "solve" (starting with those with a higher priority level) and looks for an action that the creature can perform, that does this. Each action can create more conditions (to eat something you need to grab it first) but at the end you'll get a logical list of stuff for the creature to do. The farmer may arm himself to rescue his daughter or pay a stranger to do it.

This assumes that each creature and the objects they interact with exist explicitly in the world at all times; this should be no problem to any MMORPG but if I could throw in some abstraction using cellular automata maybe it could optimize most of the processes :)
Advertisement
Jotaf,

Hhhhmm… I’m not sure I see how a discrete system could help your NPCs make decisions in the examples mentioned above. In other words, I don’t see how the decision to “find food” or “save daughter” could be emergent. I’m interested to know how you are planning on doing that.

I do see how a group of interacting NPCs could emerge to all work together on such tasks. Is that what you meant?
Narrative Interpolation
Annotated objects

In fact, searching for "annotated objects" on this forum brings up a number of helpful starting points.

ld
No Excuses
liquiddark I never heard of that, I'll check it out now :)

The basic needs of every single living creature on Earth are hard-wired into their DNA. Why do you want them to be emergent so badly? :p If hunger exceeds a threshold, the NPC has a new objective, which is to find food. There can be lots of different actions that achieve this objective, but that's up to the planning system. Couldn't be simplier, and I don't see the benefits of making it more complex than that :)

Rescuing a daughter is not really a basic need, which doesn't mean that it isn't high on the NPC's priorities list. The NPC has a number of people (other NPCs, or even players) that he/she cares about. If the NPC knows that one of them has a need that they can't fullfill by themselves, it will become just another objective for the NPC.
You don't need to go that far into NPC psychology though :p When a bandit kidnaps an NPC, all the NPCs that care about him or her receive the objective of rescuing the NPC. You see, SOMETHING has to be hard-coded; that's where the whole plot begins. From these premises, the rest of the story will evolve. But ztn's suggestion could be very handy for generating these premises.
Quote:
Original post by Wavinator

There were two major problems I ran into: First, how variegated should the actions of actors be? The more detailed and atomic, the more flexibility you have, but also the larger the number of complications and potential for nonsensical plots.

An example, in case this makes no sense, is this: You've got a the thieves in the mountains, and they're raiding the village. Maybe in one plot possibility you have them kidnap and ransome the mayor's daughter.


maybe the answer is how the NPCs' actions are carried out. I mean, combat is pretty repetitive too but what helps is that a battle can go different ways cause there's different options. So what each character does to complete a goal makes it interesting even though it's done many times. It's the variables and the combinations of different parts that make something fun even though on the surface it's repetitious.

I'm not sure where to go from here yet though...have to think about it
Need help? Well, go FAQ yourself. "Just don't look at the hole." -- Unspoken_Magi

This topic is closed to new replies.

Advertisement