
Luck manipulation is the act of controlling how the game determines "random" results through input. It has many names, including "luck abuse", "randomness abuse", or "RNG abuse".
We should emphasize that the computer, being a deterministic machine, has no concept of randomness. All it does is follow instructions. To simulate a stream of effectively random numbers, the computer uses a pseudo-random number generator (often called random number generator and known as a RNG or PRNG).
The pseudo-random number generator is just an algorithm that produces a sequence of numbers that is not easily predictable, for the purpose of the game. There are well-known algorithms for producing numbers such as:
These are just a few of the many possible ways the game can create pseudo-random streams of numbers. The game uses these RNG values to calculate random decisions, such as:
- Attack misses and critical hits (every turn-based RPG ever)
- Dice rolls (board games, casino games)
- Boss behavior (Mega Man games)
- Particle effects
This is where luck-manipulation comes in. Luck manipulation is the act of controlling random decisions through input so that the results occur in your favor.
When does the game cycle the RNG?
In order to be of any use, the game must cycle the RNG at least once when determining random events. However, there are differing approaches to when the game cycles the RNG.
- Some games simply cycle the RNG once per frame. A simple approach.
- Some games cycle the RNG frequently, using random numbers often for minor, usually cosmetic purposes.
- Some games cycle the RNG rarely, only using it for important events.
What seed value does the RNG use?
All RNGs must have a starting value, called the seed. This is what prevents the RNG from giving the same number sequence each time. It can come from a variety of sources and it is common that additional data is added on the fly to enhance randomness.
- Some games use a hardcoded seed. If the seed is reset between levels then this allows easy cut and paste of input.
- Some games persist the seed value in the save file.
- Some games run a counter during moments of the game, such as the initial menus, and use that as the starting value.
- The current time is an extremely popular seed value on systems that have realtime clocks.
- DS games like to use the firmware player profile as a seed value.
- Some games directly seed using the player controller input.
- Some games use very volatile low level realtime measurements like the exact time it took the game program to process a frame.
Which RNG does the game use for each action?
Games sometimes run multiple RNGs, using them for different purposes. It is important to know which RNG is used for which actions in the game.
What can I do about it?
Chances are, you can affect random decisions through input.

- If the game seeds using the controller, then there are many, many options here, and you can manipulate almost without loss of time, even though it is harder to optimize, because there are so many inputs that affect the RNG.
- If the game cycles the RNG once per frame, delaying button presses will be necessary, but is also sufficient for manipulation. Here, timing is the key.
- If the game cycles during an easily accessible action, such as moving or shooting, then performing that action will easily manipulate the RNG cycling.
- If the game only ever cycles the RNG through actions that are not easily accessible or through the action you want to manipulate, then it is very hard to get what you want. Some sacrifice may be required. RNG understanding and scenario construction are extremely useful here.
- If the game seeds using volatile measurements then there is usually no other option than brute forcing things by trying all possible paths. Changing resource utilization, like the active enemies, tends to cause larger changes.
The GIF of Darkwing Duck on the right shows how delaying a frame each time causes a different drop.
Luck manipulation problems
Point of determination
Let's say you are TASing Pokemon and your Pokemon, normally slower, is holding Quick Claw, so it has a 1/4 chance of going first. You try to manipulate by delaying before selecting the attack. However, no matter how many frames you delay, your Pokemon will never go first. What went wrong?
It is very important to find out when the game has decided the random action. Otherwise, you might be wasting rerecords trying to manipulate something that has been determined not to work.
In the case above, Quick Claw activation was decided before the menu appeared for your current turn. Since Quick Claw was already determined not to work, your Pokemon will always go second.
If a scenario appears where you can't manipulate an action that should be able to be manipulated, try searching backward (in the movie) until you discover when inputs can change the result.
AI
In games where decision-making is involved, the game will often have a decision-making process for the computer players, colloquially called "AI". You are limited by what the AI can do.
Say the AI can make a good move, and you want it to make some other move. If making that good move is the only result of the AI's decision, there is nothing you can do about it. The only thing you can do is to try to arrange a scenario where the AI is not in a position to make that move or regard it as a good move.
This also applies to flawed AI decisions that regard bad moves (to human players) as good moves. The only factor is the AI's insistence on making that move.
Other issues
Especially in games where enemy behavior is to be manipulated, check to make sure that the circumstance allows manipulation.
- Some enemies have set behaviors.
- Some always use a particular attack under some circumstance. It could be when at low health, or depending on your position or status.
Remember that you can only bend a game as far as its game mechanics will allow. Some games use a damage mechanic, with some form of randomness. You can't do more damage than the maximum possible value calculated by the mechanic, even if randomness goes your way.
Rarity
While not technically a problem, rarity (usually on the order of 1/1000 or worse) of an event, or a sequence of events, can be perceived as one due to the non-occurrence of the event in any reasonable amount of time. There are ways to deal with it:
- See below for tips on how to improve luck-manipulation. Specifically, subdividing a manipulation of a sequence of events into multiple manipulations may increase the probability of the whole sequence.
- Understand how the formula works, then apply it for this event.
- Use Lua or program a simulator to brute-force for this event.
- Give up.
Tips for luck manipulation
Subdivision of a sequence of events
Suppose that you want to manipulate three events, each of which occur shortly after the other. Each event has 1/16 chance of occurring, so the total probability is (1/16)^3, or 1/4096, which isn't very high.
However, if it is possible to insert meaningful input (such as delays) between these events, then instead of one manipulation for three events, it becomes three manipulations, each for one event. This is much easier to manipulate because each event has probability 1/16.
It is much easier to manipulate many outcomes, if there is a high degree for which controllable input can manipulate these outcomes one block at a time. It is even easier to do if an entropy blob is involved. Unfortunately, this is not always possible, especially in the case where the RNG is rarely cycled.
RNG memory address, and monitoring
Wouldn't it help to know which actions cycle the RNG?
This is where monitoring the RNG in memory is useful. By observing when it changes and how, one can figure out if some action can be used to help manipulation.
For example, suppose the RNG in memory tends not to change, but changes whenever you shoot a particular weapon. Then you know that shooting this weapon is useful for luck manipulation. Furthermore, you witness some enemy behaviors changing the RNG as well. You know then that this behavior can be manipulated.
Even if the RNG always changes, sometimes some action causes it to change more than usual. This usually means that this action is useful for manipulation.
You need to find the RNG in memory first. See Memory Search for details. Then watch it in memory.
The RNG formula
In general, determining the algorithm of the RNG is not easy, and finding out how the game uses these random numbers is even more difficult.
There are some popular RNG formulas, but games on older systems tend to implement their own. On the flip side, modern games tend to use the runtime library provided one.
Common RNGs share a property with standard cryptographic code: they tend to use the same key numbers. A simple search in the code for the key number can reveal a common RNG implementation.
Less secure RNGs are often reversible, there is a formula to produce numbers in the exact opposite order. This is of limited use due to savestates, but the possibility exists none the less.
Examples
One of the prime examples of luck manipulation is the Dragon Warrior movie. The player abuses luck in his movie of this game in different ways.
- All undesired enemy encounters are avoided by stopping his motion for a frame or two at various times along the player's path.
- When encountering enemy, its HP is manipulated to be as low as possible.
- Critical hits are gotten 100% of the time by scrolling through the battle menu and waiting to attack on a particular frame. A single frame of difference would not have resulted in a critical hit.
- When using an enemy encounter to suicide, the enemy is manipulated to attack first.
More reading
- Luck manipulation is one of the basic TAS-making techniques, listed at Common Tricks.
- Reverse Engineering
- Advanced Luck Manipulation
- Random Generators lists the technical details of randomness generators in different games.
- Glossary lists other terms.