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'm just going to apologize in advance for how long this post is probably going to get. I shouldn't post late at night, my posts start to ramble. [sad]

Quote:
Original post by Wavinator
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?


This is a difficult problem, but I don't think it's worth throwing the whole system out because of it.

You could retard the logic of the higher-level entities so that their actions are limited enough in scope that they never 'make waves' in the game world. This way the main purpose of the system is just to create interesting background events for the player to interact with.

You could also add some low frequency random events to the mix. Maybe in addition to the truckers, you've got a 5% chance of running into randomly generated independent freighters along any given shipping route. This would help to keep the system from ever completely bottoming out, although you'd really never want to be left with just the random events either.

There are probably plenty of other solutions I'm not thinking of.

Quote:

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?


There isn't a practical difference. In practice, I'm not a fan of implementing dynamic systems by creating a hyper-realistic simulation to govern the actions of every entity in the game world. Like I said, I see dynamic systems as a means to an end. A way to create a better random event generator.

For instance, you could implement a very quick and dirty version of my truckers by removing a lot of the specifics. The faction's logic is only used to determine the best trade routes. The AI looks at each planet and decides which ones it makes sense to trade commodities between. Now, instead of tracking each individual trucker ship, you only need to pay attention to how close to each trade route the player happens to be at the moment. If he's nearby one, there's an x% chance he'll encounter one of the ships along the route, where x is determined by the number of ships assigned to the route and the actual ship is chosen from the list.

I see a number of advantages in this kind of system. First of all, it reacts to things that the player can see. If selling food between Earth and Mars is lucrative at the moment, the player is going to encounter a lot of commercial traffic there. If business dries up, the Earth-Mars route is going to seem a lot more empty. The player can also influence it himself. If he's constantly attacking freighters travelling along a particular route, eventually either more military ships show up or traders stop following along it. Either way, the player changed the world in some small way.

You can certainly fake this kind of stuff, but I don't think doing so is actually an easier or cheaper solution.

Quote:


Then I can layer random freighter and pirate encounters over it and I bet you you wouldn't know the difference.


Probably not, but part of what I like about dynamic systems is the possibility of creating long-term connections. Admittedly, this is more important in free-form games than it is in games where there are a lot of persistent story characters.

If any given faction has a specific pool of ships to draw from, every encounter the player has with that faction will be with a ship drawn from that pool. In this way, it'd be possible for the player to meet a freighter very early on in the game and then, much later on, run into that same freighter. The possibility of chance encounters like this is something that I really like, even if it doesn't add that much to actual gameplay.

And, of course, there's no reason you couldn't augment those encounters with true random ones.

Quote:

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.


I agree with what you're saying here, for the most part. The further the system moves away from things the player can directly interact with, the more pointless it becomes. I'll admit that I got a little carried away describing what's possible with this kind of system, but I wasn't really describing what I'd want to see put into practice.
Quote:
Original post by Trapper Zoid
I'm more inclined to go with designing a virtual storyteller A.I. engine rather than a universe simulator.


For what it's worth, I don't think these two things are at all mutually exclusive. The idea behind a good dynamic system is to populate the world with interesting background events. Story events, whether they're scripted or generated by a lot of clever logic, should be kept completely separate anyway.
Advertisement
Quote:
Original post by Paradoxish
For what it's worth, I don't think these two things are at all mutually exclusive. The idea behind a good dynamic system is to populate the world with interesting background events. Story events, whether they're scripted or generated by a lot of clever logic, should be kept completely separate anyway.

They're not mutually exclusive, but they usually involve two different ways about approaching the problem.

The way I see the pure simulator approach, the focus is more on creating a working universe; as you said, it's about populating it with interesting events. In this case, the player is just another element within the system. I guess the theory is if enough interesting things are placed within the universe, and it's balanced just right, then you get an interesting dynamic game; I agree with that. The main problem is that it's an awful lot of work; you have to simulate a lot to get that dynamic system. There's also the danger that balance isn't quite right and the whole game falls apart. The few games I've seen that have tried something like this (such as Pirates!) have a few hacked rules to try to balance the game again, but there's still several loopholes the player can exploit.

The "storyteller" approach puts the focus on providing an interesting experience to the player, and the universe is just there to facilitate that. If the system needs to make some nasty hacks to the fabric of our simulated universe in order to make that interesting experience work, that's okay. It's a slightly different focus which makes a difference to how you approach the design. From this perspective, you only need to simulate what affects the player, the rest you can just wing it whenever it becomes relevant.

I suppose I'm not really being that coherent here again. I guess the main difference is that whenever I see someone discuss methods for simulations of worlds for games (not your description in this thread Paradoxish, but in general), they often go too far into the minutiae of how every little thing in the simulation fits together in a logical way; there's far too much effort involved in getting the universe right, and not caring about what happens to the player. Whereas in the "smoke and mirrors" or "storyteller" approach, the logical nature of causality really doesn't matter as long as the player is having a good time [smile].

Quote:
Original post by Wavinator
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])


Oh, indeed I will try.

But yet, I retort: Sim City 4 :)

It is a bit of a pipe dream, but it's the concept that counts, not this example implementation. Random numbers are often poorly used in video games, and procedural situations are pretty much only used in Simulation games. It's interesting though, because so many people seem to have biases against "systems" because of poor implementations.

In any case, the world wouldn't be completely fluid. It'd be more like devising a world that can only be seriously modified by developer intervention (AKA all game worlds at the moment), but has a more fluid and dynamic overtone.

The only real issue I can see here is that of computing power.

(Gotta go...in CS right now...)
::FDL::The world will never be the same
Quote:
Original post by Wavinator
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?


I think this was answered fairly well in the original post of mine. Basically, in a story-driven game, the random event would be an intrusion on a well-crafted story where detriments are part of the story-telling. It makes sense to the storyteller to have Han's Millenium Falcon break down at certain times during the story, but it does NOT make sense for it to break down at other points. Basically, random events should not exist in story driven games where (hopefully) you have a skilled enough story-teller to keep the player in enough danger that they are constantly entertained without having to add in random events.

Quote:
Original post by dink
I think this was answered fairly well in the original post of mine. Basically, in a story-driven game, the random event would be an intrusion on a well-crafted story where detriments are part of the story-telling. It makes sense to the storyteller to have Han's Millenium Falcon break down at certain times during the story, but it does NOT make sense for it to break down at other points. Basically, random events should not exist in story driven games where (hopefully) you have a skilled enough story-teller to keep the player in enough danger that they are constantly entertained without having to add in random events.


Well, what if it just so happened that at the time, Han's ship had gotten enough wear and tear from the all the dogfighting and escape maneuvers it had pulled to warrant a breakdown? "Random reactive events" are not the same as "random" events - they are more similar to procedural events. Your objective in the game is to survive and escape, whatever complications come your way. Using a procedural system, and giving the player freedom of choice that meshes with the system (e.g. don't allow the game to break something that can cause the player to automatically fail unless the player can fix it, or simply don't build in the ability to break the unfixable in the game world), you can create a system in which events, such as engine failure, occur at logical, procedural times (A la things in the real world, with the caveat that the real world is a bit too complex to predict ;)), you would have better events than scripted ones. Engine failure doesn't require any amazing writing skills to pull off. The timing of said failure might, for maximum impact, but in a semi-scripted, semi-procedural world, the fact that you would effectively have an unlimited number of confrontations would extend the premade storyline greatly.

And I forget who made this point, but:

Look at the base building AI in games like Command and Conquer. Does it ever glitch and result in immersion-breaking base layouts? The more complex a procedural system is (assuming it's an introverted system), the more redundancy and the less chance of a catastrophic failure. It's like the difference between assembly language and Visual Basic. VB doesn't let you type in errors, and formats things for you. There is vastly less oppurtunity for error, even considering typos alone, just like a complex procedural system has less oppurtunity for riddiculous error than a random number generator.

If nothing else, procedure is better than using randoms. You can do more than randoms if you want and do the same if you want, too. I'll be looking into this.
::FDL::The world will never be the same
Advertisement
There is nothing wrong with randomness. In fact, I loathe games with little or no randomness, and venerate games with randomness (and thus replayability) as a key aspect (e.g. roguelike games).

However, I do think there is something wrong with some people's view of randomness, i.e. it seems people associate the word randomness with the concepts of "insane", "evil", and such, rather than the concept of "randomness" [rolleyes]. Seriously though, it is the misunderstanding of the word that annoys me, and the following quote sums the problem up pretty well:

Quote:
Original post by Nytehauq
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 [emphasis added], nonsensical events. [...]

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


Nytehauq (or anyone else, for that matter), define what you mean by "truly random" and "complete randomness" in a precise, rigorous, yet concise manner, or otherwise that doesn't make any sense.

First off, the question whether anything "truly random" exists in the world anyways is more or less a subject of a philosophical debate, and not really even the point here.

Another thing that simply annoys me is that people talk about randomness with such carelessness and impunity. They forget such key aspects as distributions and statistical dependence and associate the word "random" with "incoherent". In order to make some real use of randomness, you really need to define the distribution and the dependence of the variables. That means just what has been said here, i.e. the end result depends on the status quo of the world and events can have dependencies (e.g. mutual exclusion and such). Still, it doesn't mean it won't be random if you use such dependencies; they are still as "truely random" as any sample from the normal distribution.

There is nothing wrong with a procedural approach, but if the procedure gives different results with the same input on consecutive runs, it is random. As for using e.g. cellular automata and such, as the Anonymous Poster recommended, I'd like to know what you'd want to use for the initial state of the system then. If you always use the same input, you lose a lot of replayability. If you generate the initial state randomly (with some well-chosen distribution), you basically just alter the distribution of the random number generator you used, making the end result still random. It might look prettier than just using the normal distribution, but it is random and there is no way around it. I'd even say that you'd be better off starting out with something randomly generated (and I still emphasize that you need to find a proper distribution for this purpose), lest you want to throw away all replayability.

Besides, the random number generator is a "procedure" anyway, you don't really get (or necessarily even want) "true" random numbers.

Also, I'd like people to consider that as far as the game designer is concerned, the actions of the player are practically a random variable. You won't know what the player will do. Thus, when you create your "totally deterministic" game system, you actually just determine the statistical dependencies of the game system and the player's actions. The distribution is an interesting concept here as well; the player is less likely to have his character commit suicide in the beginning of the game than to, well, do whatever the game is actually about.

So in conclusion of the first rant, using the word procedural doesn't necessarily change much, neither does the actual use of algorithms.

Secondly, the important concept is not whether randomness is used or not but rather how the player perceives it. The acme of logical deduction on the designer's part can seem like a random event as far as the player is concerned. For instance, if an NPC makes decisions based on whether the last three digits of the decimal representation of the number of gold coins he is carrying currently represent a prime number by themselves, it will seem "random" to the player. However, such a decision would be utterly deterministic; it's just that the player doesn't know what the decisions are based on. Such a purely non-random procedural method of making a decision is hardly better that a random one.

I agree it's silly if you're cruising along the galaxy and suddendly a bunch of enemies appear from mere nothingness and surround you. The problem is not in the randomness. The problem is that the randomness is not modelled in a particularly good way. You should get a perimeter alert or something at first, and if you can manage to outmaneuver the enemies, you don't have to fight.

All in all, the main point of this post is to make the people who dislike randomness to consider it as something else than "spawn a billion bad guys around the player character if the nondeterministic aspect of Shub-Niggurath desires so at a given moment x". Using randomness doesn't necessarily mean that you just throw in a bunch of pre-set scenarios as random encounters or a very simple context-free grammar that generates missions of the form "go to place x and kill y and come back for reward z".

Apologies for the negative, perhaps even a bit cynical tone of the post. I just wanted to write this post to advocate Wavinator's intent to include random aspects in his game. Wavinator, pay no heed to the heretics. How little they know. [grin]
Quote:
Original post by Anonymous Poster
For one thing, something has to track the 'big picture' in the game in order to control/decide what/where/when the encounter will be.


What about some sort of heuristic that factors in everything that came before? You'd probably have to classify events based on how easy they were to deal with and what sort of emotional impact they'd be likely to have. Then you'd want to somehow bias the system to generate events that either had not happened all that often before or weren't (by classification) likely to stress the player out given the player's circumstances. Pirate attacks, for instance, might drop in frequency based on how wounded the player's ship was or how often they'd happened in the past (for the sake of tamping down repetitiveness).

Whenever I think of a system like this, though, I'm really torn between whether or not the world should be something you gain confidence at mastering, or whether or not it should be something that constantly varies your gameplay. For example, if you fix pirate encounters regardless of the player situation, for instance, you get mastery because the player must adapt to the challenge. This helps cement the illusion of the world-- there's no deus ex machina outside of the system you can learn and master. If you do it the other way, players will probably appreciate that the universe caters to them, but they'll also be sorely tempted to game the system.

Quote:

Idea- one or more influence map/network that shifts areas controlled by factions/evil powers/etc..


I do want to try to use influence mapping to a certain degree to raise or drop the chance of certain events happening, but I'm concerned about the amount of processing time it would take and the system getting locked into fluctuations or local minima.

For instance, let's say that pirate conflict with the local system police drop the incidents of police patrol encounters in certain areas. I think it would be fun to witness this and help change it, but for the sake of gameplay, there are certain states that must be avoided. If you're a cop and there are no pirates, for instance, things get pretty dull. Likewise, for credibility, oscillations need to be resolved. A seesaw conflict of pirates and cops endlessly blasting each other's stations (and thus reducing their occurances in the local area) might realistically go on for years, but players wouldn't enjoy it. (it'd be like trench warfare)


Quote:

Some events ( in game might be emergence of a new faction/resource opportunity) suddenly pulled things in one direction (you did it with the mouse in the applet) and when release often cause major flips in the shape/placements as the springs equalized again.


I think I've seen this (or something similar a long time ago called SODA). Using this as an analogy for gaming, its interesting to me that things like gravity can play a role in governing the whole system. Plot or state resolutions in a similar system focused on interactions between entities might be governed by some similar global attractor. Maybe, for instance, the system always runs toward conflict, with conflict biasing the interactions between all entities just as gravity biases the interactions between spring connected entities.

(Don't know if that makes any sense)

Quote:

The adaptive aspect requires logic used to evaluate a situation and to tailor the event/ecounters attributes. Think of those big picture entities
mentioned above as centerpoints with concentric circles of different faction intensity radiating from it. Scouts on periphery, patrols next layer, defensive strength in the main territory and a core of some kind -- each zone has a different mix, strength and different reactions/tactitics. Each faction could have different units/objects/minions to fill the roles of those zones.


This seems to mimic the real-world concept of spheres of influence, which are often governed by an entities will/drive and resources (money, often). Larger entities have the power to overlap smaller entities (the United States, for instance, could conceivably invade Costa Rica, but it's highly unlikely that Costa Rica could invade the US)

I like the abstraction of the concept, but honestly the MOST ANNOYINGLY DIFFICULT problem is getting down to brass tax and deciding what EXACTLY moderates the interaction between entities. What stats/values make up an entity? What are the actions an entity can take? What are the rules which govern those actions?

This is honestly the most tangled part of realize the idea. I've also run into problems mimicking persistence and continuity. If spheres overlap and you decide that a conflict has occurred at some given location, do the entities that supposedly engaged in that conflict persist? Can I jump to the location and see starships leaving? Are they going in a logical direction, and can they be tracked? If so, you've now spawned an entity that requires AI, planning and (for consistency's sake) some connection to the game's reality via resources (not able to fire missiles infinitely, for instance).

It's ugly, and that's probably why its rarely attempted.


Quote:

Cellular automata methods can move abstract tokens around a map trying to match
the higher pattern. They move at an appropriate rate and can traffic jam or collide with opponents -- they prevent instantaneous adjustments and cause gaps and concentrations which hopefully the player will have leeway to expoit (and perhaps precipitate).


Can you talk about this more? Let's say that you abstract the Sol system and you have Alpha Centauri as the seat of another empire. The two are in conflict. The entities they have are (we'll say) agents and squadrons. Probability determines where spawns of agents and squadrons occur, with a higher density around certain loci (bases and habitats, for instance).

I've seen being able to spawn the entities and claim that a conflict occurred, but have gotten bogged down in the followthrough. How does cellular automata help? Do you determine that when a conflict occurs, rules govern where the entities might have moved and whether or not there's another conflict (if they move to the same place). (My only experience here really is the Game of Life).

Quote:

Once the actual objects are on the map in proximity to the player, they can react using the usual movement/combat stuff (with improvements to defend and retreat aspects beyond the basic 'approach & attach').


Yes, this part I think I understand. What has been nettling me for awhile now is the "behind the scenes" rules. Most of my attempts at coming up with a decent set of heuristics so far have been muddied by (overly) complicated contingencies.

Quote:

Key baddies have very heavy weights that allow them to shift only a little. Key goal objects can likewise be anchored in place.


Hey, yes, that could work! I was actually thinking of solving the problem by pulling the major characters completely out of the system via gameplay and story mechanics-- that is, you're godlike, and so are they, and even if the world blasted itself to ashes your conflict and story would remain.

Quote:

If you have lots of small control entities, shifts can be more localized (and maybe more discernable to the player -- the local gang of orcs is decimated in a fight and lose influence, instead of you just dinging the edge of the 'great orc hemogeny').


For the game map I've had thought that areas should be broken down into recognizably impactable chunks the player can emotionally relate to. Cities and towns, for instance, not the whole world. In some situations it would be nice to know that you could tamp down or spike up variables within a town and not have them leak across the entire map. In other cases, you'd want just such a domino effect.

Perhaps characters could be the gateway to whether or not effects escaped the domain of a single map? For instance: Offend the local priest and the offense stays with the town. Offend the local bishop, and it cover a grouping of towns as a county. Offend the king and the effect propagates throughout the nation.

Quote:

A graphical interface could be used to edit/test this mechanism -- simulating the player moving thru the world causing encounters whose results would visibly cause modifications to the control entities -- allowing the game planned to tweak weights (or modify rule logic etc...)


This sort of thing is probably best embedded in the game itself so that you can see exactly how it plays. More like combination map editor/event editor/planning system (for future events).
--------------------Just waiting for the mothership...
Quote:
Original post by Grim
All in all, the main point of this post is to make the people who dislike randomness to consider it as something else than "spawn a billion bad guys around the player character if the nondeterministic aspect of Shub-Niggurath desires so at a given moment x". Using randomness doesn't necessarily mean that you just throw in a bunch of pre-set scenarios as random encounters or a very simple context-free grammar that generates missions of the form "go to place x and kill y and come back for reward z".


You know, this is a valuable point firmly in the realm of enrollment/marketing. People might not even touch a game with a good procedural event generation system if they hear "random events" because they've been disappointed in such systems in the past. Point noted.

Quote:

Wavinator, pay no heed to the heretics. How little they know. [grin]


[lol]
--------------------Just waiting for the mothership...

This topic is closed to new replies.

Advertisement