Advertisement

What's wrong with reactive random events?

Started by October 16, 2005 07:53 PM
29 comments, last by GameDev.net 19 years, 3 months ago
I love these debates over 'random' events.

I think 'procedural' is the word you're looking for here though. Most people that have a problem with random events have a problem with truely random, nonsensical events. The problem, of course, is with the 'nonsensical' and not the random. It's really a non-issue when you think about the fact that the real world is a series of 'random' events, occuring inside of a system that has certain rules and reacting to form what is termed 'order'. The key here is establishing a system that is intelligent and plausible. The problem with random is that it doesn't make sense - pirate ships don't just poof into existence for no reason. Even if, according to your universe, they do 'poof into existence', there's still some reason they poofed, either in the definition of the universe or due to some chain of events therein.

Complete randomness doesn't fit into worlds that appear more complicated than just a list of random numbers.

Thus, you either need to create a more intelligent system for procedurally defining the world or make the world simple enough for random numbers (the second one is really a non-choice).

But, the debate really is pointless. It's like the difference between a polymorphic and static language - the age of hand crafted and completely specific unchanging storyline and events in games should be long over, as should the meager incremental step towards more realistic and reactive gameplay (randomness). What you need is an AI system for a world. That pirate ship should be there for a reason - just like every car in a game like Sim City 4 is where it is for a reason.

So, craft an AI that runs the world, so to speak. It's been done already. The AI can be influenced so that everything runs according to storyline, and the player is just thrown into the mix.

Thus, your actions automatically have an effect on the world. When you talk to a corrupt cop without confidence he will suspect something is up, and that will influence the cop's decisions, and that will influence his superior's decisions, and so on and so forth. Since it's procedural, his reactions are in no way scripted and match your actions more realistically than simple scripted actions. Maybe he won't send thugs. He'll wait and ambush you on false charges later, or something of the sort.

Food for thought.
::FDL::The world will never be the same
Quote:
Original post by Nytehauq
So, craft an AI that runs the world, so to speak. It's been done already. The AI can be influenced so that everything runs according to storyline, and the player is just thrown into the mix.


Great post. This is pretty much what I came in here to say.

If you model a large number of game entities that have their own motives and behaviors and then allow them to interact with one another, you'll pretty much be creating a 'better' random event generator. The difference, of course, is that the events that occur aren't randomly generated - they're created by a much more realistic set of rules that govern your game entities.

For instance, let's say you have two factions in your game world: the Space Pirates and the Space Truckers. Each faction has its own goals (which are pretty much just behaviors) and assets (ships, money, bases, territory, whatever you want) they use to follow their goals. The truckers, obviously, carry things between planets. For simplicity's sake, you can say their goal is to constantly carry goods between Earth and Mars. In a real game, you'd probably want them to have multiple goals or to change their goals based on different circumstances.

The pirates are the truckers' nemesis faction; they exist to attack cargo laden ships the truckers are sending between Earth and Mars and steal their cargo. Ideally, their goal should probably be more general - maybe they'll just attack any juicy targets that pass through their particular sphere of influence. Unfortunately for the truckers, the pirates' sphere of influence happens to include the best trade route between Earth and Mars.

In practice, this all means that there will be a constant stream of trucker ships passing between Earth and Mars. Done correctly, the ships aren't randomly generated - they're 'spawned' at a trucker base and come from the truckers' pool of cargo ships. If one is destroyed, then the truckers' have one less ship and their goals may change. Their goal now may be to acquire more ships, which may use up another asset like money or ship parts.

Likewise, encounters with pirates aren't just spat out of a random encounter generator. Instead, the pirate faction should constantly be checking for ships passing through its territory. This could, of course, be as detailed as you want. The pirates can just always know when a ship is passing through their territory or there may be some detection rules. When a target meeting the proper criteria passes through their territory they send out an appropriate number of ships to attack it. Like the truckers, the pirates have their own pool of ships and any losses are subtracted from that pool. If the pirates are running low on ships they may not want to attack well defended targets, but if they have a surplus they'll take more risks.

I think, ultimately, this design provides for much more interesting and immersive gameplay. If the player is flying a heavily armed corvette through pirate territory it's highly unlikely that he's going to be attacked. After all, he's not carrying any cargo and his ship likely poses a huge threat - why would the pirates take the risk? On the other hand, he might pick up a distress signal from an undefended freighter that's fallen under attack. Instead of being forced into an encounter, he can choose to help the freighter or ignore it. Depending on the type of gameplay, maybe he can even help the pirates.

Another benefit of this type of system is the increased sense of immersion. Since most of the entities the player interacts with aren't generated on the fly it's easier for the player to make a connection with them. Maybe the player encountered the freighter "Tempting Target" when he was departing from Earth, and now that he's passing through pirate territory he receives a distress call from that same freighter.

Even better, you can extend this as far as you want to. Instead of just transporting goods between Earth and Mars, the truckers can transport goods from any planet that has a surplus of a particular commodity to any planet that has a high demand for that commodity. If you do any sort of economic modelling, things get even more interesting. Let's say the truckers are a pretty altruistic organization and they're transporting cheap food from Earth to Mars. The pirates, however, are getting greedy and hitting more and more of the truckers' ships. Less food is reaching Mars and a famine breaks out, with the demand for food skyrocketing as a result.

You can take it as far as you want and, in the end, you'll have a system that's far superior than just about any random generator. The hardest part is keeping the entire thing player-centric and providing the AI with goals that don't allow them to 'break' the game. If the truckers are particularly important to your storyline, you don't want the pirate AI accidently annihilating them early on.
Advertisement


Well, here is my problem with random events: In story-driven games they feel arbitrary and do not have the full impact of scripted events, and in NON-story-driven games they are okay if they are not so impactful as to throw a wrench into someone's carefully laid plans. People don't mind dealing with a hiccup or two, but having a carefully planned attack strategy ruined by some hodge-podge roll of the numbers behind the scenes is not fun at all.

For instance in regards to story driven games, the Millenium Falcon sometimes wouldn't get to lightspeed and needed repairs in the Star Wars films, but that was okay because we got to see an incredible seen where they park the ship inside the throat of a monster living inside of an asteroid. The story was moved along by the space drive not working. . . not impeded by it. What if the space drive had not worked when Han was returning to help out Luke at the end of the original Star Wars? Well, the Empire would have won and, you know, Game Over. . . maybe the behind the scenes roll on the Millenium Falcon won't screw you after you load up from your last save game. . . however, your just as likely to say "Screw this. That's so stupid."

What if you were reading a Stephen King novel with 6 different "Encounter Books". He decided that because he wants the experience to be dynamic to each reader, he asks that readers roll dice every few chapters to see which book they will read an encounter from. Once they are done reading the encounter, they can return to the regular story.

That is the problem. Random events are not PLANNED into the storyline. Events should be impactful and meaningful if your game is at all story based.

However, if your game is not story-driven, but just a sandbox type game like "The Sims", then you can have random events as long as they aren't unpreventable or irrepairable. For instance, if I had a Sim who had 10 in the cooking skill and was cooking on the best stove with a fire alarm in the room right next to the fire extinguisher, I'd be pretty pissed if the stove exploded into flames and my Sims were all burned to death. It wouldn't make since for that to happen with the skill being so high and so many preventative measures being stacked up. However, let's say I have a Sim who only has 2 in cooking and he is using a terrible stove without a fire alarm in the entire house and the only fire extinguisher being by the grill in the backyard. Well, I wouldn't mind the random fire at ALL in this case, but I'd want the ability to control my Sim long enough to get him to grab the fire extinguisher and put out the fire or to call the fireman in the event that the extinguisher is too far away.

So basically, DON'T do them at ALL in story-driven games, and make them repairable and preventable in sandbox games.
I don't think that you mean preventable Dink. I think you mean "modifiable". For example, because I have a 10 in cooking, will not prevent the pipe from leaking natural gas into the house, thus creating a massive explosion and killing everything within a city block. The fire extinguisher would be worthless, the smoke detector would be worthless. It's unavoidable. My family's home blew up because of a gas leak that occurred a few months back. There's nothing you can do, this is what it means to be a member of the "real world". Sh*t happens as they say, and it's true.

However, random events should be modifiable, for example, if your cooking skill is higher, you have less chance of burning the food, or starting a grease fire, these are "preventable" accidents that can be modified by certain preventative measures. That's not to say that it's impossible for a master chef to start a grease fire, but if he truly knows what he's doing, the possibility drops to such a low percentage as to almost, seemingly, never happen.

Repairable, is a good label to use however, I agree with you here. Random events are like a rocking chair, they give you something to do but they don't really get you anywhere (stolen from Van Wilder yes). That is to say, that in no game world, would a random event bring you closer to the end goal. However, if you're playing a game where the goal is to gain more experience and be stronger, then yes, getting ambushed by fifteen bush monkies and killing them would get you "technically" closer to your goal, but if the goal of your game is to gain experience and get stronger and nothing else, then it's time to revisit the game development stage.

However, I believe that random events should not really have the power to become "game over" situations. Random events are more like freak storms, yeah, they can screw things up, but eventually they'll pass and you can rebuild. So the real focus should be on making random events set-backs to the players, hurdles that they must overcome to reach their end goal while still making logical sense within the storyline. If I'm playing an RPG and I know that a certain monster is carrying a piece of loot that I want, I don't want to have to wander around the wilderness for hours because I'm having horrible luck getting the random number generator to throw on my way. It should be more of a matter of "Monster X lives in the Creepy Forest" so I make my way to the forest and it's practically an inevitability that I will run across one. Granted I have a high enough "stalking/hunting" skill so that the creature isn't alerted to my presence and scared off.

Means to reach this goal have been addressed already, maintain a record of "how many creatures live in X area" and spawning one of them when a player gets close enough and let the player find it. If the monster is killed, then there is one less monster living in that area, however, monsters may reproduce over time to replenish their ranks, just as space pirates or truckers can buy new ships if their numbers are dwindling.

Anyway, losing my train of thought so I'm gonna stop before I start blabbering. My two cents, something to chew on.

Vopisk
Quote:
Original post by Nytehauq
So, craft an AI that runs the world, so to speak. It's been done already. The AI can be influenced so that everything runs according to storyline, and the player is just thrown into the mix.

Thus, your actions automatically have an effect on the world. When you talk to a corrupt cop without confidence he will suspect something is up, and that will influence the cop's decisions, and that will influence his superior's decisions, and so on and so forth. Since it's procedural, his reactions are in no way scripted and match your actions more realistically than simple scripted actions. Maybe he won't send thugs. He'll wait and ambush you on false charges later, or something of the sort.


I completely agree with the sentiment, but this needs a reality check. If you go the simulationist route you will have two extremely nasty problems. First, you will have to clamp and control the dynamics of the system you devise in order to CONTINUOUSLY guarantee a good experience. The larger and more nuanced the world, the more chance of disaster this has (Ultima Online's promised "organic monster economy" years ago is a famous example of this failing miserably-- they eventually had to replace it with a brute force approach).

Second, before you even begin to create something like this, you have to face the skull-cracking process of puzzling out the factors, heuristics and stats that capture the likeness of the system you're attempting to mimick. Few people seem to care to do this, at least on GameDev (my experience is that such posts are rarely replied to, anyway).

So you'll have a damnable time drawing up such a system, and an even worse time implementing it. (Doesn't mean you shouldn't try, though. [grin])
--------------------Just waiting for the mothership...
Quote:
Original post by Paradoxish
In practice, this all means that there will be a constant stream of trucker ships passing between Earth and Mars. Done correctly, the ships aren't randomly generated - they're 'spawned' at a trucker base and come from the truckers' pool of cargo ships. If one is destroyed, then the truckers' have one less ship and their goals may change. Their goal now may be to acquire more ships, which may use up another asset like money or ship parts.


So what DO you say to the player if this system falls into some local minima you couldn't forsee and, after they've spent a lot of time and money becoming an pirate, there are no more truckers? You mentioned storyline, but I'm talking about natural results. If you apply a deterministic solution (truckers will always equal >100) then how is that any different from applying deterministic solutions across the board and faking the appearance of a dynamic system?

Quote:

I think, ultimately, this design provides for much more interesting and immersive gameplay. If the player is flying a heavily armed corvette through pirate territory it's highly unlikely that he's going to be attacked. After all, he's not carrying any cargo and his ship likely poses a huge threat - why would the pirates take the risk? On the other hand, he might pick up a distress signal from an undefended freighter that's fallen under attack. Instead of being forced into an encounter, he can choose to help the freighter or ignore it. Depending on the type of gameplay, maybe he can even help the pirates.


I agree with you to a point, but what is the practical difference to the player if a pirate spawned because of a butterfly effect 7 star systems away or because zone X has a 70% chance of piracy? If you suggest that every pirate now has to detail his motivations in order to justify the difficulty of creating the former system, you introduce a completely arbitrary and artificial constraint.

Quote:

Maybe the player encountered the freighter "Tempting Target" when he was departing from Earth, and now that he's passing through pirate territory he receives a distress call from that same freighter.


Here's another good example: I can achieve this with a smoke and mirror's approach that keeps entities constant for X number of locations / minutes or whatever criteria. I can even bookmark when you saw an entity and have them comment about where they saw you. Then I can layer random freighter and pirate encounters over it and I bet you you wouldn't know the difference.

(btw, I again agree with you, but for quick development / low risk's sake I'm playing devil's advocate a bit. [evil])

Quote:

Less food is reaching Mars and a famine breaks out, with the demand for food skyrocketing as a result.


At what point is this just designer whimsy, though? If the player has no way of vetting the system (can't see it in detailed action), they have no way of distinguishing fancy rules that create and destroy objects on a whim according to percentages and this (expensive and complicated) system you're talking about.
--------------------Just waiting for the mothership...
Advertisement
Quote:
Original post by dink
However, if your game is not story-driven, but just a sandbox type game like "The Sims", then you can have random events as long as they aren't unpreventable or irrepairable.


If you couldn't quickload, what would be the difference between a random event that's a setback and a story event that's a setback?

--------------------Just waiting for the mothership...
Quote:
Original post by Vopisk
Repairable, is a good label to use however, I agree with you here. Random events are like a rocking chair, they give you something to do but they don't really get you anywhere (stolen from Van Wilder yes). That is to say, that in no game world, would a random event bring you closer to the end goal.


I disagree. In Civilization you can discover new technology, money or units by uncovering randomly generated villages. The whole goal of the game is to be strongest/best/first in several categories, and random events directly impact this.

Quote:

If I'm playing an RPG and I know that a certain monster is carrying a piece of loot that I want, I don't want to have to wander around the wilderness for hours because I'm having horrible luck getting the random number generator to throw on my way. It should be more of a matter of "Monster X lives in the Creepy Forest" so I make my way to the forest and it's practically an inevitability that I will run across one. Granted I have a high enough "stalking/hunting" skill so that the creature isn't alerted to my presence and scared off.


This sounds like it wouldn't be replayable. Is that ever a priority in the games you enjoy?

In Phantasy Star Online, randomness determined every item drop the player received. There were some rare weapons, for instance, that had a 1/133 chance of being dropped, and online these were coveted because they were so rare. But in PSO, all you did (pretty much) was run around, shoot monsters, level and hope for cool item drops (and it was very addictive).
--------------------Just waiting for the mothership...
My only aversion to randomized events is the inherint lack of control involved.

In the case where random is the difference between success and failure, it just leads to repeated attempt to get success, which makes the task unneccessarily longer. In such a case, I'd say just make the task longer by what the average number of failures would have produces anyway.

In the case where random is one event being given priority over another, it puts these events in a kind of heisenberg state. If I wane to repeat the event, theres a chance it'll never happen again; or if I want to see the other event, theres a chance that will never happen either.

william bubel
Quote:
Original post by Wavinator
Quote:
Maybe the player encountered the freighter "Tempting Target" when he was departing from Earth, and now that he's passing through pirate territory he receives a distress call from that same freighter.

Here's another good example: I can achieve this with a smoke and mirror's approach that keeps entities constant for X number of locations / minutes or whatever criteria. I can even bookmark when you saw an entity and have them comment about where they saw you. Then I can layer random freighter and pirate encounters over it and I bet you you wouldn't know the difference.

(btw, I again agree with you, but for quick development / low risk's sake I'm playing devil's advocate a bit. [evil])


Can I put a vote in for the "smoke and mirrors" approach? I've also seen a few people propose the full-on simulation approach, but I'm not sure whether the resulting emerged behaviour will be fun.

I'm planning on eventually making a game using a random mission generator (it's on my rapidly growing "to-do" list [smile]). I've seen a few people propose a simulation method on these forums, but I think it's better to work from the other way. Instead of simulating a bunch of ships and whether or not they provoke an attack, I'd work from a more game design perspective. This might be hard to explain, so I'll see if I can use an example.

The game A.I. for whatever reason decides to trigger a random battle encounter. In order to justify this, it searches through a list of possible reasons for causing the fight. Say the player has encountered the "Tempting Target" freighter at a spaceport, but the game hadn't yet decided what the "Tempting Target" was doing. Say the player also happened to be travelling through "pirate space". The game could then logically chain the two things together and invent a scenario where pirates are attacking the "Tempting Target" and the freighter requests aid. The end result might seen similar, but in this case the game A.I. has greater control over what happens, and can act as a modulator for everything in the game world.

I'm not sure if that's clear, but I'm planning on developing a system along those lines myself sometime in the future as part of my attempt to implement interactive storytelling. I'm more inclined to go with designing a virtual storyteller A.I. engine rather than a universe simulator.

This topic is closed to new replies.

Advertisement