Skip to main content

Module asset_variation_db

Module asset_variation_db 

Source
Expand description

Asset variation databases (warscape_asset_variation_db.bin): which environment file a battle uses.

The database has a list of categories (map, season, precipitation…) with their values, and per key (environment) a list of files with the flags of the category values each one allows. When a battle starts, the game picks one of the files whose flags allow the battle’s values.

§File Format

FASTBIN0, little endian, with str being a u16 size and that many bytes:

[8 bytes]  FASTBIN0 signature
[u16]      serialise_version (1)
[u32]      category count, then per category: u16 version (1), str name, u32 value count, str values
[u32]      entry count, then per entry: str key, u16 version (1), u32 variation count,
           and per variation: u16 version (1), str filename, u32 flags

The packs also have the database in XML form, next to the binary one, and the Assembly Kit has its source (environment_map.xml). See AssetVariationDb::to_xml, AssetVariationDb::from_xml and AssetVariationDb::from_environment_map.

§Selection

As the game does it:

  • Every value has a bit, counting through the values of all categories in order: 1 << (index & 31).
  • A query ORs the bit of the value chosen for each category. A value missing from the lists adds no bit.
  • A variation matches when its flags are 0, or when they have every bit of the query.
  • If nothing matches the battle’s map, the game queries again with the map default_map, and picks one of the matches at random.

Structs§

AssetVariationDb
An asset variation database.
Variation
A file the game may pick, with the values it allows.
VariationCategory
A category of the conditions of a battle, like season, with its values.
VariationEntry
The variations of a key, like environment.
VariationMatches
The variations of a key that match a query.

Constants§

PATH
Path of the database in the packs.
PATH_XML
Path of the XML form of the database in the packs.
SIGNATURE
FASTBIN0 file signature.

Type Aliases§

VariationQuery
A query: the value chosen for each category. Categories left out add no bit.