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.
-9926 - GI0
Global integer value. Value is initialised to 0 on stage load but not on stage reset.
-9925 - GI1
Global integer value. Value is initialised to 0 on stage load but not on stage reset.
-9924 - GI2
Global integer value. Value is initialised to 0 on stage load but not on stage reset.
-9923 - GI3
Global integer value. Value is initialised to 0 on stage load but not on stage reset.
Score Display Overflow
Specifications
- Versions:
1.00a-1.00b
- Difficulty:
Easy -
Normal -
Hard -
Lunatic -
Extra
- Mode:
Main game -
Practice mode
- Shottype:
ReimuA -
ReimuB -
MarisaA -
MarisaB -
SanaeA -
SanaeB
What happens
The displayed score in-game overflows and becomes its value minus 4,294,967,296. The player's actual score is unaffected and is displayed normally on the player data and replay screens.

How it happens
This happens if the current score internally is 2,147,483,648 or higher. This is only possible on version 1.00b, because in version 1.00a your game crashes when reaching 1,000,000,000 score.
Why it happens
In UFO, the score and highscore are stored as 32-bit unsigned integers. This means its values can only be in the range from 0 to 4,294,967,295, in total having 2^32 possibilities.
Score Display vs Internal Score
The score displayed in the top right of the screen is different from how score is stored internally. Take for example, the score 1,234,560 that is shown in the display. This score is actually internally stored as the integer 123 456, so the same as 1 234 560 but without the trailing zero.
Because of this difference, the score shown on the player data and replay screens are accurate as the internally stored score is used.
Integer Overflow
The displayed score treats the score differently. Instead, imagine the number displayed is the same number stored internally. We will call the number shown in the top right screen to be SD for Score Display.
The number SD is stored as a 32-bit signed integer. This means its values can only be in the range from from -2,147,483,648 to 2,147,483,647, in total having 2^32 possibilities.
Since score can take values from the range [-2,147,483,648; 2,147,483,647] values that go above the limit of 2,147,483,647 is called integer overflow. Values that go below the limit of -2,147,483,648 is called integer underflow.
The positive numbers from the range [0; 2,147,483,647] are represented by the bit patterns [0000 0000 0000 0000 0000 0000 0000 0000; 0111 1111 1111 1111 1111 1111 1111 1111]2.
The negative numbers from the range [-2,147,483,648; -1] are represented by the bit patterns [1000 0000 0000 0000 0000 0000 0000 0000; 1111 1111 1111 1111 1111 1111 1111 1111]2.
Suppose the current number of the SD is equal to 2,147,483,647, so 0111 1111 1111 1111 1111 1111 1111 11112 in binary. If the player gains 1 more score, its value will be 1000 0000 0000 0000 0000 0000 0000 00002 in binary. Because of this, the score displays the negative number -2,147,483,648 as its score.
Links
Replays
This section has no content yet. Would you like to add to this section? Contact me if you are interested!
Videos
- ZPS. 「March 7, 2021」. "Touhou 12: Undefined Fantastic Object - Lunatic 2,195,168,090 (Scorebug) - Sanae B" https://www.youtube.com/watch?v=foWVBHsoZQU
- ZPS. 「February 21, 2022」. "Touhou 12: Undefined Fantastic Object - Lunatic - 2,610,822,850 points - Sanae B - Clear" https://www.youtube.com/watch?v=LvwZCva0cOA
- LorenzOwO. 「December 29, 2021」. "Touhou 星蓮船~UFO Lunatic SanaeB 2,676,870,230 (C)" https://www.youtube.com/watch?v=4gl4J2BoSa4
- kopiapoa. 「September 7, 2014」. "[TAS] TH12 - Undefined Fantastic Object "Lunatic" MarisaA 6,624,561,400" https://www.youtube.com/watch?v=uok1X0LjqjU
Other
- Wikipedia. 「n.d.」. "Integer overflow" https://en.wikipedia.org/wiki/Integer_overflow
All Undefined Fantastic Object pages: | |
|---|---|
| ReimuA Bomb Desync · Score Display Overflow · MarisaA's Laser Damage · Slowdown Item Duplication · Stage 4 Invincibility Desync | All Overflow-related pages: |