Skip to content

Capacity String

The Capacity String (commonly known as the extra string) is a long string split up into 54 components each having an Integer assigned to them. The role of the Capacity String is to save the cost of memory re-allocation when rendering levels

Example

Below is the Capacity String for the level Bloodlust by Knobbelboy

0_2044_1248_57_0_70_1988_963_0_0_4526_6982_465_0_623_995_0_0_0_0_0_0_53_0_0_0_0_0_0_0_0_0_35_105_38_0_0_0_0_0_0_0_0_0_294_1173_38_0_0_0_0_0_0_0_0

Structure

Each component of the Capacity String are tied to their own CCSpriteBatchNode field based on the properties of certain objects.

There are 5 different types of batchNodes. 4 of which the Capacity string uses

Note: BatchID 4 isn’t used in the Capacity String

BatchIDTypeDescription
1BatchNodePlayer
2BatchNodeTextAll text GameObjects
3EffectBatchNodeAll animated GameObjects
4DefaultBatchNodeAll GameObjects that don’t fit into other BatchNodes, usually objects that only render in the editor exclusively
5BatchNodeMost GameObjects

Each of these BatchNodeTypes are then divided into sub-categories based on certain properties the object has

Note: Index refers to order that the BatchNode can be found on the capacity string
The names for each BatchNode were provided by RobTop himself

IndexBatchNodePropertieszOrder
0BatchNodeAddTop2Blending, zLayer T216
1BatchNodezLayer T110
2BatchNodeAddBlending, zLayer T19
3BatchNodePlayerunknown -> something about the player3
4BatchNodeAddPlayerunknown -> something about the player2
5BatchNodeAddMidBlending, zLayer B1 (zLayer = 4)1
6BatchNodeBottomzLayer B1-1
7BatchNodeAddBottomBlending, zLayer B1-2
8EffectBatchNodeAnimated, zLayer B1-6
9EffectBatchNodeAddBlending, Animated, zLayer B1-7
10BatchNodeBottom2zLayer B2-8
11BatchNodeAddBottom2Blending, zLayer B2-9
12BatchNodeAddGlowBlending, Glow, zLayer T19
13BatchNodeAddBottomGlowBlending, Glow, zLayer B1-2
14BatchNodeAddBottom2GlowBlending, Glow, zLayer B2-9
15BatchNodeBottomGlow2Glow, zLayer B1-22
16BatchNodeAddBottom4Blending, zLayer B4-23
17BatchNodeAddBottom4GlowBlending, Glow, zLayer B4-23
18BatchNodeBottom3zLayer B3-15
19BatchNodeAddBottom3Blending, zLayer B3-16
20BatchNodeAddBottom3GlowBlending, Glow, zLayer B3-16
21BatchNodeTop2zLayer T217
22BatchNodeAddGlowTop2Blending, Glow, zLayer T216
23BatchNodeTop3zLayer T325
24BatchNodeAddTop3Blending, zLayer T324
25BatchNodeAddGlowTop3Blending, Glow zLayer T324
26BatchNodeAddTop4Blending, zLayer T426
27EffectBatchNodeTop3Animated, zLayer T319
28EffectBatchNodeAddTop3Animated, Blending, zLayer T318
29EffectBatchNodeTop2Animated, zLayer T212
30EffectBatchNodeAddTop2Animated, Blending, zLayer T211
31EffectBatchNodeTop1Animated, zLayer T15
32EffectBatchNodeAddTop1Animated, Blending, zLayer T14
33EffectBatchNodeBot2Animated, zLayer B2-13
34EffectBatchNodeAddBot2Animated, Blending, zLayer B2-14
35EffectBatchNodeBot3Animated, zLayer B3-20
36EffectBatchNodeAddBot3Animated, Blending, zLayer B3-21
37EffectBatchNodeBot4Animated, zLayer B4-27
38EffectBatchNodeAddBot4Animated, Blending, zLayer B4-28
39BatchNodeTextTop3Text, zLayer T321
40BatchNodeTextAddTop3Text, Blending, zLayer T322
41BatchNodeTextTop2Text, zLayer T213
42BatchNodeTextAddTop2Text, Blending, zLayer T214
43BatchNodeTextTop1Text, zLayer T16
44BatchNodeTextAddTop1Text, Blending, zLayer T17
45BatchNodeTextText, zLayer B1-5
46BatchNodeAddTextText, Blending, zLayer B1-4
47BatchNodeTextBot2Text, zLayer B2-12
48BatchNodeAddTextBot2Text, Blending, zLayer B2-11
49BatchNodeTextBot3Text, zLayer B3-19
50BatchNodeAddTextBot3Text, Blending, zLayer B3-18
51BatchNodeTextBot4Text, zLayer B4-26
52BatchNodeAddTextBot5Text, Blending, zLayer B4-25
53EffectBatchNodeAddTop4Animated, Blending, zLayer T420

Legacy String

There are other types of Capacity Strings from older versions of the game. The total number of Nodes is used to identify them

UpdateNode count
1.94
2.016

The capacity string in 2.0 is quite easy to understand as it only contains the first 16 batch nodes in 2.1’s capacity string. 1.9 is quite different with certain indexes containing multiple batch nodes.

Below is a table for 1.9’s Capacity String.
Refer to the Structure section for the properties of the batchNodes

IndexBatchNode(s)
0BatchNode
1BatchNodeAdd
BatchNodeAddGlow
2BatchNodeBottom
BatchNodeBottom2
3BatchNodeAddBottom
BatchNodeAddBottom2
BatchNodeAddBottomGlow
BatchNodeAddBottom2Glow

High Capacity Mode

In the game options, there is a option the player can toggle called High Capacity Mode. when enabled, the Capacity for each BatchNode is set to a hardcoded value. There are 3 capacity sizes

sizeBatch Type
999BatchNode
200EffectBatchNode
100BatchNodeText

If enabled, the Capacity string is disregarded and these values are used instead.

Capacity String Generation

The Capacity String is only generated during verification of the level. When playing the level, the game stores the the highest number of GameObjects that the Batch is responsible for inside its textureAtlas as the capacity. After the level is verified, the following function is called

// This is only a re-creation of the function used and is not an accurate decompilation
// we have refactored the code to make it easier to understand
int capacity = BatchNode->getAtlasCapacity();
if(capacity <= 29)
return 0;
// Increasing the capacity by a small amount to ensure there is enough memory
int newCapacity = capacity * 1.1f;
// returning the new capacity with a limit of 9999
return std::min(newCapacty, 9999);

After the capacity is calculated, it adds the value to the capacity string. Once the entire string is finished, it is then stored in GJGameLevel->CapacityString_ where it will then be sent to the servers during the upload