This is not a direct question to the developer. I just want anyone’s opinion on this. I have always wondered how Candy Crush Saga has so many levels (300+) and their app size is only at 66.1 MB. Do you think that the game creates levels as it goes on, or do you think it has all of the levels pre made and load them into the app when they need it? Wouldn’t the second make the app size go up though?
It’s a match 3 game using a grid so you could represent a level as a binary mask of a few bytes, like a pixel picture and then some additional bytes for level specific elements. Or using a text format a small text file could represent the level.
So you are saying that they preloaded all of the levels since each level is not that big in size??
I don’t think so as they can load in the level file and then setup the level based on it’s information, e.g. load in the textures and sound fx for that level.
Are you asking if each level was pre-made and included in the downloaded app? Yes they did. Given the type of game Candy Crush is 66mb is quite generous. The sprites used in the levels are identical and no doubt stored in a single texture atlas. The levels themselves, as Arowx suggested, are likely just an array denoting which cells of the grid have what type they are (blocked, empty, candy, cream, chocolate, etc.) and probably are only a few hundred bytes each tops. Even a very conservative estimate of each level being 1kb with 500 levels makes it like 500kb for the actual level data, most of the filesize is no doubt taken up by the textures for the massive background on the level select screen.
Seems to me that each time I play the same level a different configuration of the grid appears. If the levels were pre-made, they created a lot of different configuration for each level. I think instead that the levels are randomly generated. I wonder if the new candies coming from the top follow some pattern, adapting to the configuration in the grid and calibrating the difficulty of the level.
Just how many “items” can be in a given position on the grid. If it is less than 256, they can use a single byte value for each position, plus a few bytes of values describing the objectives of the level, including what type it is, how much(as in time, or candies of given types, etc…), and maybe a couple more bytes for things like difficulty modifiers. The grid starts out different each level, but to represent that you only need a single value out of the 255 available because you can decide when loading which candy type it will be.
So yeah, a single KB is very generous for a single level. In fact, if they optimized properly, they could fit that data in like 5KB. On the other hand, as stated above, unless they used real-time vector graphics, that level select screen is probably bigger than everything else in the game, including music!
1024 (1 K) - 32x32 bytes. Assuming they compress it or only use 6 bits or something, it could be even smaller.
Sound is probably a lot of that payload.