546 - bombShield(int a, int script)
Sets the bomb invulnerability flag (a=0 false, a=1 true), the caller's ANM script will change to script when a bomb is active.
611 - etEx(int etId, int async, int type, float a, float b)
Adds bullet transformation to bullet manager etId, Transformation of flag type determines the specific behaviour of the bullet. Documentation can be found here.
BulletEffectType-67108864 - etExDelay(string et, string isAsync, string time)
Hide the bullet for time frames. During this time, it will not move, will be invisible and won't have a hitbox. If used as a first transformation, can be used to delay when the bullet actually appears.
6 - isDelayedSpawn
While this flag is set, the bullet will be invisible and not have a hitbox. This flag is cleared once the delay timer ends.
4 - short_timer
Integer value between -1 and 15 inclusive (by default -1). If non-negative, shooters using short_timer shoot their bullets and timer increments by 1 per frame until 15 is reached. Once 15, timer reset to -1 or 0 depending on Z key state.
5 - long_timer
Integer value between -1 and 120 inclusive (by default -1). If non-negative, shooters using long_timer shoot their bullets and timer increments by 1 per frame until 120 is reached. Once 120, timer reset to -1 or 0 depending on Z key state.
91 - floatTime(int slot, float var, int time, int mode, float start, float final)
In time frames using mode mode, variable var changes from start to final. slot is used to set the slot to be used by this ins, every enemy has 8 slots.
-9980 - F1
Local float variable, inherited by spawned enemies.
-9984 - I1
Local integer variable, inherited by spawned enemies.
-9989 - ANGLE_PLAYER
Angle from the enemy to the player.
-9962 - BOSS_Y
Final Y position of the boss.
-9990 - PLAYER_Y
Player's Y position.
-9963 - BOSS_X
Final X position of the boss.
-9991 - PLAYER_X
Player's X position.
81 - circlePos(float varX, float varY, float angle, float radius)
Performs following operation: varX = cos(angle) * radius and varY = cos(angle) * radius
-9981 - F0
Local float variable, inherited by spawned enemies.
300 - enmCreate(string sub, float x, float y, int hp, int score, int item)
Creates an enemy using subroutine sub at coordinates (x, y) (relative to position of the parent), health of created enemy is hp, score bonus is score and item drop is item.
601 - etOn(int etId)
Shoots bullet(s) using properties from bullet manager etId.
23 - wait(int time)
Stops sub execution for time frames.
1 - delete()
Returns to the top of current call stack.
2 - GAME_SPEED
The value controls by how much faster the game speed is run. This variable is often set to a number between 0 and 1. This value is often changed when a (final) boss dies or when a photo is taken. Its default value is 1.
-9985 - I0
Local integer variable, inherited by spawned enemies.
-9983 - I2
Local integer variable, inherited by spawned enemies.
-9982 - I3
Local integer variable, inherited by spawned enemies.
-9954 - ENEMY_HP
Enemy's current HP.
3 - goheiExists
A flag that determines if a gohei exists on-screen or not. Flag is set to true by active gohei. Flag is set to false if gohei goes off-screen or is despawning.
Score Underflow
Specifications
- Versions:
1.00a -
1.00b
- Difficulty:
Easy -
Normal -
Hard -
Lunatic -
Extra
- Mode:
Main game -
Practice mode -
Spell practice
- Shottype:
ReimuA-ReimuB-MarisaA-MarisaB-SakuyaA -
SakuyaB
What happens
The game sets your score to a score of 9,999,999,990. This can happen in all gamemodes, but it is easily done the easiest in spell practice mode.
How it happens
The current score must reach a negative value. The only way to reduce your score is by capturing a spell that has a negative spell bonus. Furthermore, you must make sure that the negative spell bonus is large enough such that your current total score is negative. Upon capturing a spell-card with a negative spell bonus, the text that is displayed is incorrect. This is purely visual.

Why it happens
In order to understand this we must understand how numbers are stored.
Your current score and your highscore is stored as an unsigned 32-bit integer. This means it can store values ranging from 0 to 4,294,967,295, in total having 2^32 possibilities.
In the case of a replay getting a score of 9,999,999,990, the value the game reads/writes is 999,999,999,NOT 9,999,999,990. The last digit of the displayed score is saved somewhere else.
Underflow
Since score can take values from the range [0; 4,294,967,295] values that go above the limit of 4,294,967,295 is called overflow. Values that go below the limit of 0 is called underflow.
The integer 0 in binary is 0000 0000 0000 0000 0000 0000 0000 00002. If 1 is subtracted from 0 we get a number that in binary is 1111 1111 1111 1111 1111 1111 1111 11112.
As an analogy, just imagine the number 40,000 in decimal notation. You are only able to read the first 4 digits from the right (0000). If 1 is subtracted from 40,000 we get 39,999. However, since you are only able to read the first 4 digits from the right the digits you can see are 9999. This means subtracting 1 from 0 sets the score to 4,294,967,295.
Method
In order to achieve getting a "negative score", the player must use SakuyaA and preferably go in Spell practice for this.
The way spell bonus is calculated is by subtracting a constant from the current bonus when five seconds have passed. The constant depends on the initial value of the spell bonus.
Take the following example:
SakuyaA is in Spell practice, Lunatic, Wakasagihime's first spell: Tail Fin Slap. The initial value of the spell bonus is 9,000,000 and the starting time is 40.00s. When 300 frames have passed, the score bonus decreases by a constant of 2,860 per frame. Capturing the spell unfocused with 00.01s left would give a total score of 9,000,000 - 2,860 * 60 * (40 - 5) = 2,994,000 (The - 5 is because the first 300 frames the score does not decrease).
We want to get a score of 0 or lower. This means that the constant of 2,860 has to tick down for at least 57.45s or 3,447 frames.
The time of 57.45s is above 40.00s, meaning it is not possible to achieve such a high time under normal circumstances. However, SakuyaA's subshot knives allow for special gimmick. The knives slow down the boss's actions as well as the time. This means that a 40.00s long spell can technically be stretched out to a 58.00s attack.
This is done by applying enough knives on the boss, slowing the timer. Once the timer is approaching 00.00s, the spell must be captured last second. If done well, the spell bonus gained should be a negative value. This triggers the underflow.
9,999,999,990
There is a scorecap in the modern games of Touhou, which is set at 9,999,999,990. This is an arbitrary number chosen by ZUN. It is not possible to get a score higher than 9,999,999,990 without the use of modifications.
This is why the score is set to 9,999,999,990 and not anything else.
Links
Replays
- Replay
Nyby "Nylilsa". Easy, SakuyaA, 1.00b. 「September 13, 2022」. Download link (Note: Wakasagihime's first spell-card)
Videos
- NNN_shooter. 「April 6, 2017」. "【TAS】TH14 DDC "Lunatic" SakuyaA 9,999,999,990" https://www.youtube.com/watch?v=gZgKglbe-7M
- NNN_shooter. 「July 28, 2017」. "【TAS】TH14 DDC "Extra" SakuyaA 9,999,999,990 No Lateral Move No Miss" https://www.youtube.com/watch?v=Oydp7bzTJrs
- SomeGuy712x. 「April 1, 2016」. "Touhou 14 - Sakuya A, 9,999,999,990!" https://www.youtube.com/watch?v=z4meYZZLSvc
- Crispy. 「May 19, 2021」. "Touhou 14: Double Dealing Character - Underflow Bug 9,999,999,990" https://www.youtube.com/watch?v=Ji5P6nQ0zpA
- thplayer635. 「March 15, 2016」. "scoring with sekibanki! [rollover counterstop]" https://www.youtube.com/watch?v=Pp7h7qPK-t0
Other
- Wikipedia. 「n.d.」. "Integer overflow" https://en.wikipedia.org/wiki/Integer_overflow
All Double Dealing Character pages: | |
|---|---|
| Score Underflow · Bulletless Kagerou · Marisa's Lasers · Barrier Bug · Gohei Duplication · Benben Spell 2 Crash · Screen-flipping Effect Undo · Slowdown Item Duplication · Timeouts on Tsukumo Sisters on Extra · Shinmyoumaru's 2nd Non-spell Bowl Breaking · Item Collection Bonus Persisting | All Overflow-related pages: |