So I am recreating my TAS again and I wonder how do people find the best movements for NPC's in the game whilst recording input. Does loading save states actually change the character AI or is it done using a tool on the emulator?
Enjoys speedrunning, playing and TASing Oddworld games!
Has TASed:
Oddworld: Abe's Oddysee in 12.06.13 (with Dooty)
Oddworld: Adventures II in 20.03.78 (with Dooty)
Oddworld: Abe's Exoddus 100% in 2:08:28.4 (with Dooty)
Oddworld: Abe's Oddysee 100% in 1:05:01.65
Oddworld: Abe's Exoddus in 37:18
Oddworld: Abe's Exoddus in 37:15
Oddworld: Abe's Exoddus 100% in 2:!5.44.12
Oddworld: Abe's Oddysee any% in 13:01.3
Oddworld: Abe's Oddysee any% in 12:59.95
Oddworld: Abe's Oddysee 100% in 1:04:16.27
Oddworld: Abe's Oddysee 100% in 1:04:01.07
Currently working on:
Waiting for Windows TAS Tools to work so I can TAS PC version of Exoddus.
It depends very much on the game and what the "best" movements are.
That is, are you trying to get an NPC to go close to you as quick as possible so you can talk to him earlier?
Usually, you need to figure out if there is randomness and what randomness there is by the process of observation. Sometimes trial and error also helps.
This should never ever be the case, or you got a desync on your hands.
Joined: 1/16/2008
Posts: 358
Location: The Netherlands
The goal of most emulators is to produce exactly the same output if it is given exactly the same input. For emulators that are used for making TASes this is a strict requirement. This also means that loading a save-state and doing some things should result in the AI doing exactly the same.
Somewhere inside the game there is an algorithm (a computer program) that determines how an NPC should behave. Typically such an algorithm takes several inputs (eg where is the human player) to decide what the result will be (eg where should the NPC move). All information that is used as input is emulated. So the only way to get a different result is to make sure that the algorithm gets a different input. Another way to say this, is that the only way to get a different result is to make sure that the emulator is in a different state.
Many games have behavior that seems to be random. For example movement of NPCs, trajectories of bullets, when/where enemies spawn, what bonus you get, etc. For this is it common for games to use a Random Number Generator. Again this is an algorithm with input and output. However in this case the input can be just some bytes in the memory of the game that are only there for the RNG. Also the algorithm was designed to produce hard-to-predict (ie 'random') results. Even in this case, if you start from the same state the result will be the same. One way to manipulate an RNG is to make sure the game uses it more or less often.
For you as a starting point I would recommend to start analysing what has and what does not have an effect on the behavior of the NPC
I'm at a standstill in my Oddysee 100% TAS at the moment. Basically I get to the same Slog every time and my movement is frame perfect and its in the secret area in Free Fire Zone and the same movement with the Slog happens every time I try to re-record the input. The RNG must be in a loop. there is a secret area before going to the slog secret so maybe it has something to do with that. There is a loading screen before the slogs are loaded.
Enjoys speedrunning, playing and TASing Oddworld games!
Has TASed:
Oddworld: Abe's Oddysee in 12.06.13 (with Dooty)
Oddworld: Adventures II in 20.03.78 (with Dooty)
Oddworld: Abe's Exoddus 100% in 2:08:28.4 (with Dooty)
Oddworld: Abe's Oddysee 100% in 1:05:01.65
Oddworld: Abe's Exoddus in 37:18
Oddworld: Abe's Exoddus in 37:15
Oddworld: Abe's Exoddus 100% in 2:!5.44.12
Oddworld: Abe's Oddysee any% in 13:01.3
Oddworld: Abe's Oddysee any% in 12:59.95
Oddworld: Abe's Oddysee 100% in 1:04:16.27
Oddworld: Abe's Oddysee 100% in 1:04:01.07
Currently working on:
Waiting for Windows TAS Tools to work so I can TAS PC version of Exoddus.
Ok. I have been playing around with RAM Watch and Hex Editing and changing the hex values doesn't help the Slog. I'm not sure which Hex nubmer is the Slog. But here is my WIP. It's a bit strange cuz in my old WIP the slog bypassed Abe. So if anyone can find out what the hex number is for the Slog, it would be much appreciated.
http://tasvideos.org/userfiles/info/28175120347566314
Enjoys speedrunning, playing and TASing Oddworld games!
Has TASed:
Oddworld: Abe's Oddysee in 12.06.13 (with Dooty)
Oddworld: Adventures II in 20.03.78 (with Dooty)
Oddworld: Abe's Exoddus 100% in 2:08:28.4 (with Dooty)
Oddworld: Abe's Oddysee 100% in 1:05:01.65
Oddworld: Abe's Exoddus in 37:18
Oddworld: Abe's Exoddus in 37:15
Oddworld: Abe's Exoddus 100% in 2:!5.44.12
Oddworld: Abe's Oddysee any% in 13:01.3
Oddworld: Abe's Oddysee any% in 12:59.95
Oddworld: Abe's Oddysee 100% in 1:04:16.27
Oddworld: Abe's Oddysee 100% in 1:04:01.07
Currently working on:
Waiting for Windows TAS Tools to work so I can TAS PC version of Exoddus.
If you’re changing the game’s memory, that’s cheating. It’s fine to do for testing but it won’t be recorded in an input file. You need to use RAM Search, not RAM Watch, to find useful addresses. The RNG is probably a 4-bytes unsigned value, so search for that.
http://tasvideos.org/EmulatorResources/RamSearch.htmlhttp://tasvideos.org/MemorySearch.html
There seem to be 2 different articles about it, not sure why.
Can accurate emulation cause the RNG to behave different? I can get the slog to behave when hoisting up a ledge on a later frame with just a stop and turn.
Enjoys speedrunning, playing and TASing Oddworld games!
Has TASed:
Oddworld: Abe's Oddysee in 12.06.13 (with Dooty)
Oddworld: Adventures II in 20.03.78 (with Dooty)
Oddworld: Abe's Exoddus 100% in 2:08:28.4 (with Dooty)
Oddworld: Abe's Oddysee 100% in 1:05:01.65
Oddworld: Abe's Exoddus in 37:18
Oddworld: Abe's Exoddus in 37:15
Oddworld: Abe's Exoddus 100% in 2:!5.44.12
Oddworld: Abe's Oddysee any% in 13:01.3
Oddworld: Abe's Oddysee any% in 12:59.95
Oddworld: Abe's Oddysee 100% in 1:04:16.27
Oddworld: Abe's Oddysee 100% in 1:04:01.07
Currently working on:
Waiting for Windows TAS Tools to work so I can TAS PC version of Exoddus.
Why would accurate emulation influence that?
The RNG always behaves the same when given the same input unless the savestate loading doesn't restore the entire system state (which would be a bug).
Joined: 4/17/2010
Posts: 11475
Location: Lake Chargoggagoggmanchauggagoggchaubunagungamaugg
Emulation accuracy can affect the factors that RNG uses, but the principle is the same.
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.
What does that even mean? If you’re changing your movement of course the RNG is going to change… what’s emulation got to do with anything?
I think you may have no idea what an RNG is. It’s called a “random number generator”, but in truth it’s only pseudo-random. All it is is a mathematical formula that takes some specific inputs to spit out a number, then the game is programmed to interpret the number and create an outcome from it. If the RNG’s only input is your character’s movement, then unless you move differently the randomness is never going to change.
Enjoys speedrunning, playing and TASing Oddworld games!
Has TASed:
Oddworld: Abe's Oddysee in 12.06.13 (with Dooty)
Oddworld: Adventures II in 20.03.78 (with Dooty)
Oddworld: Abe's Exoddus 100% in 2:08:28.4 (with Dooty)
Oddworld: Abe's Oddysee 100% in 1:05:01.65
Oddworld: Abe's Exoddus in 37:18
Oddworld: Abe's Exoddus in 37:15
Oddworld: Abe's Exoddus 100% in 2:!5.44.12
Oddworld: Abe's Oddysee any% in 13:01.3
Oddworld: Abe's Oddysee any% in 12:59.95
Oddworld: Abe's Oddysee 100% in 1:04:16.27
Oddworld: Abe's Oddysee 100% in 1:04:01.07
Currently working on:
Waiting for Windows TAS Tools to work so I can TAS PC version of Exoddus.
Well, I managed to fix the Slog in the Secret area just by rolling at a different frame so maybe the RNG is different compared to PCSX. I'm sure there will be other hurdles I'll come across, so I just need to try the next movement at different frames to get a perfect RNG.
Enjoys speedrunning, playing and TASing Oddworld games!
Has TASed:
Oddworld: Abe's Oddysee in 12.06.13 (with Dooty)
Oddworld: Adventures II in 20.03.78 (with Dooty)
Oddworld: Abe's Exoddus 100% in 2:08:28.4 (with Dooty)
Oddworld: Abe's Oddysee 100% in 1:05:01.65
Oddworld: Abe's Exoddus in 37:18
Oddworld: Abe's Exoddus in 37:15
Oddworld: Abe's Exoddus 100% in 2:!5.44.12
Oddworld: Abe's Oddysee any% in 13:01.3
Oddworld: Abe's Oddysee any% in 12:59.95
Oddworld: Abe's Oddysee 100% in 1:04:16.27
Oddworld: Abe's Oddysee 100% in 1:04:01.07
Currently working on:
Waiting for Windows TAS Tools to work so I can TAS PC version of Exoddus.
Well, I managed to fix the Slog in the Secret area just by rolling at a different frame so maybe the RNG is different compared to PCSX. I'm sure there will be other hurdles I'll come across, so I just need to try the next movement at different frames to get a perfect RNG.
Ah, you’re trying to port a TAS from PCSX to BizHawk? You must’ve done something wrong if the RNG desynced… maybe you lost or gained a frame somewhere?
Well, I managed to fix the Slog in the Secret area just by rolling at a different frame so maybe the RNG is different compared to PCSX. I'm sure there will be other hurdles I'll come across, so I just need to try the next movement at different frames to get a perfect RNG.
Ah, you’re trying to port a TAS from PCSX to BizHawk? You must’ve done something wrong if the RNG desynced… maybe you lost or gained a frame somewhere?
That is something that emulation accuracy can affect, hence the original question
Can accurate emulation cause the RNG to behave different?
Though to be fair he said "accurate" instead of "accuracy', but I feel he was meaning to use the latter word and simply made a mistake.
Emulation accuracy effecting RNG state is something that happens in NES all the time, so its quite possible that the same could be true in PCSX emulators. Some RNGs are implemented as idle loops and are thus cycle dependent, so it wouldn't surprise me if this is the case here if you can't seem to find any other explanation Samtastic.
But it sounds like you fixed the problem, so all good anyway!
Some RNGs are implemented as idle loops and are thus cycle dependent,
What does this mean?
franpa wrote:
ALAKTORN wrote:
maybe you lost or gained a frame somewhere?
That is something that emulation accuracy can affect, hence the original question
I’m not really well-versed in emulation differences but isn’t the main thing lag differences rather than gameplay frames? I don’t think lag would affect the RNG.
Maybe that's why my overall time is slower than PCSX? Mayan the game lags more on psxhawk resulting in frame loss.
Enjoys speedrunning, playing and TASing Oddworld games!
Has TASed:
Oddworld: Abe's Oddysee in 12.06.13 (with Dooty)
Oddworld: Adventures II in 20.03.78 (with Dooty)
Oddworld: Abe's Exoddus 100% in 2:08:28.4 (with Dooty)
Oddworld: Abe's Oddysee 100% in 1:05:01.65
Oddworld: Abe's Exoddus in 37:18
Oddworld: Abe's Exoddus in 37:15
Oddworld: Abe's Exoddus 100% in 2:!5.44.12
Oddworld: Abe's Oddysee any% in 13:01.3
Oddworld: Abe's Oddysee any% in 12:59.95
Oddworld: Abe's Oddysee 100% in 1:04:16.27
Oddworld: Abe's Oddysee 100% in 1:04:01.07
Currently working on:
Waiting for Windows TAS Tools to work so I can TAS PC version of Exoddus.
Some RNGs are implemented as idle loops and are thus cycle dependent,
What does this mean?
To explain what it means, let me give an explanation of some background first. Most older games (including most NES games) use the following method to do their timing: they wait for "vertical blank" or "vblank" (which happens approximately 60 times a second and is normally used by both the emulator and the game as the definition of a frame), then do their calculations for that frame, then repeat. The fastest the game can run, therefore, is if all the calculations get done between one vertical blank and the next (the vblanks form a "frame rule" that causes everything to take an integral number of frames). How long the calculations take depends on the total number of clock cycles that are needed to run the instructions that form them (there's an (almost) constant number of clock cycles between vblanks).
If the game is running at the fastest possible speed, i.e. all the calculations are done in less than one vblank's worth of clock cycles, we call this situation "not lagging"; otherwise, we talk about "lag frames" which are frames where the game is still busy trying to complete the calculations from the frame before. So lag is highly dependent on the total clock cycle cost of instructions, and this is something that can vary between emulators due to emulator inaccuracy.
However, the total clock cycle cost per frame affects the game in other ways, too. When the game finishes its calculations for the frame, the processor doesn't just stop running; instead, it has to do something to wait. What it does while waiting for the next vblank is known as an "idle loop", and is typically a short sequence of instructions just designed to bide time. The number of times the idle loop runs is dependent on the number of clock cycles needed for the game's actual calculations, subtracted from the number of clock cycles available for the input frame (which is equal to the total number of frames, i.e. the number of lag frames + 1, that make up the input frame, multiplied by the number of clock cycles between vblanks).
One thing that games sometimes choose to do with their idle loop is to update a random number generator. In this case, the random number generator is basically measuring the fractional part of lag (with actual lag frames measuring the integer part of lag). Depending on how the game works, this might well be highly chaotic and thus a good choice for randomness generation. Emulator inaccuracies in terms of cycle count measuring will be visible both as inconsistent lag behaviour, and inconsistent idle loop behaviour; thus if a game has an idle-loop-based RNG, then if two emulators emulate lag differently for that game (the integer part of (cycles for calculations) divided by (cycles per vblank), rounded down), they're definitely going to emulate randomness differently for that game (the fractional part of the same calculation).