Battle Garegga/Advanced Rank

See Battle Garegga for the main page.

Overview
Rank in Battle Garegga is a bounded integer. Its maximum value is 15,728,640, and its minimum value is 2,097,152 for "normal" DIP switch settings and "Arcade" mode in the Battle Garegga Rev.2016 port.

In the arcade release, rank is hidden from the player. However, the Battle Garegga Rev.2016 port allows the player to track rank as a percentage in real time in the "rank graph" M2 gadget. The rank% displayed in the rank graph is a simple linear conversion from the rank variable stored by the game:

rank% = 100 * [(max-rank)/(max-min)]

max = 15,728,640 (0xF00000 in hexadecimal)

min = 2,097,152 (0x200000 in hexadecimal)

Note that rank% is 0.0% when rank=max and 100.0% when rank=min. Thus, high rank means low difficulty and vice versa.

For a rank change from any given source, the conversion goes:

Δrank% = 100 * [Δrank / (max - min)]

Rank is updated every frame according to a value called the frame rank as well as other specific events. These events are firing the ship's main shot, firing an option, picking up an item, deploying the ship's special weapon, sealing an enemy bullet, and dying.

''Note: The rank graph only displays rank% with one significant figure, which is larger than many rank changes throughout the game. Thus, tables of rank% will display more significant figures than encountered in game for the sake of accuracy.''

HP Scaling
One of the most noticeable effects of rank is how it influences enemy HP. When an enemy spawns, its maximum HP is calculated by the formula:

HP = ((0x300 - 2*(rank >> 16)) * base) >> 8

In this formula, base is the default enemy HP. Note that changing rank will not update the HP values of any enemies on screen, only new enemies that spawn under the new rank value.

What this means in practice is that enemy HP scales linearly from x1-x3 of the base HP value as the absolute rank decreases and rank% increases. Enemies will spawn with their base HP value when rank is the maximum value of a 24-bit integer, 0xFFFFFF. However, the default rank value (i.e. 0.0%) is 0xF00000 so the base HP values are never actually encountered during gameplay. When rank reaches half of a 24-bit integer, 0x800000, this scaling is x2 and enemies spawn with double their base HP. If rank were to reach the minimum value of a 24-bit integer, 0x0, the scaling would be x3 and enemies would spawn with triple their base HP. However, the minimum rank value (i.e. 100.0%) is 0x200000 so enemies with triple HP are also never encountered. (Setting the DIP switch to "hardest" will lower the minimum rank to 0x80000, but since this is considerably greater than 0x0 enemies will still spawn with less than triple HP.)

A summary of enemy HP scaling encountered in game is displayed in the following table:

Frame Rank
The frame rank is a value applied to the rank on every frame during a playthrough. Like rank, it is hidden from the player in the original arcade release, but displayed in the upper left-hand corner of the rank graph on the Battle Garegga Rev.2016 port. The frame rank is a singular value the game tracks and updates as needed. However, it can be useful to think of the frame rank as dependent upon two components:

Frame Rank = Base Value + Extras

Base Value
The base value depends on the highest autofire rate activated during the credit. Its default value is equal to 22 for the "normal" DIP switch setting on the Japanese arcade release and the "Arcade" mode of the Battle Garegga Rev.2016 port. Note that returning to a lower fire rate will not lower the frame rank to a previous value, so it is worth carefully considering when to increase the autofire rate.

Note: Because the frame rank is a small number, the total rank% change per second is included as well in the following table.

''*Note: 60 Hz autofire is only accessible through a glitch and will activate if you tap the shot button on the frame you respawn. In practice, this means you have a 50% chance of activating it if you hold down a 30 Hz external autofire button after dying. Miyamoto can trigger this glitch without needing to die by holding 30 Hz autofire after bombing.''

Extras
The extra additions are small values added to the current frame rank upon obtaining certain power ups. Levelling up the main shot with a small shot power up (including the special shot level up) increases the current frame rank by 1. Activating a secret option formation (except for wide formation, which does not affect frame rank) increases the current frame rank by 2. These values are added every time one of the conditions is fulfilled, even if you have already activated the power up or formation during the current playthrough. Losing the power up or option formation will not decrease the current frame rank by the value that was added.

Changing Autofire
When changing the autofire rate, the new frame rank will be:


 * the current frame rank, or
 * the new base value,

whichever is greater. This means that it is advantageous to change the autofire rate after powering up with small shot power ups or special option formations, since the extra additions will be "absorbed" into the new base value if changing to 12 Hz or higher autofire.

Main Shot
The value of the rank increment applied whenever firing the main shot depends on the number of bullet "clusters" in the shot level of the ship being used and whether the cluster is of non-penetrating or penetrating bullets. The increment at any individual shot level is unique for each ship. In addition, if the sprite limit for player shots on screen has been reached due to a high autofire rate, the rank increment for shots not fired will still be applied.

Note: Because the rank increment per shot is a small number for each ship and shot level, the rank% increase per second for each autofire rate is included in the tables below.

Option Shot
A rank increment is applied for every individual option bullet fired. The value of this increment is the same for all ships except for Gain and Miyamoto, whose option bullets have larger rank increments.

Items
The value added to the rank when collecting an item depends on the item, with two exceptions. The first exception is when collecting a shot power up, option, or weapon fragment at max capacity, which will increase the value added to rank. The second exception is when collecting a small shot power up or small weapon fragment that levels up the main shot or fills a weapon stock, which will also increase the rank added.

The total rank increase from collecting 40 small weapon fragments is also included in the table below for an easy comparison to collecting a single large weapon fragment.

Special Weapons
A rank increment is applied to the rank whenever activating the ship's special weapon. This value is applied regardless of whether a full bomb stock was used.

Sealing Bullets
A rank increment is applied for each individual bullet sealed. For the total rank increase, multiply this value by the number of bullets sealed for enemies that fire many bullets at once.

Dying
The rank increment upon death depends on the number of extra lives the player has on hand.

DIP Switches
Changing the DIP switch in the arcade version or in "Custom" mode of the Battle Garegga Rev.2016 port changes two things, the minimum rank and the base values that determine frame rank.

Because of the different minimum rank, the maximum in-game difficulty will change between settings even though the starting difficulty will remain the same. Even though the minimum rank changes, the rank% will still be calculated using the minimum rank of the "normal" DIP switch setting. As a result, the maximum possible rank% will change to a number greater or lower than 100.0% depending on the DIP switch setting.

Because of the different base values, the frame ranks encountered at different autofire rates will change accordingly.

Easy

Hard

Hardest

References & Contributors

 * ST: Battle Garegga, https://shmups.system11.org/viewtopic.php?f=5&t=351
 * 1) Battle Garegga Rank Percentages, https://docs.google.com/spreadsheets/d/1--_IPOmSNxo6ShxzS2Up_q-DNEo2wPCHbuQMyj9NIwE/edit#gid=0