Back to search

You're designing a really ambitious, complex system of a lot of different autonomous agents operating on all different variables with the economy and the different aspects of the simulation. When all of that complexity is put into place, what safeguards is CIG planning against race conditions? Is this going to be stuff that's tuned primarily during the beta? It seems like there's a big risk of stuff getting out of control with all these variables going at once.

TL;DRA separate, non-real-time economy simulation is linked to gameplay by fuzzy logic and uses "rails" that make extreme changes progressively harder, so imbalances and race conditions are avoided and it could go offline unnoticed.

Chris RobertsCEO / Game Director

Yeah, so the way that the universe is simulated and how it impacts the players is a system that Tony actually came up with, which is actually quite brilliant: we basically have a simulation that runs the universe that's separate to what everyone's going to be playing. And on that particular simulation we're running millions and millions of AI. It doesn't have to be real time, because they're just going about their job and going from planet A to planet B and accepting missions and everything. And that is linked to what the players experience by a certain level of fuzzy logic. So it's not 100% a one-to-one correlation. If on the economy side we've got a bunch of pirates attacking the various transports, and then there's a bunch of missions for players to go out and go after the pirates, we've ascertained on that system what the likelihood of an encounter with a pirate is. And if there's a lot of people, there'll be a fair amount of instances. And so there may be a case where on the economy simulation there were 10 pirates, but we just happened to have enough people jump in that there ended up being 12 engagements and 12 pirates died. Well, it's sort of fuzzy. It goes back to the economy and it says, okay, pirate died, pirate died, pirate died, pirate died. Okay, all the pirates are dead. And the fact that 12 died versus 10 died, no one's ever really going to know, because you're talking about millions of people playing it all at the same time. And so that's kind of where the fuzziness is between the actual economy simulation and the reality, because the problem you would get is if you have to have everything that happens on the player side be exactly a one-to-one correlation with a full simulation of millions and millions of AI agents, you're going to have race conditions and you'll have problems and deadlocks. And so having it be fuzzy basically means, okay, a bunch of bounty hunters and mercenaries came up and attacked those pirates and took them out. They're gone from that system. They'll be gone from the economy simulation. So you basically will have the end effect where the pirates got cleaned up in this system. The fact that 12 or 13 pirates got killed instead of the 10 that existed on the economy simulation isn't really something that is that important. The importance is a change was effected. And so that's, I think, one of the fundamental ways. And also, because we're disconnecting to a certain extent the overall simulation of the economy and what we see on the gameplay side, it allows you a bit of a buffer. It has some fudge room here and there. And it's also nice for things like: if the economy simulation server goes down, it won't kill what's happening with the players on their side. And we can deal with some offline fixing up of the economy simulation and then bring it back up. Then it can be updating what the various players see on their side. I don't know if you want to take it from...

Tony ZurovecPersistent Universe Director

Yeah, just to add a little bit, because Chris did cover a lot of the most important points there, but basically, the way it's being engineered, you could take this economic simulation offline for a period of time and no one within the game would know the difference, just given how the data is all distributed.

Chris RobertsCEO / Game Director

Things wouldn't change, basically. It would just feel static versus changing.

Tony ZurovecPersistent Universe Director

That's exactly it. And the reality is a lot of these things are actually going to evolve, just like in the real world, very gradually. You shouldn't expect that because you prevented a particular freighter from actually delivering its payload of copper, that's going to immediately spike the costs of ships, because the demand is not going to have outstripped the current inventory supply for some period of time. Also, you've got the producers of goods; they all maintain an inventory. Another thing is there's the concept of rails integrated within the economic simulation. And the reason for rails is to prevent exactly what you're saying. We're running this enormous simulation, and so you've got a lot of different feedback loops. And there are a lot of algorithms, there are a lot of values that have been assigned. It's always possible that something temporarily gets out of whack, and we may need to wind up going in, adjusting a formula, tweaking the availability of something to basically bring things back into balance. And that's why we have this concept of rails. And so you can kind of think of it, it's very similar to what I was saying earlier in regards to a spring, which is you can basically push against the system, but as you have a larger and larger impact, additional changes become more and more difficult. And so there's no effective limit in regards to how far up or down you can push something, but it does become progressively more challenging. And so what that does is it prevents you from ever getting into any sort of unattractive situation like, for example, all of a sudden there's just an absolutely gargantuan battle raging across the system. Something in terms of gameplay that would never be fun would be ammunition, because of a supply constraint where you haven't yet had enough new supply added back into the mix, becoming, if not completely unavailable, so exorbitantly expensive that only a small portion of the NPC and player population can actually purchase it. That's a scenario that you never want to happen. Employing this spring-based progressive scaling of a lot of these parameters allows us to have localized changes relatively easily. It allows us to have larger changes as the affecting agents become dramatically larger. But it prevents you from ever getting to the point that any of these critical values start to adversely impact gameplay such that you would not have a good experience.

Chris RobertsCEO / Game Director

I don't know, maybe that went over everyone's heads. But anyway, it's a very cool system. All I can say is that because we've disconnected the economy from being real-time with what the players experience, it allows a buffer, and it gives you a slightly fuzzy logic that makes it easier to protect against imbalances that can happen in the economy. The way to think of it is that the economy simulation is like a turn-based game. That's why we can simulate millions and millions of NPCs. It's going to be on one server. I don't know whether we're considering it being a multi-core server or not, but essentially it will just go through system by system and update it. It's like a turn-based game. The NPCs have the rules of, okay, now at this factory I'm producing this, and I'm now generating jobs to have this good taken from here to here. And those are the sort of jobs that a player can peek into and accept. And then at that point it gets taken away from the NPC pool and the player is responsible for doing it. And if the player successfully does it, then he tells the economy simulation once he's done it, okay, that's back. But most of the time, because obviously it's nine to one or ten to one in terms of NPCs to players, it's all happening on the economy simulation. And so each system gets updated, and you don't need to do every system all the same. You don't need to do it 30 frames a second, because in the case of an economy simulation, you don't need to have that fidelity. You can say each turn is an hour, each turn is 30 minutes. We haven't specifically said the actual ratio of it, but it will be along those lines, which means that you can go around and simulate every single star system with all these people, no problem at all. And then what we do is we actually go through doing the same thing on each system. We basically analyze the system and say, okay, in this system, there's these traders doing this route. There's pirates over here. There's some police over here. And we distill that down into what Tony's calling probability cubes. The short version of that is, you could call them encounter cubes or whatever you want. But basically, when you're in space, that determines what happens as you're flying around. It says, okay, there were pirates in this area, and there was a 30% chance that you would encounter some pirates. So you enter that area of space, it rolls a dice, yep, there're the pirates. So it generates the pirates based on various template encounters, which we set up and build. So we'll have eight or nine different versions of, like, a pirate ambushing a cargo ship, or a pirate lying in wait in an asteroid field, or a cargo ship going from point A to point B. So they're all getting dynamically generated by the economy simulation. So the idea is the economy simulation in some ways is sort of a procedural mission generator or encounter generator, where, based on the snapshot it sees in the economy, it creates all the encounter templates that you're going to see in the system. And those get updated on a time-slice-per-system basis. And that's why, when you finish your mission or you kill a pirate, that message goes back to the economy simulation and says, okay, I've delivered the goods, or I've killed this pirate. And then on the economy side, it says, okay, the goods are now on this planet, or this pirate's now dead. And it keeps track of it. But that's the point where I'm saying, if a few more goods are delivered than were in the economy system, or a few more pirates are killed, it's okay, because it's slightly fuzzy, and each system is getting updated, I don't know, whatever our frequency of updates would be, every five minutes or every 10 minutes. But if you're sitting around in a system, you're not going to notice. The state of the economy doesn't change in five minutes' time. It changes over days. So that's why the way we have the system works very well. And what the economy simulation does is it basically is procedurally generating a lot of the content for you, the missions you'll take, what's happening. And it's actually quite an elegant solution to what could be a really complicated simulation problem.

Persistent Universe Panel›2 - A Living, Breathing World·
Published on this date.29 Jan 2015