## The Reset Dilemma

#### Repeated Player Input = Same Simulation Output?

Yes, Given exact same starting conditions, player input x should always reproduce environment reaction y
Total votes: 3 (19%)
No, Given exact same starting conditions, player input x could reproduce environment reaction y, but it could produce a new reaction
Total votes: 7 (44%)
Let the player choose in the option menu, enable/disable "Pseudo Persistence"
Total votes: 6 (38%)
Post

### The Reset Dilemma

#1
Consider the following scenario:
- The player saves their game when the universe is 1000 seconds old.

- They continue playing their game for another 500 seconds and all their actions and input is summed up into x

- The player decides they didn't like what happened during those 500 seconds after playing and decides to reload his save game.

- Now, everything except the player's decisions is determined through the simulation, specifically the probability of an AI making a decision. The question is, if the player performs the exact same input x, should the reaction of the universe be the exact same?

- To expand on what I'm trying to say, should the RNG, that generates values that will eventually end up as a value between 0.0 - 1.0 that is used for a decision algorithm, be the same pseudo RNG that is seeded with the master seed to produce the environment itself. Or, since many of these values are needed throughout the simulation of the game, would a more realistic option be to get values from a RNG seeded by time since epoch which would have the situation played out after the saved game not guarantee to be the exact same every single time.

If that doesn't make sense let me know.

Would like to hear yalls thoughts on this.
Post

### Re: The Reset Dilemma

#2
If the player does the same action at the same instant as it was previously played out the result should be the same. Though, from playing other games this is next to impossible for me to do. So, while the end result should be exactly the same, the fact that the actual action the player makes could occur 30 seconds before or after the previous save event, the end result will likely differ accordingly.

Example: You play a save for 16 minutes. At the 15 minute mark you shoot a trader who has just left a station, and he fires back damaging your ship.
You reload and play for 14 minutes retracing your steps. You reach the station and notice that the trader is far off in the distance heading to a near by asteroid field. What happened? Well, you took 10 seconds to look at something you hadn't noticed while you were on your way back to the station. This gave the trader a 10 second head start on you and prevented you from being able to shoot at him a second time.

This is how it works out in my gaming experience anyways. Unless the target is standing still at a location, it is never predictable as to where the target is at any given point in time.
Post

### Re: The Reset Dilemma

#3
Cool. Now lets say you retraced your steps perfectly. You aren't yet at the station and the AI hasn't decided to undock yet. He just completed some task and has to run through his decision algorithm to decide what he is going to do next.

Based on his attributes, whenever it comes time to make a decision, he has a preference for the types of task he now wants to pursue:
1. Aggressive oriented tasks - 10%
2. Economic oriented tasks - 70%
3. Exploration oriented tasks - 20%

The first time the scenario ran he decided to go mining and you shot at him. Now should there be a guarantee from the Game Master, the computer in this case, who provides seeds for the algorithm to be setup in such a manner that if x does happen then y is guaranteed to happen. If the input is the exact same, as in, the player performs the exact same input, should the result be same.

So for the scenario, it would probably boil down to a RNG that has it's value clamped to a number between 0.0 and 1.0. As in:

Code: Select all

``````// This method would be called when an AI completes a task and requires a new one to strive towards
// The Random Number Generator that it will use to determine exactly what to do next is passed as a parameter
{
// Just a holder variable that will contain a value between 1 and a very large number
// which will possibly be 18,446,744,073,709,551,615 which is the max decimal value a 64 bit unsigned integer can hold
unsigned long long rawRandomValue = generator.getNextValue();

// We want to scale the value down to a value between 0 and 9999, this prevents weird percision bugs that could be created in the next
// calculation if we didn't do this
unsigned long long clampedRandomValue = rawRandomValue % 10000;

// We take our clamp value and divide it by the maximum value a clamped value can be, which effecitivley transforms the value into a normalized float
// 'c' contains the 0.0 to 1.0 floating point value that we want
float c = (float)clampedRandomValue / 10000.0f

// Our AI is going to be more "economic" oriented since in your example, boba, you said he was heading out to mine.
// Lets say the description of our AI's attributes or perosnality is just described by a single floating point number for each attribute possible
// The sum of the values for all these attribtues must be equal to 1.0. Lets say he has the following attributes:
// Aggressive 	- 10% or 0.1 as a floating point value in memory
// Economic 	 - 70% or 0.7
// Exploration - 20% or 0.2

// These are the constants talked about above, in reality these would be determined when the AI is first created
// And just be instance member variables for the "AI" class
float currentAIAggressiveRate 	= 0.1f;
float currentAIEconomicRate		= 0.7f;
float currentAIExplorationRate	= 0.2f

// Thses values set below represent the chance an attribute will influence the generation of the AI's new task
// The key takeaway point here and in the branching code below is that an attribute with a higher rate
// will more likely be chosen which is what the programmer would want, they would want an "aggressive"
// person to usually choose aggressive tasks to do like pirate, fight, ect...
float aggressiveChance 	= currentAIAggressiveRate;
float economicChance 	 = aggressiveChance 	+ currentAIEconomicRate;
float explorationChance  = economicChance 	+ currentAIExplorationRate;

if(c <= aggressiveChance)
{
// Now that we know the AI has decided he will work towards an aggressive oriented task, we have to generate one
// Which an entire different function and just take the returned task and set this specific AI's task instance variable
// with that value
}
else if(c <= economicChance)
{
}
else if(c <= explorationChance)
{
}
}
``````
Okay with all that out of the way. The poll and question is about the parameter passed to this function. What seed was given to that pseudo random generator passed, if it is even pseudo.
The question isn't referring to whether the player has the ability to perfectly repeat his actions, that is a given in this situation (or the player simply has no influence on the decisions about to be made). The question is referring to whether given the exact same state of the game, except for the fact that this isn't the first time this state has been reached, should the saved game files be setup in such a way where they remember where the pseudo generators left off from last time. One might think the procedural nature of the game will break if the save file doesn't remember what iteration the pseudo number generators left off but that isn't true at all.

The game will NOT break if they don't remember, however if they don't remember the universe that plays out will most likely be very different every single time because those decisions made by the AI boil down to that 0.0 - 1.0 value and if the generators don't remember where they left off, when the saved game is loaded again, the values pumped out of the generators won't always be the same and hence different RNG values are created and the decisions algorithm generates a different output. The output could be the same yes, but not always.
I really don't think I'm explaining this very well ha-ha.

Here’s an illustration:
Post

### Re: The Reset Dilemma

#4
I admit that what you are describing is a bit over me head. Besides that I'm going to say that in theory everything stays exactly the same while in practice things will appear random.

This is probably not the answer you want so I'll let some other member of this community have a shot at answering this.
Post

### Re: The Reset Dilemma

#5
Programmatically, making the game perfectly deterministic is extremely difficult if not impossible, and since it's impossible to notice unless you automate your input just to see if it is I din't see the point of wasting time on it.
Warning: do not ask about physics unless you really want to know about physics.
The LT IRC / Alternate link || The REKT Wiki || PUDDING
Post

### Re: The Reset Dilemma

#6
Dinosawer wrote:Programmatically, making the game perfectly deterministic is extremely difficult if not impossible, and since it's impossible to notice unless you automate your input just to see if it is I din't see the point of wasting time on it.
This is rather dependent on the context and type of game. For anything real time, like an FPS, RTS, Space Sim, and so on, yeah, not especially relevant.

But it is very applicable to turn based games. The best example I can think of is the success rolls in XCOM (the new ones in particular), where the game actually does provide the option for the player to choose. If your soldier misses that 90% shot and dies as a result, it's the difference between being dead for good and reloading for another chance.
Post

### Re: The Reset Dilemma

#7
That's the difference between determinism and probabilistic causation.

In the first case, everything is entirely determined by the past and the design of the system, so given exactly similar user action OR independance from user actions, the same will happen.
In the second case, the probabilities are given by the past and the design of the system, so the same will normally not happen exactly, but "on average" globally you will recognize that this is the same universe, such as "this system has agressive people. I do not know which, but probably one of those ships will attack me".

The second option is the usual one, as it is more interesting (no exact prediction, but logical behavior).

In the case of LT with procedural generation, I would assume that the asset generation (systems, planets, NPC) will be determined (so the root of the pseudo-random generator will be saved) in order to allow several games in the same universe.
But actions of individual AI may be only probablistically caused, to keep the game interesting, i.e. This second pseudo random generator will have a new root at each start/load/reload (e.g. the timestamp)... but remember - if the probablity of a behavior is high, it will most probably happen again (so you will not often be suprised when the outcome is likely, such as the AI is a pirate in a stonger ship then yours and no police is around: probability of attack is 99%, so a new random draw will probably not save you!
Post

### Re: The Reset Dilemma

#8
Mordakai wrote:
Dinosawer wrote:Programmatically, making the game perfectly deterministic is extremely difficult if not impossible, and since it's impossible to notice unless you automate your input just to see if it is I din't see the point of wasting time on it.
This is rather dependent on the context and type of game. For anything real time, like an FPS, RTS, Space Sim, and so on, yeah, not especially relevant.

But it is very applicable to turn based games. The best example I can think of is the success rolls in XCOM (the new ones in particular), where the game actually does provide the option for the player to choose. If your soldier misses that 90% shot and dies as a result, it's the difference between being dead for good and reloading for another chance.
I know, I was talking about LT, not games in general
Warning: do not ask about physics unless you really want to know about physics.
The LT IRC / Alternate link || The REKT Wiki || PUDDING
Post

### Re: The Reset Dilemma

#9
Depend on what parts are determined by the games seed.
"A sufficiently advanced technology is indistinguishable from magic."
- Arthur C. Clarke

### Online Now

Users browsing this forum: No registered users and 1 guest