Difference between revisions of "Modding"

From Stellaris Wiki
Jump to navigation Jump to search
(is_ai = no seems to work to disable ai usage of traits)
(Guidelines)
Line 14: Line 14:
 
*'''Minimize overwrites of vanilla files''' by adding separate files and [[#Game structure|loading from folders]] whenever possible, to improve mod compatibility and maintenance.
 
*'''Minimize overwrites of vanilla files''' by adding separate files and [[#Game structure|loading from folders]] whenever possible, to improve mod compatibility and maintenance.
 
*'''Use a proper merge tool''' (like [http://winmerge.org/ WinMerge]), to [[Merging guide|merge between folders]], and update modified vanilla files to a new vanilla patch.
 
*'''Use a proper merge tool''' (like [http://winmerge.org/ WinMerge]), to [[Merging guide|merge between folders]], and update modified vanilla files to a new vanilla patch.
*'''Backup your work''' to avoid losing everything. Consider using a source control system like [https://git-scm.com/ Git] and a collaborative forge like [https://github.com/ Github] to manage team collaboration.
+
*'''Backup your work''' to avoid losing everything. Consider using a source control system like [https://git-scm.com/ Git] and a collaborative forge like [https://github.com/ GitHub] to manage team collaboration.
 
*'''Use UTF-8 encoding''' for text files.
 
*'''Use UTF-8 encoding''' for text files.
 
*'''Indent properly''' to easily spot unclosed curly braced. Vanilla uses 1 tab for indentation rather than spaces.
 
*'''Indent properly''' to easily spot unclosed curly braced. Vanilla uses 1 tab for indentation rather than spaces.

Revision as of 22:31, 11 May 2016

Version

Outliner top.png
This article is timeless and should be accurate for any version of the game.

Modding, or creating mods, is the act of modifying the behavior of the base game (often referred as vanilla), either for personal use, or to release publicly to other players, for instance via the Steam Workshop.

As for all Paradox games, Stellaris is moddable to a great extent. Motivations of modders may vary widely: better translation to native language, more events or decisions, better map, major overhaul, etc.

This guide is intended to lower the entry barriers to the world of Stellaris modding. However, there is still a learning curve to it, and it cannot replace the need to read some working vanilla code, and do lots of trial and error experimentation!

Guidelines

  • Create a mod for your modifications: use a personal mod even for small changes, and never modify directly game files in Steam Stellaris folder, as they may be overwritten without warning.
  • Use a good text editor (like Notepad++ or Sublime Text) to edit files and search into multiple files.
  • Validate your mod with The Validator, it will save you a lot of pain and time troubleshooting crashes and bugs.
  • Minimize overwrites of vanilla files by adding separate files and loading from folders whenever possible, to improve mod compatibility and maintenance.
  • Use a proper merge tool (like WinMerge), to merge between folders, and update modified vanilla files to a new vanilla patch.
  • Backup your work to avoid losing everything. Consider using a source control system like Git and a collaborative forge like GitHub to manage team collaboration.
  • Use UTF-8 encoding for text files.
  • Indent properly to easily spot unclosed curly braced. Vanilla uses 1 tab for indentation rather than spaces.
  • Use comments starting with # character, to remember reasons for writing tricky stuff.

Mod structure

Mods are located in folder ~\Paradox Interactive\Stellaris\mod, which must contain:

  • the .mod file, to tell the launcher what to do with the mod-folder.
  • the mod folder or zip containing the mod data. The mod data must have the same file and folder structure as if it was along with stallaris.exe in the game directory.

Note that folder and file names are case sensitive on Mac OS X and Linux.

For example, the a new text file called test1.mod' can be created in the "C:\Users\<Username>\Documents\Paradox Interactive\Stellaris\mod" folder, alongside a new 'test1' folder.

name="Test1"
path="mod/test1"
tags={
	"Economy"
}
supported_version="1.0.0"

In the 'test1' folder, the test1.mod file should be copied and can be renamed to descriptor.mod.

Game files can now be replaced using the same structure as the game directory. Here, a common folder was created, with a traits subfolder that contains the 00_species_traits.txt from the game folder. The structure now looks like the following:

 C:\Users\Jason\Documents\Paradox Interactive\Stellaris\mod
   test1.mod
   test1 (dir)
     test1.mod
     common (dir)
       traits (dir)
         00_species_traits.txt

A new trait with various bonuses called trait_super can be added. Here it has a high cost (so the AI could not use it, but the user could load it using the console commands). (Using is_ai = no seems to also do the trick)

trait_super = {
	cost = 1000
	modifier = {
		tile_resource_food_mult = 10
		tile_resource_energy_mult = 10
		tile_resource_minerals_mult = 10
	}
}

In addition, downloaded mods will use content in zip files. Their '.mod' files will contain lines defining the 'remote_file_id' and 'archive'. Here is an example:

name="999 Core Planets - All your planets are belong to you"
archive="workshop/content/281990/678893824/999cores.zip"
tags={
	"Balance"
	"Gameplay"
	"Utilities"
}
remote_file_id="678893824"
supported_version="1.0.0"

This directory is based off the Stellaris directory in your documents folder, for instance this zip file is:

C:\Users\<Username>\Documents\Paradox Interactive\Stellaris\workshop\content\281990\678893824\999cores.zip

Game data

Game structure

Below is a list of game files and folders, with associated modding guide.

Stellaris/common/

Folder Summary Guides
agendas Agendas are given to leader-candidates in Oligarchic government-forms
ambient_objects References used by code to spawn ambient objects
anomalies Events that occur for research ships
armies Definitions for army types
army_attachments Definitions for attachments that can be added to armies
attitudes Definitions containing the restrictions for each attitude used by the AI
buildable_pops Definitions for buildable pops. i.e. Robots
buildings Setup for buildings constructable on planets, and those given through events
colors Color definitions used for the country color selection
component_flags List of flags used by the AI for selecting components
component_sets List of the sets of components used by ships
component_tags Used to group components together for common modifiers
component_templates Attribute setup for each weapon and the templates used for ships
country_types Rules for each country within the game.
defines Basic game behaviors and settings Defines
deposits Setup for the deposits of resources found on planets
diplo_phrases Setup for the logic behind the diplomatic phrases used between countries.
diplomatic_actions Setup for the rules for diplomatic actions.
edicts Setup for the edicts used by planets and countries.
ethics Setup for ethics, controlling their modifiers and categories
event_chains Setup for the event chains used in the events folder
fallen_empires Sets up the countries and system initializer used for fallen empires
game_rules Logic used for various game actions, i.e. can_enslave_pop. Logic here does not override hardcoded rules.
global_ship_designs Designs used by the ship designer for each species
governments Setup for the governments.
graphical_culture Controls the lightning used for ships, which differs between graphical cultures.
mandates Controls the mandates used by factions
name_lists Sets up the names used for each species.

Stellaris/events/

Stellaris/flags/

Stellaris/fonts/

Stellaris/gfx/

Stellaris/inteface/

Stellaris/localisation/

Stellaris/map/

Stellaris/music/

Stellaris/prescripted_countries/

Stellaris/sound/

Modding Guides

Tools & utilities

  • Notepad++ - Powerful editor to change files.
  • Maya exporter - Clausewitz Maya Exporter to create your own 3D models.
  • Steam Workshop - The place for where you can share your creations with other players.

External links

Stellaris Dev Diary #31 - Modding (Scripting Anomalies)
Stellaris Dev Diary #32 - Modding art

See also

References


Empire EmpireEthicsGovernments • Civics • OriginsMandatesAgendasTraditions • Ascension PerksEdictsPoliciesRelicsTechnologiesCustom Empires
Pops JobsFactions
Leaders LeadersLeader Traits
Species SpeciesSpecies Traits
Planets PlanetsPlanetary Feature • Orbital DepositBuildings • DistrictsPlanetary Decisions
Systems SystemsStarbasesMegastructuresBypassesMap
Fleets FleetsShips • Components
Land Warfare ArmiesBombardment Stance
Diplomacy Diplomacy • Federations • Galactic CommunityOpinion ModifiersCasus Belli • War Goals
Events EventsAnomaliesSpecial projectsArchaeological Sites
Gameplay GameplayDefinesResources • Economy
Dynamic modding Dynamic moddingEffectsConditionsScopesModifiersVariablesAI
Media/localisation Maya exporterGraphicsPortraitsFlagsEvent picturesInterfaceIconsMusicLocalisation
Other Console commandsSave-game editingSteam Workshop