Finding Source Information: Difference between revisions

From Medieval Engineers Wiki
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 142: Line 142:


==How to search multiple files==
==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++===
===Notepad++===
{{Thumbnail|sourcing-npp-blank.jpg|Find in Files Window}}
{{Thumbnail|sourcing-npp-filled.jpg|Filled Boxes}}
{{Thumbnail|sourcing-npp-results.jpg|Search Results}}
Install (link) or portable (link?)
Open
Ctrl + Shift + F or Search > Find in File...
;Find what: Usually this will be the ObjectBuilder or the Subtype. It can also be useful to search by localization keys that are usually 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 <code>*.sbc</code> to only search SBC files.
;Directory: This should be the path to your Data folder. By default this is <code>C:\Program Files (x86)\Steam\steamapps\common\MedievalEngineers\Content\Data</code>
;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 Final 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.
===Sublime Text===
===Sublime Text===

Revision as of 15:26, 10 October 2018

This article is a draft. You can help Medieval Engineers Wiki by completing it. Click to edit this page


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 a Copy="" 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
MyObjectBuilder_MechanicalSwitchComponentDefinition
MyObjectBuilder_MechanicalTransmissionComponentDefinition
MyObjectBuilder_BlockWindmillComponentDefinition

Tool or weapon item MyObjectBuilder_HandItemDefinition
Seedbag item MyObjectBuilder_SeedBagHandItemDefinition
Inventory item MyObjectBuilder_InventoryItemDefinition
Tool

MyObjectBuilder_BuilderToolBehaviorDefinition
MyObjectBuilder_MinerToolBehaviorDefinition
MyObjectBuilder_PlowingToolBehaviorDefinition
MyObjectBuilder_DiggerToolBehaviorDefinition
MyObjectBuilder_RopeToolBehaviorDefinition
MyObjectBuilder_SeedingToolBehaviorDefinition
MyObjectBuilder_TreasureMapToolBehaviorDefinition
MyObjectBuilder_EntityPlacerBehaviorDefinition

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
MyObjectBuilder_MovementSpeedEffectDefinition
MyObjectBuilder_ExponentialStatEffectDefinition
MyObjectBuilder_AnimationEffectDefinition
MyObjectBuilder_FOVEffectDefinition
MyObjectBuilder_EquipmentItemEffectDefinition
MyObjectBuilder_ToolEfficiencyEffectDefinition
MyObjectBuilder_HealthEffectDefinition
MyObjectBuilder_StaminaEffectDefinition
MyObjectBuilder_HungerEffectDefinition
MyObjectBuilder_VigorEffectDefinition
MyObjectBuilder_StatEffectAffectorEffectDefinition
MyObjectBuilder_EntityStatEffectDefinition
MyObjectBuilder_EntityEffectDefinition
MyObjectBuilder_OperationTriggerEffectDefinition
MyObjectBuilder_PreventionEffectDefinition
MyObjectBuilder_RangedWeaponModifierEffectDefinition
MyObjectBuilder_DamageOverTimeEffectDefinition
MyObjectBuilder_ScaledToolEfficiencyEffectDefinition
MyObjectBuilder_ScaledAudioEffectDefinition
MyObjectBuilder_ScaledFOVEffectDefinition

Research

MyObjectBuilder_ResearchTreeDefinition
MyObjectBuilder_ResearchNodeDefinition
MyObjectBuilder_QuestDefinition
ResearchDefinition (Non-standard)

Schematic MyObjectBuilder_SchematicItemDefinition
Wonders

MyObjectBuilder_WonderMarkerComponentDefinition
MyObjectBuilder_WondersDefinition


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++

Find in Files Window
Filled Boxes
Search Results

Install (link) or portable (link?) Open Ctrl + Shift + F or Search > Find in File...

Find what
Usually this will be the ObjectBuilder or the Subtype. It can also be useful to search by localization keys that are usually 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 only search 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 Final 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.

Sublime Text