Finding Source Information: Difference between revisions
CptTwinkie (talk | contribs) mNo edit summary |
CptTwinkie (talk | contribs) mNo edit summary |
||
Line 1: | Line 1: | ||
{{SEO|description=A tutorial for finding game data stored in SBC definitions.}} | <noinclude>{{SEO|description=A tutorial for finding game data stored in SBC definitions.}}</noinclude> | ||
< | Most of the configuration information for Medieval Engineers can be easily looked up in the data folder. This can often seem like a daunting task because there is a lot of information, but it becomes quite easy with an understanding of how data is stored and what types you may need to look for.<noinclude> | ||
==What is game data== | ==What is game data== | ||
Line 190: | Line 190: | ||
{{ClearLine}} | {{ClearLine}} | ||
</noinclude> |
Latest revision as of 13:09, 16 October 2018
Most of the configuration information for Medieval Engineers can be easily looked up in the data folder. This can often seem like a daunting task because there is a lot of information, but it becomes quite easy with an understanding of how data is stored and what types you may need to look for.
What is game data
Before you can find the data you want, you have to understand how it is stored.
- SBC Files
- Most of the information or settings in Medieval Engineers is stored in XML based text files. These files are given the extension SBC which stands for Sandbox Configuration. This is because worlds in the VRage engine are internally referred to as sandboxes. Any file that is used to configure the sandbox is a sandbox configuration file.
- Definitions
- SBC's that configure default states for objects are referred to as definitions. When an object is added to the game world it is created using the definition, containing default settings. If the object is being loaded from a saved world, then the saved settings are applied on top of the definition by overwriting the default values. For the wiki, only the default settings (definition) are useful. All definitions should be sourced from the Data folder.
- ObjectBuilders
- Because SBC files are stored (serialized) as XML they must be read (deserialized) into memory to be used. This is accomplished by custom serializers called object builders. These object builders have only one job and that is to load matching definitions into objects that can be used by the game. There is a custom object builder for each type of definition. The game loads definitions by checking the definition's type and using the matching object builder to load it. Object builders use very strict naming guidelines:
MyObjectBuilder_{TypeName}Definition
You'll notice the Definition part at the end. This is important because there are often duplicate object builders that are used for serializing and deserializing data from save files. Those other object builders don't have Definition in the name.
The following terms will help you to identify definitions. You will probably use this knowledge when searching
- xsi:type
- Each definition has a xsi:type that matches its object builder. There are many definitions that use each xsi:type.
- Id
- Each definition has an Id that contains a Type and a Subtype.
- Type
- The Type of the definition is the deserialized object type. This is usually similar to the object builder type. There are many definitions that use each Type.
- Subtype
- The Subtype of the definition is the name of the particular object definition. There is one definition that uses each Subtype for any given Type.
- Multiple definitions
- If there are multiple definitions with identical object builders and Ids (Type and Subtype) then overwriting will occur. This is determined by load order which is undependable for game data. (It shouldn't happen but mistakes can be made). This process is how definition modding works - definitions are loaded from the game, then they are loaded from any mods. The mods add new definitions or overwrite existing ones.
- Definition merging
- It is possible to create a definition that modifies an existing definition. This process is called definition merging and can be identified by either a
Merge=""
attribute or aCopy=""
attribute in the Definition tag. The difference is that merge updates the existing definition but copy creates a separate copy first and then modifies the copy. Merge uses the original definition's Id. Copy uses a new Id and includes a CopyFrom tag that includes the Id information of the original definition.
How to find game data
To find the data you need, you must search the Data folder for definitions that match the appropriate object builder. The rest of this page will tell you how to find the Data folder, how to search all data files, and what object builders to search for.
Where to find game data
Game data is stored in \steamapps\common\MedievalEngineers\Content\Data
. The location of the steamapps folder is wherever you have installed Medieval Engineers. By default this is located in C:\Program Files (x86)\Steam\
. All SBC files in this folder and its children should be definitions where wiki information can be sourced.
Matching in-game objects to ObjectBuilders
The table below matches in-game objects to their relevant definition object builders.
Game Object | Object Builders |
---|---|
Block | MyObjectBuilder_CubeBlockDefinition |
Crafting block | MyObjectBuilder_CraftingComponentQueuedDefinition MyObjectBuilder_CraftingComponentAutonomousDefinition |
Crafting recipe | MyObjectBuilder_CraftingRecipeDefinition |
Block inventory | MyObjectBuilder_InventoryComponentDefinition MyObjectBuilder_VisualInventoryComponentDefinition |
Mechanical block types |
MyObjectBuilder_MechanicalSinkComponentDefinition |
Tool or weapon item | MyObjectBuilder_HandItemDefinition |
Seedbag item | MyObjectBuilder_SeedBagHandItemDefinition |
Inventory item | MyObjectBuilder_InventoryItemDefinition |
Tool |
MyObjectBuilder_BuilderToolBehaviorDefinition |
Weapon | MyObjectBuilder_MeleeWeaponBehaviorDefinition MyObjectBuilder_RangedWeaponBehaviorDefinition |
Ammunition | MyObjectBuilder_ProjectileItemDefinition MyObjectBuilder_ProjectileAmmoDefinition |
Shield | MyObjectBuilder_ShieldBehaviorDefinition |
Taxes | MyObjectBuilder_AreaUpkeepSystemDefinition |
Growable item | MyObjectBuilder_GrowableEnvironmentItemDefinition (Non-standard format) |
Farmable item | MyObjectBuilder_FarmableEnvironmentItemDefinition (Non-standard format) |
Planet generation | MyObjectBuilder_ProceduralWorldEnvironment |
Consumable item | MyObjectBuilder_ConsumableItemDefinition |
Character stat | MyObjectBuilder_EntityStatDefinition |
Effect |
MyObjectBuilder_CompositeEntityEffectDefinition |
Research |
MyObjectBuilder_ResearchTreeDefinition |
Schematic | MyObjectBuilder_SchematicItemDefinition |
Wonders |
MyObjectBuilder_WonderMarkerComponentDefinition |
How to search multiple files
In order to use the information above to find the definitions you are looking for you need to be able to search through the SBC files. There are a number of ways to accomplish this but it is strongly recommended to use a full-featured text editor. There are many text editors available so you can surely find one that suits but there are some very popular ones available for free. See the tutorials below for searching multiple files, also known as folder search.
Notepad++
- Download and install the app from the website or download the portable package and open it.
- Open the Find in Files dialog box by pressing Ctrl + Shift + F or selecting Search > Find in File... from the menu.
- Enter your search conditions. There are many options here but the ones you need are pretty straightforward:
- Find what
- Usually this will be where you search for the ObjectBuilder or the Subtype. It can also be useful to search by localization keys that are mostly located in Data\Localization\DataTexts.resx
- Replace with
- This can be ignored. It is not recommended that you use find and replace in data files. It is difficult for keen's own designers to use this without making mistakes.
- Filters
- Use
*.sbc
to search only for SBC files. - Directory
- This should be the path to your Data folder. By default this is
C:\Program Files (x86)\Steam\steamapps\common\MedievalEngineers\Content\Data
- In all sub-folders
- This should be checked so that all Data is searched.
- All other boxes can be left unchecked and Normal search mode should be used (unless you understand how the other options work).
- Click Find All to begin the search. Notepad++ will scan every SBC file in Data and display a list of all matches organized by file and then by line number within the file.
- Double-click results to open the file at the correct position.
Sublime Text
- Download and install the app or the portable version from the website and open it.
- Open the Find in Files dialog box by pressing Ctrl + Shift + F or selecting Find > Find in Files... from the menu.
- Enter your search conditions. There are option icons here on the left side but you can leave most of them off.
- Find
- Usually this will be where you search for the ObjectBuilder or the Subtype. It can also be useful to search by localization keys that are mostly located in Data\Localization\DataTexts.resx
- Where
- This should be the path to your Data folder. By default this is
C:\Program Files (x86)\Steam\steamapps\common\MedievalEngineers\Content\Data
- Replace with
- This can be ignored. It is not recommended that you use find and replace in data files. It is difficult for keen's own designers to use this without making mistakes.
- Use Buffer
- When selected will show the results in a separate tab (recommended). Otherwise search results are shown in a small box at the bottom of the window.
- Show Context
- When selected will show additional lines of code in your search results. This can be helpful but it makes the results list a lot longer.
- All other icons can be left unselected (unless you understand how the other options work).
- Click Find to begin the search. Sublime Text will scan every file in Data and display a list of all matches organized by file and then by line number within the file.
- Double-click results to open the file at the correct position.