TOTAL WAR WIKI

Total War: ATTILA BoB

Rules

Definition

Rules are used for defining non-default behaviour for processors on particular subsets of files.

A rule is a set of properties. Property names are strings, property values are numbers or strings.

One rule is associated with one or more processors and one or more files.

Storing

Rules are stored in files named 'rules.bob'. Any data directory can contain a rules file. By default, the rules in a rules file apply for every file in its directory and all the subdirectories but the scope of the rule can be limited by using file filters.

File format

Basic

[Building]

Type = windmill

Material = wood

HitPoints = 30

[Audio]

Compression = mp3

File filters

[Building]

<Files> = wood_windmill_*

Type = windmill

Material = wood

HitPoints = 30

[Building]

<Files> = stone_windmill_*

Type = windmill

Material = stone

HitPoints = 30

[Building]

<Files> = .../*_wind_mill_*, -special_windmills/...

Type = windmill

Material = stone

HitPoints = 30

  • means any character except '/'

... means any character including '/', so this will apply to files in subdirectories too

- in front of a filename means exclusion. Any file matching that pattern will not get this rule

The first rule will be applied for every file matching 'wood_windmill_*', the second one for 'stone_windmill_*', the third one for all files matching '*_wind_mill_*' recursively except for the ones in the special_windmills directory.

Overriding

By default, a rule overrides any other rules specified before (in the same file or in any parent directory) if they apply for the same file. If there is a rule with the same filter in a directory and also in one of its subdirectories then the second rule will be applied for the files in that particular subdirectory and the first one for all the others.

In one rules file:

[Building]

Type = house

Material = stone

HitPoints = 15

[Building]

<Files> = stone_windmill_*

Type = windmill

Material = stone

HitPoints = 30

For files called 'stone_windmill_*', the second rule will be applied. For all the others, the first one.

Inheritance

[Building]

<Files> = *house*

Type = house

HitPoints = 15

[Building]

<Files> = *windmill*

Type = windmill

HitPoints = 30

[+Buildings]

<Files> = *wood*

Material = wood

 

[+Buildings]

<Files> = *stone*

Material = stone

The second two rules doesn't override properties that are not specified in them. For a file called *wood_house* the applied properties will be Type = house, HitPoints = 15, Material = wood. This kind of inheritance works between files at different levels of the directory hierarchy as well.

If you don't want to inherit every property but just some of them, use this syntax:

[ProcName]

Property1 = value1

Property2 = value2

[ProcName]

<Files> = *qqq*

Property1 = +

In this case, Property1 will be inherited but not Property2.

There is an opposite of this syntax:

[ProcName]

Property1 = value1

Property2 = value2

[+ProcName]

<Files> = *qqq*

Property1 = -

Every property will be inherited except Property1.

Finding the rule

When BOB needs the rule for a particular file then it finds it this way:

  1. Is there a rules file in the directory of the processed file?
  2. If yes, then is there a rule applies to this file (considering file filtering as well)?
  3. If yes, then use this rule (considering inheritance the same way as we are looking for the first matching rule)
  4. In any other case, go up one directory and jump to step 1.
  5. or if it's the root directory then stop searching and the processor is running with default values

Editing rules

Option #1 - Manually

Edit rule files manually from a text editor.

 

Option #2 - Built-in editor

It's a more efficient and safer way of editing rules.

It helps the user to easily

  • find the matching rule for particular files
  • check out the inherited property values
  • change the scope of a rule (without having to worry about moving the rule around the directory hierarchy)
  • be aware of the useable properties with some help as well

 

Press the "Rule editor" button on the data selection dialog to bring up rule editor. See right-click context menu for available operations (add new rule, cut, copy, paste, delete, undo).

In the data selection trees you can view the rules for a particular file (right click -> View rules). The origin of each property is also displayed. You can jump to any of those rules and edit by double clicking.