Skip to content

PRESET Files

ブラッドウイング edited this page Jun 27, 2021 · 4 revisions

This file structure is only valid for BMG v1.x

This will be outdated on BMG's 2.0.0 release.

File's tree

* - deprecated options.

Tree in detail

This section will show every single parameter's meaning + usage.

🞜 presetOptions

Deprecated

This was a feature that was planned to be added but never ended up getting fully implemented.

This section was dedicated to the series of options that enhance the map generation design, fix a few blatant issues.

⬦ tileTransitionSize (integer)

Deprecated

There is a BMG bug, where neighboring tiles, which are meant to be connected, have a 1-pixel gap between them. This issue becomes more visible in smaller rendering sizes.

This has to do with the SVG format and the conversion between millimeters to pixels. It is not accurate and can usually cause some misalignments such as this.

Adding on to that issue, the fact that all SVG documents are scaled to fit a tile size of 1 px, makes some scenarios look very jarring.

The idea was to make BMG draw below and in between the two tiles by just repeating the pixel line. But it needed some rewriting, therefore it was canceled but still left as a valid option. There is a chance to see this working in BMG 2.x.


🞜 ignoreTiles[] (character[array])

BMG, when encounters a tile that it does not understand, will print it at the end of the whole generation process.

Example:

Unrecognized tiles encountered:
    "x": 62

If you want BMG not to register the tile as "unrecognized", you can just add the character to this array.

Useful for having invisible tiles, that are still there in the data, just not drawn.


🞜 tiles[] [array]

This is where every single SVG file gets its metadata.

This array not just defines each tile, but also defines the assets they use, the offset they should follow, how they interact with neighboring similar tiles, etc.

⬦ tileName (string)

The name of the tile.

This option is used as an "ID" for the tile, which is used in biomes[] and gamemodes[].

⬦ tileCode (character)

The character representing the tile.

Since the map is defined as an array of strings (which are collections of characters), each character can be associated with its own respective tile.

⬦ tileTypes[] [array]

Even though the character for the tile may be the same, this option allows the same tile to take on different shapes.

⬩ tileParts

This defines the offset used for the tiles.

Units used for tileParts are "thousands of a tile" (.001 tile). This means setting 1000 as the offset for left will move the tile rendering to the right by 1 tile.

Even though BMG reads all 5 keys (top, mid, bot, left, right), only the top and left are actually used.

The rest fell out of use after a lot of updates to the renderer.

⬩ color (string)

Deprecated

This was meant to be used for the web version of BMG, an extra way to name differently themed designs of the same tile.

But due to some issues in regard to performance, this idea was scrapped. This option can be found used for the forest tiles.

⬩ detailed (boolean)

Deprecated

This was a weird way to render different designs of the same tile depending on the resolution selected.

Also planned and scrapped for the web version of BMG.

⬩ visible (boolean)

Deprecated

The web version of BMG was meant to be used as a map builder, however not all tiles should be shown, some would rather be hidden. This was the option that allowed tiles to be invisible. Scrapped due to web version complications.

⬩ other (string)

Deprecated

This was meant to be used as the "extra notes" about a tile design, like a tooltip that would pop up when designing maps using the web version of BMG. But, as already mentioned, it was scrapped.

⬩ orderHor (integer)

In order to make some tiles draw on top of others that are in the same line, you can change the ordering with this option.

Think of it as a Z-axis. The higher the value is, the later the tile is drawn compared to the rest of the neighbors.

It is possible to use a negative value to make it forcefully be drawn first before everything else.

⬩ order (integer)

In order to make some tiles draw on top of everything else, you can use this setting.

It delays tile drawing till the last step. Incredibly useful for showing objectives and not letting them be blocked by the scenery.

It is possible to use a negative value to make it forcefully be drawn first before everything else.

⬩ tileTransitions (boolean)

Deprecated

This option allowed only select tiles use the tile transitions feature.

However it was never fully implemented, but the option was still kept. This option can be seen toggled on for forest tiles.

⬦ tileLinks

To make some tiles adapt to similar neighbors, the tileLinks feature comes to help.

With the usage of rules, you can change what tileType[] will BMG use to render.

⬩ rules[] [array]

The list of different conditions a tile can meet.

condition (string)

The condition of neighbors that the rule must meet before applying the changes connected to it.

The string consists of 8 characters, which can be either *, 0 or 1.

Character Meaning
* Any tile can be in that position
0 There must not be a tile of the same class in that position
1 There has to be a tile of the same class in that position

Each character represents its own neighboring position. The positions are ordered and encoded like this: (T - top, L - left, B - bottom, R - right)

TL  T   TR  L   R   BL  B   BR

So a condition like *0****1* means: "There can't be a similar tile above and there has to be a similar tile below"

requiredBiome (integer)

To make tileLinks work with different biomes, you use this option, which acts as an extra condition.

If any condition fails, the rule will not be applied.

changeBinary[] (string[array])

To compact some conditions, you can use this feature to convert the neighboring binary.

This is especially useful when the asset is set to ?binary?.svg and you want to compact some designs. Like let's say we have a ******0*, which we want to look the same for *****00*, ******00, and *****000 (basically, all conditions with the bottom center tile being different). We can compact by only checking ******0* and converting it into *****000.

Since this is an array, you can add as many changeBinary strings as you want.

The format of the string goes like this:

The new condition + "a" + index

So 0a7 would mean that BMG will replace the condition in the 7th index to be 0.

changeTileType (integer)

If defined, then BMG will change the tileType to match the one set here.

This can be helpful when a tile has its different neighbor-dependant configurations in its tileTypes. Like the fences in the Brawl Stars preset.

changeAsset (string)

Deprecated

This option was meant to be used instead of the changeTileType option, but it was scrapped for several reasons, mainly because of the addition of asset pre-loading.

changeFolder (string)

However, this is supported. Because BMG can work with folders inside of its preset assets folder. You can swap the folder that the asset comes from.

An example of this is using the ?binary?.svg as the asset for water tiles and having each water variant in its own folder.

⬩ multipleConditionsCouldApply [boolean]

By default, this is set to false.

When it's false, BMG will stop at the first rule that matches all conditions and run its connected instructions.

However, it is still possible to let BMG continue searching for more conditions that could match, just by turning this option to true.

⬩ defaults

When none of the conditions meet tileLinks will reference the defaults here.

The only fallback is the tileType.

The asset default is deprecated as mentioned in changeAsset.

⬩ edgeCase (enumeration)

There are several ways to handle the edge case scenarios.

For BMG the options are:

Enum Name Explanation
0 Different The edges will be treated as tiles of not the same class as the one checking its neighbors. Constant 0s.
1 Copies The edges will be treated as tiles of the same class as the one checking its neighbors. Constant 1s.
2 Mirror The edges will be extended. The edges take shape of the tile next to them horizontally and vertically.

Think of Different as:

0 0 0 0 0
0 + - - -
0 | 0 1 1
0 | 1 0 1

Copies as:

1 1 1 1 1
1 + - - -
1 | 0 1 1
1 | 1 0 1

And Mirror as:

0 0 0 1 1
0 + - - -
0 | 0 1 1
1 | 1 0 1

⬩ assetFolder (string)

An option to make BMG pull assets from a different folder for all tileLinks tiles.


🞜 biomes[] [array]

An array of every single biome supported for the preset.

A biome can have 2 different colors that are filled in a checkerboard fashion and tile type defaults, so the tile of the same class can look differently on different biomes.

⬦ name (string)

The name of the biome.

It's only used for preset readability and logging.

⬦ color1 (string)

One of the two background colors for the biome.

The two colors alternate creating a checkerboard.

The color encoded is in a string. RGB integer values separated by commas.

⬦ color2 (string)

Same as color1

⬦ defaults[] [array]

An array of objects that define every single different tile type and their type to be used for the biome.

Each object has 2 fields: tile and type.

The tile must be the string name of the tile, not the character representation.


🞜 defaultBiome

Similar to the biomes[] array, except it's a single one used as a base which is overridden by every biome.

The Brawl Stars preset, uses this option to define all the tiles which don't really change between biomes, like Teleporters and Benches, but is also used if the OPTIONS file uses a biome that's not defined in BMG, so it becomes an "invalid biome" with the magenta black checkerboard pattern as the background.


🞜 gamemodes[] [array]

This is where different game modes can be defined.

A game mode in BMG is more like an applied external edit on the map, which can add new tiles or change existing ones.

⬦ name (string)

Different to how biomes[] require an index in the OPTIONS file, game modes load by their name.

Therefore this option is not just for display purposes.

⬦ specialTiles[] [array]

Special Tiles are tiles added to the map without editing the actual map data.

They have parameters such as tile, type, position, and drawOrder.

The tile and type just define which asset to use.

⬩ position (string)

The position tells BMG where to draw the tile on the map.

You can use numbers as constant values or use relative anchors.

The position is encoded in the following format:

x location + "," + y location

0,0 would result in the tile being drawn on the 0,0 (top left corner) of the map.

To make it easier, there exist relative anchors for the X and Y locations.

X location anchors:

  • Left | L
  • Mid | M
  • Right | R

Y location anchors:

  • Top | T
  • Mid | M
  • Bottom | B

Anchors are case-insensitive.

So using m,m as the position would result in the tile being drawn in the center of the map.

⬩ drawOrder (integer)

Having a game mode tile, like an objective, being drawn on top of everything is really useful, but sometimes it looks better when it acts as part of the background.

There are 2 configurations for the draw order:

  • 1 - Draw before everything
  • 2 - Draw after everything

The Brawl Stars preset uses the 1 configuration for IKE and Basket brawl ranges and 2 for the rest.

⬦ overrideBiome[] [array]

If the maps share the same character for objectives and want the character to look different depending on the game mode, then this option comes into play.

With overrideBiome you can modify the biome settings because of a game mode. Like changing the spawns: instead of just being team-colored to having different designs.

The tile and type object array is in a similar format to the biome[]'s defaults[].

⬦ mapModder[] [array]

Though sometimes replacing a tile with a game mode tile in the actual map data is better. This is why game modes can modify the maps using this option.

The objects consist of 2 fields: tile and position.

The tile requires the actual tile name and not the character representation.

While the position encoding is similar to how specialTiles[]'s position field.