Master of Orion

Master of Orion

47 ratings
Modding Basics
By Spud Dastardly
This guide will help you get started making some basic mods to the game using yaml files.
   
Award
Favorite
Favorited
Unfavorite
Getting Started
To begin, you will need to install Notepad ++[notepad-plus-plus.org], a free editing program that recognizes the yaml format.

You will also need to familiarize yourself some relevant file directories. Open your steam library, right click Master of Orion, and under Manage click Browse Local Files. This will open the folder on your computer where Master of Orion's game data is stored. You may want to create a shortcut to this folder so you can quickly access it later.

Open the Modding folder. This folder contains all of the game's yaml files, which contain all of the settings you can edit. Most of your modding work will be done with these files.

Another useful folder that you can access from the main Master of Orion folder is MasterOfOrion_Data\StreamingAssets\Localization\Backend. These contain several .csv files which contain the names of things in the game. For example, if you wanted to change the name of a technology or a racial perk in the game, this is where you would go for that file. These files can also be edited in Notepad ++.

Also, if you go to MasterOfOrion_Data\StreamingAssets\assets, you can browse through the subfolders here to see all of the thumbnails in the game. If you want to create a new tech, building, weapon, etc., you'll need to choose a thumbnail from within this directory.

In order for your mods to be loaded into the game, you need to create a new folder in Documents\Master of Orion\Mods. Copy any .yaml and .csv files you wish to change to your new folder in the Mods folder, and then they will be automatically loaded into the game. Such a mod will show up in the Mods menu in game as a "Local" mod as shown below.


In order to upload your mod to the steam workshop, you'll need to enable to mod uploader from the options menu in game. Open the Options menu in game, click on the Content tab, and check the Mod Upload Tool box:

Now when you select a local mod in the Mods menu, you should have the option to upload the mod. In order for the game to allow you to upload your mod, you will have to put a thumbnail icon in the folder you created for your mod. The thumbnail should have the name "thumb.png". I recommend a square image with a resolution of at least 400 x 400 for your thumbnail.

You can update your mod through the mod screen in game, but you will have to be subscribed to your mod in the workshop before you will be given the option to update it using your local mod. Warning: Updating your mod will overwrite the description of your mod in the workshop with the one you input in game. Because you can't copy/paste text into the in game description field, the best thing is to copy your text on steam, update your mod, then on steam edit the description and paste your description again, or alternatively open the edit description page for your mod on Steam, upload your mod (with the edit page still open), then save the description on the edit page to immediately replace the description.

Some tips before we move on:
  • In order for any changes to work properly, you must match the formatting of the existing yaml exactly. Use the formatting already present as your guide. One important note on formatting: you will notice that all of the settings in the yaml are indented to the right. When adding new lines, you must use spaces to create that indent, not the "Tab" key, or else the mod will not load properly.

  • When trying to find things in files quickly, Ctrl+F is your best friend. Use it often.

  • When looking through the game's files, you might find lines that are greyed out beginning with a # sign. This means they are "commented out" and have no effect on the code. You can add these in yourself to code you want to maybe use later but not use now. You can select several lines at once and right click the selection to "block comment" or "block uncomment."

  • Make sure to save and test the changes you have made often. Nothing is more frustrating then spending an hour making extensive changes to a couple yamls, then testing it out and finding it breaks the game and you have no idea why!

  • When you upload a file to the steam workshop in game, it only gives you a limited amount of space for adding a description. Just put in a place holder description, and edit the mod information in the Steam workshop directly. Unlike with the in game description, editing your description in the steam workshop allows for headers, bullet point lists, and things like that. Click here for help with text formatting in Steam.

  • When a mod is loaded into the game, first the game's original yaml files are loaded, then each mod is loaded in sequence starting from the top mod in the mods menu. When testing your mod, you should make sure all other mods are disabled so that they don't interfere with your mod. Some mods that affect the same yaml files may be compatible, but they may have to be loaded in a particular order. You can change the order in which the mods are loaded on the mods menu.

  • It's not necessary to include the entire yaml file that you're modifying in your mod. Because the game's files are loaded first, it suffices to only include the sections of the yaml that you are modifying. Slimming your mod down in this way will make it more likely to be compatible with other mods that modify the same yamls because it won't erase the changes made by other mods by loading the default settings on top of them.

    Deleting certain sections of yamls might mess up how the game loads the yaml however, so you should test any time you delete a section of a yaml to make sure the game still loads it properly. In general, if you are changing a setting that is part of a "- key:" parameter, you should include all settings pertaining to that key, but you need not include other keys in your yaml that you are not changing. Similarly for .csv files, you need only include the lines that your mod uses.

  • Using .csv files to specify the names of things isn't strictly necessary, as you can just put the name in quotes directly in the yaml file, but using .csv files allows for the name to display in other languages as well. Even if you don't know the proper translation for the thing you're creating, using a .csv allows for others to easily translate your mod into their language.
yaml Contents
There are many different yaml files for you to explore. A lot of them control basic stuff on the backend of the game such as when the AI is supposed to greet you in a friendly vs a hostile manner, how the global population growth speeds are defined, how the tutorial goes, etc. I will highlight a few useful yaml files that may interest you, and you can explore the rest as you get used to editing these files.
  • ColonyStructureTypes.yaml: Defines the cost, upkeep, and properties of each building including the space factory buildings.

  • EspionageMissions.yaml: Defines the mission length, risk factor, and effects of the various espionage missions

  • Globals.yaml: This one is very useful and contains a wide variety of things, such as how strongly the AI reacts to diplomatic actions, how often anomalies and pirates spawn, how many points you get for making a custom race, how fast spies travel, how long spies take to train, the max number of spies you can have, how much jump gates boost your travel speed, how your score is calculated, how expensive and beneficial research and trade treaties are, how much upgrading ships cost, how big the tactical battlefield is, and more.

  • Miniaturizations.yaml: Defines the weapon miniaturizations. Used in the example in the later section.

  • RaceTypes.yaml: Defines which race traits each race has, their general AI behavior, and their default disposition toward each other race.

  • RacialPerks.yaml: Defines what each race perk does, how much it costs in custom race points, and whether it appears on the custom race screen.

  • TechApps.yaml Defines what each technology unlocks. E.g. it defines that researching Battlestation unlocks the structure: battlestation.

  • TechTree.yaml: Defines the layout of the tech tree and which technologies come with each node.

  • ShipBlueprintTemplates.yaml: Defines the default designs for each ship including how each race designs their ships. You can redesign star bases, military outposts, etc here.

  • ShipHullTypes.yaml: Defines the base cost, space, hp, combat speed, weapon/special slots, etc of each ship (including fighters, defensive structures, monsters, and noncombat ships). Also controls things like whether you can mass produce that ship or whether the doomstar is empire unique.

  • ShipModules.yaml Defines the size, cost, and parameters of each ship module.

  • Weapontypes: Defines the parameters of each weapon system (damage, accuracy, range, etc.)

There are many yamls I didn't cover here! If you're looking for a particular thing you want to mod, try finding a yaml with a seemingly relevant name, and see if editing it points you to the right parameters.

A couple useful .csv files to keep in mind in the Backend folder:
  • RacialTraits.csv: contains the names of each race trait and each category of traits. Use this if you plan on changing the custom race screen.

  • Technology.csv: contains the name of each technology. Use this if you plan on editing the tech tree or adding new technologies.

  • Backend.csv: Contains a variety of names and messages such as the name of the guardian, monsters, what it says when you destroy a pirate base, the names of options on the diplomacy screen, the default names of ships, the names of technology categories, and much more

Windows can search through the csv files to find a particular name you want to change. For example, if I wanted to change the Meklar race to be called the Borg instead, I could find the reference for their name in racetypes.yaml, then do a search in the Backend folder for race_type_meklar. In order for windows to find the name, you need to change the advanced search options so it searches the file contents. This would point me toward Races.csv. Otherwise you can explore the various csv files to find what you want to change.

When trying to find a particular trait or name in a file, remember: Ctrl+F is your best friend!
A simple example
We begin with a basic example. Let's say you want to change the Mrrshan race traits so that they have +50% beam attack in addition to their other traits. We open the RaceTypes.yaml file. Hit Ctrl+F and type Mrrshan, and hit Find Next until you find their race traits. Scroll down to the racialperks section, which looks like this:
racialPerks: - racialPerk: perk_militarist level: 1 - racialPerk: perk_plains_dweller level: 1 - racialPerk: perk_warlord level: 1 - racialPerk: perk_diplomacy_high_acceptance level: 2
We want to define a new perk giving them ship attack, but first we need to look up the name of that trait. Open RacialTraits.yaml, and do a search for ship_attack or just "attack" until you find the trait. You will see this:
- key: perk_ship_attack category: PERK_CATEGORY_SHIP_ATTACK valueType: float displayOrder: 0 levels: - value: 0 - displayName: SHIP_ATTACK_LOW_NAME description: SHIP_ATTACK_LOW_DESCRIPTION value: -0.25 score: -1 displayIcon: assets/racial_traits/ship_attack_low.png - displayName: SHIP_ATTACK_HIGH_NAME description: SHIP_ATTACK_HIGH_DESCRIPTION value: 0.25 score: 2 displayIcon: assets/racial_traits/ship_attack_high.png - displayName: SHIP_ATTACK_MAXIMUM_NAME description: SHIP_ATTACK_MAXIMUM_DESCRIPTION value: 0.5 score: 4 displayIcon: assets/racial_traits/ship_attack_maximum.png exclusions: - perk_natural_pilots
There are three "levels" of the trait. Level 1 gives you -25% ship attack, level 2 gives you +25% ship attack, and level 3 gives you +50% ship attack. So we want to give them ship attack level 3, and the name of the key that we use is perk_ship_attack. Matching the format of the other traits in the RaceTypes.yaml, we add the new perk:
racialPerks: - racialPerk: perk_militarist level: 1 - racialPerk: perk_plains_dweller level: 1 - racialPerk: perk_warlord level: 1 - racialPerk: perk_diplomacy_high_acceptance level: 2 - racialPerk: perk_ship_attack level: 3
Now save the file in the folder you created in the Mods directory, and open Master of Orion and test it. On the new game screen, you should see that the Mrrshan now have this new trait.
A complex example
Let's say you want to add a new tech node to give you a miniaturization to beams at the end of the tree between planar transcendence and evolving technologies. We will need to edit several files. First, open miniaturizations.yaml, and find the beam miniaturizations:
###BEAMS - key: miniaturization_beams_1 name: MINIATURIZATION_BEAMS_1_NAME description: MINIATURIZATION_BEAMS_1_DESCRIPTION icon: assets/ship_modules/miniaturization_beams.png spaceDecreaseFactor: 0.1 costDecreaseFactor: 0.1 affectedModules: - shipmodule_fusion_beam - key: miniaturization_beams_2 name: MINIATURIZATION_BEAMS_2_NAME description: MINIATURIZATION_BEAMS_2_DESCRIPTION icon: assets/ship_modules/miniaturization_beams.png spaceDecreaseFactor: 0.1 costDecreaseFactor: 0.1 affectedModules: - shipmodule_fusion_beam - shipmodule_ion_pulse_cannon - key: miniaturization_beams_3 name: MINIATURIZATION_BEAMS_3_NAME description: MINIATURIZATION_BEAMS_3_DESCRIPTION icon: assets/ship_modules/miniaturization_beams.png spaceDecreaseFactor: 0.1 costDecreaseFactor: 0.1 affectedModules: - shipmodule_fusion_beam - shipmodule_ion_pulse_cannon - shipmodule_plasma_cannon
Copy/paste a new copy of the last miniaturization, but change the key name to miniaturization_beams_4, and change the names and descriptions from 3 to 4 as well. We might want to make sure it upgrades death rays too, so look up the ship module name for death rays in ShipModules.yaml. As you might expect, it's named shipmodule_death_ray. It's still necessary to look it up though just in case they named it something different (for example notice that plasma beams are actually shipmodule_plasma_cannon). Add a line for the death rays at the bottom, and we should have this:
- key: miniaturization_beams_4 name: MINIATURIZATION_BEAMS_4_NAME description: MINIATURIZATION_BEAMS_4_DESCRIPTION icon: assets/ship_modules/miniaturization_beams.png spaceDecreaseFactor: 0.1 costDecreaseFactor: 0.1 affectedModules: - shipmodule_fusion_beam - shipmodule_ion_pulse_cannon - shipmodule_plasma_cannon - shipmodule_death_ray
Save the file. Now we have to define the actual technology that gives you the miniaturization. Open TechApps.yaml, and do a search for miniaturization_beams. You will find all three beam miniaturizations listed. Here is the third one:
- key: techapp_miniaturization_beams_3 icon: assets/tech_apps/tech_miniaturization_lasers.png type: techapptype_miniaturization hologram: ContentPrefabs/Research/miniaturization_beams.prefab unlocks: - miniaturization_beams_3 tags: - Military
Copy/paste a copy of this underneath, but change the 3's to 4's:
- key: techapp_miniaturization_beams_4 icon: assets/tech_apps/tech_miniaturization_lasers.png type: techapptype_miniaturization hologram: ContentPrefabs/Research/miniaturization_beams.prefab unlocks: - miniaturization_beams_4 tags: - Military
Next, we define where it is on the tech tree. Open TechTree.yaml, and do a search for planar which will take you to planar transcendence. Copy/paste the planar transcendence tech so that we have all the same formatting. Under requires: we change the prerequisite techs to technode_planar_transcendence and technode_temporal_fields. Under unlocks, we delete the second application and change the first to techapp_miniaturization_beams_4. We will also want to change the cost to 15000 since it's a more advanced technology, set x to 13 to move it further right on the tree, and set y to 6 so it's centered.

Finally, we need to change the name of the tech to, say, TECHNOLOGY_BEAM_MINIATURIZATION_NAME and TECHNOLOGY_BEAM_MINIATURIZATION_DESCRIPTION for the description, and change the key for the tech to, say, technode_beam_miniaturization. You can also delete the things with a # before them, which are unused and don't affect anything. We should have this:
- key: technode_beam_miniaturization name: TECHNOLOGY_BEAM_MINIATURIZATION_NAME description: TECHNOLOGY_BEAM_MINIATURIZATION_DESCRIPTION cost: 15000 x: 13 y: 6 icon: assets/techs/planar_transcendence.png requires: - technology: technode_temporal_fields - technology: technode_planar_transcendence unlocks: - application: techapp_miniaturization_beams_4
You can also change the icon if you want. They are located in StreamingAssets/assets/techs. We also need to change Evolving technologies so that it requires this tech now. Under technode_future_technology, set x to 14, and change requires to -technology: technode_beam_miniaturization:
- key: technode_future_technology name: TECHNOLOGY_FUTURE_TECHNOLOGY_NAME description: TECHNOLOGY_FUTURE_TECHNOLOGY_DESCRIPTION cost: 12000 x: 14 y: 6 icon: assets/techs/planar_transcendence.png isFutureTech: true requires: # - technology: technode_galactic_networking # - technology: technode_planetoid_construction - technology: technode_beam_miniaturization unlocks: - application: techapp_future_technologies
Lastly, we define the names we have set. Open Backend.csv, and search for miniaturization_beams. Make a copy of the beams_3 lines underneath, and change the 3's to 4's. We should have
MINIATURIZATION_BEAMS_4_NAME,,Miniaturization: Beams Level 4,...
MINIATURIZATION_BEAMS_4_DESCRIPTION,,Decreases production cost and size of these technologies.<br>This effect is cumulative with miniaturizations of the same type.,...
Don't worry about changing the other languages. Now open Technology.csv, copy/paste any name and description lines onto a new line to preserve formatting, but change the names to TECHNOLOGY_BEAM_MINIATURIZATION_NAME and TECHNOLOGY_BEAM_MINIATURIZATION_DESCRIPTION, and edit the name so that it says Beam Miniaturization.

Save all files to your mod's folder, boot up the game, and see if it worked!

Note: Rather than using a .csv file to specify the names of things, you can just code in the name directly by putting it in quotes. For example, you could have something like this:
- key: technode_beam_miniaturization name: "Hyper Advanced Beam Miniaturization" description: "By researching this technology, you will unlock new applications:" cost: 15000 x: 13 y: 6 icon: assets/techs/planar_transcendence.png requires: - technology: technode_temporal_fields - technology: technode_planar_transcendence unlocks: - application: techapp_miniaturization_beams_4
The advantage to using .csv files is so that you can have a different name display in each language, which will help your mod appeal to a wider base. If you're not worried about that, you need not use the extra .csv files.

A lot of this you learn from trial and error, so don't be afraid to experiment! Just make sure to backup your changes.
Additional Tips
Through all of my modding experience, I've learned some things about specific files that you might be interested in.
  • You are going to be starting Master Of Orion a lot to test your mod. That means sitting through that WG Labs logo cinematic a lot. I highly recommend installing WhatIsSol's Unofficial Code Patch[www.nexusmods.com], which forces the game to skip the cinematic when intro cinematic is disabled in the options menu in game. His code patch also fixes many bugs in the game and adds some nice UI features as well, so it is highly recommended for everyone regardless of whether you're a modder.

  • If your mod isn't working, you can sometimes spot errors in the output log that tell you which yaml is the problem. The output log is located at Master of Orion\MasterOfOrion_Data\output_log.txt. Do a ctrl + F search for the name of your mod. After searching through the file, you may find a message like "ColonyStructureTypes.yaml is not compatible with YAML implementation" or "Unable to load design_advanced_ground_batteries," so you know where to look for the problem.

  • Notepad ++ has a few useful functions for modding. In the search menu you can use the Replace option to quickly find and replace multiple instances of the same text. This can also be used to delete multiple instances of the same text, and the leftover blank space can be removed with the Remove Empty Lines option under the Line operations submenu found in the Edit menu. The Line Operations submenu also includes lexicographical sorting, which is useful for organizing .csv files.

  • In your modding efforts, at some point you are going to cause the game to freeze, and you'll have to force quit it. On Windows, Ctrl+Shift+Esc is a handy key combination for bringing up the Task Manager quickly without having to go through the Ctrl+Alt+Delete menu.

  • To further reduce your wait times when testing, consider setting the following in the Options menu. Under Gameplay: Disable GNN, Disable Adviser Tips, Disable Camera Focus. Under Interface: Show Enemy Fast Animation, Show Player Fast Animation.

  • Many keys require a ContentPrefab. This will come up if you are trying to make a new biome, for example. You can't add these into the game yourself, so you have to use the existing ones in the game. For a list of those available, see here[docs.google.com].

  • If you're testing new weapons, ships, defenses, etc., put the tech in technode_root so you start with it. Start a game on a Medium Cluster galaxy with 1 opponent, and test it on pirates. If you use a circle galaxy, the pirates might fly in a different direction. 1 opponent is to reduce turn processing times.

  • If you're having trouble finding a setting for something, the first place to go is Globals.yaml if you can't find anything in the relevantly named yamls. I've read through Globals several times, and I still notice new stuff each time. I would like to mention specifically that lithovore growth rates are in PlanetMineralRichnessTypes.yaml.

  • If you create a free tech perk in RacialPerks.yaml and create a new perk that gives that tech, e.g. making it so Warlord gives you Engineering as a tech, the free tech perk must come before the perk that gives you the tech in the yaml file; otherwise it won't work properly.

  • You can make it so that lithovore races don't see certain techs in the tech tree. Take a look at this old key in TechApps.yaml:
    - key: techapp_food_replicators icon: assets/tech_apps/tech_building_food.png type: techapptype_structure hologram: ContentPrefabs/Research/neutron_collider.prefab unlocks: - structure_food_replicators tags: - Population requires: - perk_lithovore_off
    By adding -perk_lithovore_off in this way, you disable it in the tech tree for those races. It's quite handy for food buildings. Don't use this on a tech that appears in a Branches: section in the tech tree, e.g. weather controller, since it will cause bugs. The requires: section only recognizes perk_lithovore_off, perk_uber_planet, and victory_condition_scientific.

  • There are many hidden settings such as this perk_lithovore_off one. Some you can find in the unused keys still in the game. For others, you have to dig deeper. If you download a program called dotPeek[www.jetbrains.com], you can decompile the Assembly-CSharp.dll located in MasterOfOrion_Data\Managed and view the game's CSharp code. You can use this to find formulas for things like chance for missiles to hit for example, and you can use it to find unused but implemented parameters like compatiblePlanetSize for ColonyStructureTypes.yaml. Being able to read C Sharp helps, but it's not mandatory for deciphering everything in the .dll.

  • To remove an unlocks section in the tech tree, you need to leave in the "unlocks:" line but leave out the tech, like this:
    - key: technode_transwarp_fields name: TECHNOLOGY_TRANSWARP_FIELDS_NAME description: TECHNOLOGY_TRANSWARP_FIELDS_DESCRIPTION cost: 7980 x: 11 y: 5 icon: assets/techs/transwarp_fields.png requires: - technology: technode_quantum_fields unlocks: branches: - unlocks: - application: techapp_subspace_teleporter - unlocks: - application: techapp_phasing_cloak
    Similarly for branches, just leave a branches: line in with nothing after.

Finally, I'm working on compiling a list of parameters directly from the .dll and writing a guide. You can view my work in progress here: http://gtm.steamproxy.vip/sharedfiles/filedetails/?id=847646307
You're welcome to help me out with that if you'd like.

If you have any questions or need help getting your mod to work, let me know in the comments, and I'd be glad to help! Happy modding.
152 Comments
Radick 26 Sep @ 4:55pm 
Thank you for confirming my assessment of where the change needs to occur. I might contact WhatIsSol and see if he has any pointers to help get me started. I'll also check out that decompiler you mentioned, ildasm, and the compiler, ilasm.
Spud Dastardly  [author] 25 Sep @ 2:25pm 
Hi Radick. That is certainly a code change, not possible in the yaml system. Although I have read the code with dotPeek, I have not edited it myself. Only WhatIsSol has done that. To edit the code, he uses ildasm to decompile the dll into assembly, edits it in assembly, then compiles it with ilasm.
Radick 24 Sep @ 9:15pm 
The purpose would be to help make multiplayer games less 'who clicked first' and a little more in the 'spirit' of turn based games.

Looking into the YAML files I believe this is more of a core game change, involving changing C# code. First, do you think that my assessment is correct or could this be done just with YAML file manipulation? Second, do you have any experience manipulated the C# code or have you just looked through it with dotPeek?

Thanks in advance for taking the time to read this and for any advice you may give!
Radick 24 Sep @ 9:15pm 
Hey Spud, first thank you for the wonderful 5x mod. I think it helps bring a lot more depth to the game and makes research choices a lot more meaningful.

Now, on to the point of me contacting you. I have been pondering for a while now the possibilities of a mod that held movement for fleets until the end of all (human) player turns. This would, in theory, mean that a player would direct their fleet to go to a location, and it would end up at that destination (assuming a one turn travel time) the following turn rather than immediately.
Spud Dastardly  [author] 23 May @ 10:45pm 
Creative solution. The tooltip fpr that is generated automatically for all keys with that parameter, so altering the text would change it for every upgraded building. Hopefully the AI doesn't build this structure for no reason. Since it has no bonuses, I think they would avoid it.
Bilz 23 May @ 1:55am 
I was trying to be able to make the Capitol scrappable, but this was the best I could do.
It at least gets rid of your Capitol and lets you rebuild elsewhere.

- key: structure_vacated_capitol
name: "Vacate the Capitol"
description: "There are times when the evacuation of an empire's Capitol is required, usually to relocate to another planet.<BR><BR>The abandoned shell of the former Capitol is left behind, of little value except possibly as a decoy for enemy attacks."
icon: assets/structures/capitol.png
cost: 30
upkeep: 1
isTransferable: true
requires: structure_capitol
upgrades: structure_capitol

What ticks me off is that the game labels it as an Upgrade to the Capitol. Looking for a way for the game to label it as a Downgrade.
Dr. Cointreau 28 Apr @ 2:55am 
Just an FYI: I wasn't able to get the untested parameter
bonusTiles: (i)
to work, at least using the arguments lifted from structure_asteroid_mines
Dr. Cointreau 26 Apr @ 2:22pm 
* bowing with pride and momentous gravitas *
Spud Dastardly  [author] 26 Apr @ 9:46am 
Cool, that means you've used a modding feature no one has ever known about before! A rare feat this long after the game's release.
Dr. Cointreau 25 Apr @ 6:25pm 
Happy to report that
requiredStructure: structure_name
works for Colony Projects exactly how one would predict.

Thanks again!