The Database

From Battletech Modding Wiki
Jump to: navigation, search

Schema

Database Schema.png

In the above the key is:

  • Green: Unique Key's
  • Blue: Relationship with another table.
  • Yellow: No relationship.

From what we can gather the Database is important largely to the Single Player and AI of the game.

A break down of the tables and their uses as we understand it is listed below

TagSetType

TagSetType consists of 2 fields

  • TagSetTypeID - This is the Primary Key it is an Integer
  • Name - This is a Text Field and contains the Name of the Tag Set Type

The Table is used to set up the Tag Set Types, existing in the Database Already are a total of 11 Tag Set Types they are:

TagSetTypeId Name
0 Undefined
1 Map
2 Encounter
3 Contract
4 LanceDef
5 UnitDef
6 PilotDef
7 RequirementDefRequirement
8 RequirementDefExclusion
9 BiomeRequiredMood
10 Mood

TagSet

TagSet holds all the TagSetID's from th various Definitions and sets up their relationship. As such it has 2 fields

  • TagSetID - UUID, Primary Key, This is a UUID created in one of the Definition files and stored here.
  • TagSetTypeID, - INT, this is the Tagset ID associated with the TagSetID.

Example:

TagSetID TagSetTypeID
f52c0bf4-1be3-456d-ad16-e9c344d00f6c 5

In this case this Tag Set is a unitdef.

Tag

Tag holds the Unique ID for various Tag's used by the game along with their more 'Normal' name

This table defines things that other items can be assigned to in TagSetTag

  • TagID - UUID,Primary Key this is a UUID that is used to uniquely identify this item.
  • Name - The Name as used by the game.

Example:

TagID Name
c6cc2cec-800f-46b7-9a65-a3447b0bf3e8 unit_mech

in this case the tagid is assigned to unit_mech. and identifys that anything with this tag assigned to it in TagSetTag is of that type.

TagSetTag

TagSetTag is a relationship Table, it is where you find TagSets assigned to each other it has 2 fields

  • TagSetID - This is a UUID value that is also defined in TagSet.
  • TagID - This is a UUID value that is defined from Tag

Together the two assign a TagSetID to various Tag's.. Such as Assigning a MechDefinition to various Groups so the AI and Game know what to do with it.

Example:

TagSetID TagID
d1da24d2-a7d0-40ee-a1c6-7a6e3fcbde32 85f97dfd-ae4c-4986-b17f-1d7fe9b0e7c1
d1da24d2-a7d0-40ee-a1c6-7a6e3fcbde32 493bef5a-3943-4798-8390-761a5b31d5c5
d1da24d2-a7d0-40ee-a1c6-7a6e3fcbde32 1f6729b9-2b4a-4ecc-8ac1-ec049e2e00bb
d1da24d2-a7d0-40ee-a1c6-7a6e3fcbde32 50f43aa8-17c4-465b-97eb-e1d1619cfdd7
d1da24d2-a7d0-40ee-a1c6-7a6e3fcbde32 6739bf20-1033-4d2b-9e5f-cb764b38dd39
d1da24d2-a7d0-40ee-a1c6-7a6e3fcbde32 ebc9e54d-8d38-4eab-8511-8fd873cfc0ab
d1da24d2-a7d0-40ee-a1c6-7a6e3fcbde32 b027550c-eac4-4391-b037-36bb038e24a3
d1da24d2-a7d0-40ee-a1c6-7a6e3fcbde32 1c95139e-a796-4c75-81ad-bafc95e6f69f
d1da24d2-a7d0-40ee-a1c6-7a6e3fcbde32 112f59cc-4037-4003-9225-c7a804b31b9a

Here we can see that the TagSetID d1da24d2-a7d0etcetcetc.. has been assigned the Tag's in TagID

PilotDef

PilotDef is a table that defines the Pilots in the Database, it contains a total of 4 fields

  • PilotDefId, Text, Primary Key, This is the Definition ID, it needs to match the one in the pilots.json file
  • FriendlyName, text, This is the pilots Friendly Name eg how it reads normally.
  • IconID, text not null, This is the Sprite Identifier for pilot.
  • TagSetID, UUID, FK, not null, This is the Unique ID that will match a value that exists in the TagSET table and will also be used in all other tables as a reference.

Example:

PilotDefID FriendlyName IconID TagSetID
pilot_kbeta_buckshot Buckshot Buckshot 771d2c68-d96e-4c76-8c01-6e5c1aa6e345

Here we can see Buckshotfrom the Beta, we can see the PilotDefId matches that in the .json file, the Friendly Name, SpriteID and the Unique ID for tagsets.

UnitDef

UnitDef is a table that defines the individual units in the Database, it consists of 6 fields

  • UnitDefID, Text, PrimaryKey, This is the Definition ID and needs to match the one in the .json files.
  • FriendlyName, Text, A Friendly name that you can id.
  • IconID, text, not used apparently.
  • UnitTypeID, Int, matches the Unit's type to the Unit Type table.
  • TagSetID, UUID FK, The UUID that will match a value that exists in the TagSet Table and will also be used to reference this entry in all other tables
  • Cost, Int, The Units Cost.

Example:

UnitDefID FriendlyName IconID UnitTypeID TagSetID Cost
mechdef_atlas_AS7-D Atlas 1 cc23b8c7-7da0-4176-b066-ee58aacd924b 11400000

Here we can see the Atlas, first we have the UnitDefID which matches it's .json file entry, it's friendly name Atlas, no icon, that it is unit type 1, it's Unique ID for the Tagsets and it's cost of 11,400,000 C-Bills.

UnitType

UnitType is the table that defines the unit types. It consists of 2 fields and currently the values shown in the example are the unit types.

  • UnitTypeID, INT, primary key the int that is used in UnitDef
  • Name, string, the name of a unit type.

Example:

UnitTypeID Name
0 UNDEFINED
1 Mech
2 Vehicle
4 Turret
8 Building

LanceDef

LanceDef is the table that defines Lance Types in the Database, it consists of 5 fields

  • LanceDefID , String, Primary Key, This is the Definition ID and needs to match the one in the .json files
  • Friendly Name, string, friendly name for knowing what the entry is
  • Difficulty, int, the Difficulty rating of the lance.
  • TagSetId, UUID FK, The UUID that will match a value that exists in the TagSet Table and will also be used to reference this entry in all other tables
  • Cost, Int, The units cost in c-bills

Example:

LanceDefID FriendlyName Difficulty TagSetID Cost
lancedef_arena_medium_assault Medium Assault 6 75bd53c2-8cbf-4aaa-91d4-b19b360417c5 19900000

Mood

Mood is the table that identifies the Moods it has 4 fields.

  • MoodID, Text, Primary Key, The ID value for the mood possibly used as a reference in .json etc files.
  • Name, text, seems to be a match of the moodid could also be the one used in the .json files.
  • FriendlyName, text friendly mood name.
  • TagSetID, The UUID that will match a value that exists in the TagSet Table and will also be used to reference this entry in all other tables

Example:

MoodID Name FriendlyName TagSetID
Baseline Baseline Baseline 40229e20-0b3c-4539-9c80-85ec908bee59
ClearDayDesert ClearDayDesert Clear Day Desert 121849bc-9cd3-44e2-be09-da0a535208a8
ClearNight ClearNight Clear Night 845c85c6-5964-46d3-b4a0-7a667f3e0567
ClearSunset ClearSunset Clear Sunset d8773f60-7bd7-4985-bc16-73911040fb6d

Wiki Quick Nav: File Formats | Other Tweaks and Adjustments | Tools and Scripts | Troubleshooting | Style Guide