Plants vs. Zombies 2 Hacking Guide/OBB structure (archived)

In Plants vs. Zombies 2, an **OBB** (**Opaque Binary Blob**) or **RSB** file is an archive file containing the assets and configuration settings that are used in game. These include textures, animations, level and world data, plant and zombie properties, text, and more.

This page serves as reference material, detailing the location and directory structure of the OBB/RSB, as well as providing descriptions of the custom file formats found within it. It does not go over how to extract or repack an OBB/RSB or how to decode the custom file formats. For this, try surveying the tools found at Plants vs. Zombies 2 Hacking Tools.

## Locating the OBB/RSB

### International, Android

After installing Plants vs. Zombies 2 from the Play Store, you can find an OBB by navigating to `/sdcard/Android/obb/com.ea.game.pvz2_**<na/row>**/` on the Android device's file system.

A number of OBBs are also listed and available for download at the Plants vs. Zombies 2 OBBs page.

### Chinese, Android

While reading an APK file of the game as a ZIP file, the RSBs will be located in `./assets/` as RSB.SMF files—there is no central RSB. The assets in these files are also lower quality than those found in the iOS's RSB.

### Chinese, iOS

While reading an IPA file of the game as a ZIP file, the RSB will be located at `./Payload/PvZ2.app/main.rsb`.

## Extraction

A number of tools have been created for the purpose of extracting all the contents of an OBB/RSB ("unpacking" the OBB/RSB). These include:

* Taiji
* PyVZ2
* PvZ2Tool
* QuickBMS *(will extract directories in the wrong order, and cannot extract `**files starting with the same path**` correctly)*

*Some tools may name the extracted files using different casing.*

### Internal directory structure

The following is a list of especially notable directories/files in the internal directory structure of an extracted Android international OBB. OBBs/RSBs from other locations will have a similar but not identical structure. Because not all included files/directories are listed here, it may be helpful to look at some of those other files to find what you need.

* `./` - The root directory of the extraction.
	+ `**atlases/**` - Contains the texture atlases (spritesheets/textures) used in the game, as PTX files.
	+ `**effects/**` - Contains color filters (likely?) appled to images and sprites in the game, as POPFX files.
	+ `**images/**` - Contains the animations used in the game, as PAM files.
	+ `**packages/**` - Contains properties and configuration of levels, zombies, plants, etc., as RTON files.
		- `**HotUI/**` - Contains settings for UI elements.
		- `**levels/**` - Contains settings and properties for the levels in the game, including campaign levels, Arena and Penny's Pursuit levels, piñata parties, minigame levels, danger room levels, etc. (ARCADE = VASEBREAKER / CHALLENGE\_LEVELS: includs epic quest / RIFTS = Penny's Pursuit)
		- `**worlds/**` - Contains settings that specify the layout of world maps and the levels accessible from them, for both the campaign and Penny's Pursuit.
		- `**Allowed\_Universal\_Links.rton**` - A file which specifies which universal link links to which deeplink.
		- `**Arcade\_Config.rton**` - A file which specifies the rewards and levels from mini games (vasebreaker, eggbreaker, firebreaker, wasabiwhip and beghouled)
		- `**LawnStrings-******-******.rton**` - Several files specifying the text used in game, like dialogue, almanac descriptions, and item names. The files themselves are separated by language.
		- `**PlantLevels.rton**` - A file specifying how plant properties change as plants level up, such as sun cost, seed packet cooldown, attack DPS, etc., and the requirements (cost, seed packets) for leveling them up.
		- `**PlantTypes.rton**` - A file specifying plant "types", and properties such as the textures, audio, animation file, almanac backdrop, and property set from `PLANTPROPERTIES.RTON` that they will use.
		- `**PlantProperties.rton**` - A file specifying general properties about plant types, ranging from base sun cost, base hitpoints, base seed packet cooldown, and base plant food duration to whether it can be planted on water or whether the player can use Wall-Nut First Aid on it.
		- `**ZombieTypes.rton**` - A file specifying zombie "types", and properties such as the textures, audio, animation file, home world, and property set from `ZOMBIEPROPERTIES.RTON` that they will use. Different zombie types may represent the same zombie, but for different situations (e.g. a zombot in a campaign level, a zombot from the extended campaign, a zombot in Penny's Pursuit, and a zombot in Arena use different types).
		- `**ZombieProperties.rton**` - A file specifying general properties about zombie types, ranging from base speed, base attack DPS, and hitbox size to whether it can spawn plant food or be flicked using Power Flick.
	+ `**primefonts/**` - Contains the fonts used in the game, as TTF files.
	+ `**properties/**` - Contains the credits, `RESOURCES.RTON`, and other files.
		- `**resources.rton**` - A file that provides information about the widths and heights of the atlases, how to crop and name sprites from the atlases, and the "resource groups" the sprites belong to.
	+ `**soundbanks/**` - Contains soundbanks used in the game, as BNK files.
	+ `**streamingwaves/**` - Contains other audio files used in the game, as WEM files.

### CDN mirror files

Some files in the OBB's packages folder, such as piñata party RTONs and LawnStrings RTONs, have counterparts that are downloaded from the game's server after the game has been updated. On Android international, these files will be downloaded to `/sdcard/Android/data/com.ea.game.pvz2_**<na/row>**/files/No_Backup/CDN.**#**.**#**/` with a directory structure similar to that of the packages folder.

After these files are downloaded, the game will first try to use these files instead of the versions in the OBB. This means that, if changes were made to files with CDN counterparts in the OBB, they may not appear in-game, because they are being superseded by their CDN counterparts.

To get around this, someone with a modified OBB could try disabling the internet connection before the CDN files can be downloaded as the game is starting up. If the CDN files are already present, however, one can simply replace them with the modified versions. The game will not attempt to redownload CDN files that are already present, so the modified files will not be changed.

Only packages files which have downloaded CDN counterparts and CDN counterparts for files in the packages`/levels` folder will be read out from the CDN folder. This means that an RTON from the OBB which does not have a downloaded CDN counterpart will not be read from the CDN folder, unless it is from packages`/levels` and placed in the corresponding subdirectory in the CDN folder.

## Asset file formats

Most assets from an OBB/RSB use proprietary file formats/extensions. These include:

 PTX

 iOS
 PAM
 BNK
 WEM
 POPFX

## Links

* https://plantsvszombies.fandom.com/wiki/User\_blog:1Zulu/Inner\_workings
* http://wiki.xentax.com/index.php/Wwise\_SoundBank\_(\*.bnk)
* https://plantsvszombies.fandom.com/wiki/User\_blog:1Zulu/RTON\_Format