• We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.

Stellaris Dev Diary #31 - Modding (Scripting Anomalies)

Hello, earthlings. My name might be unfamiliar to some dev diary readers; I’ve been working on Stellaris for some time now and am in charge of scripting/content design duties for Stellaris while the eminent Goosecreature is away rearing his brood. This week’s dev diary is the first in a two-part series on modding, which you will read, enjoy, and be enlightened by. We’re here to get our hands dirty, so don’t expect any pretty screenshots! Only functional screenshots.

Stellaris is built on the Clausewitz engine, and has had a lot of functionality ported over from our other games. Since we use a random galaxy generated at game start (unless you mod in a static one) we have to approach things a bit differently than you would in a game with a pre-set map of Europe - if you’ve modded a Paradox Development Studio title before you may come across a few surprises, but you should feel right at home soon enough.

General Modding
Like our other games, Stellaris is very mod-able. Take a look in the \Stellaris\common\ folder and you’ll see. It contains mostly everything that determines how the game functions. Edicts, ethics, game rules, army attachments, name lists, country types, planet classes, modifiers, buildings and so on can all be found here. In \Stellaris\common\defines\ you will find a LUA script file that regulates a lot of basic game behaviors and settings, like the base soft cap on the number of core planets ( CORE_SECTOR_PLANET_CAP = 5 ) or the camera field-of-view ( NCamera = { FOV = 35 } ) available for easy tweaking. Most of these values come with fairly informative comments!

Scripted Triggers & Effects, Chained Event Targets
We recently inherited scripted triggers and effects from Hearts of Iron IV! They’re very good. One addition to the scripting language that originated in Stellaris and may or may not find its way to other games in the future is event target chaining. It allows us to chain targets/scopes/saved event targets together in a way not unlike how we do it in localization. For example, what was once written
Code:
from = {
    owner = {
        establish_communications = root
    }
}
can now be rendered as the much more digestible
Code:
from.owner = { establish_communications = root }
Amazing!

Anomalies
Swiftly moving on to Anomalies, the lifeblood of early game exploration in Stellaris. Incidentally, anomalies are also rather unlike the events found in our other games You can and should make your own! I will show you how.

An anomaly is made up of a minimum of four components; the anomaly category, the anomaly, the event and localization.
  1. \Stellaris\common\anomalies\00_anomaly_categories.txt
  2. \Stellaris\common\anomalies\00_anomalies.txt
  3. \Stellaris\events\00_anomaly_events.txt
  4. \Stellaris\localisation\events_l_english.yml

Anomaly categories define what planets are viable for a certain category of anomalies to spawn on. Anomalies refine this selection further and link to specific events. The event that is eventually fired… does stuff. The localization file provides the text for the event and the category window.

I feel that a picture is worth more than a thousand words, so I’m going to show you pictures of words to maximize efficiency. See if you can follow along!

Step 1 - 00_anomaly_categories
1anomalycategory.png


Step 2 - 00_anomalies
2anomaly.png


Step 3 - 00_anomaly_events
3event.png


Step 4 - events_l_english
4localization.png



And the end result!
Planet Surveyed
5categorywindow.png


Anomaly Researched
6eventwindow.png




That’s all for now, planet-dwellers. Next week, art director Aerie will explain how to get your own art into the game. Exporters! Graphics! Spaceships!
 
Last edited by a moderator:
  • 159
  • 48
Reactions:

ahhheygao

Double-Peace Stegosaurus
53 Badges
Jan 2, 2013
3.027
5.848
  • Crusader Kings II: Sword of Islam
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sons of Abraham
  • Stellaris: Leviathans Story Pack
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Horse Lords
  • Europa Universalis IV: Cossacks
  • Crusader Kings II: Conclave
  • Stellaris
  • Stellaris: Galaxy Edition
  • Stellaris: Galaxy Edition
  • Hearts of Iron IV Sign-up
  • Stellaris Sign-up
  • Europa Universalis IV: Rights of Man
  • Stellaris: Digital Anniversary Edition
  • Europa Universalis IV: Pre-order
  • Crusader Kings II: Monks and Mystics
  • Stellaris - Path to Destruction bundle
  • Europa Universalis IV: Mandate of Heaven
  • Steel Division: Normand 44 Sign-up
  • Crusader Kings II: Jade Dragon
  • Cities: Skylines - Parklife
  • Crusader Kings II: Holy Fury
  • Imperator: Rome Sign Up
  • Mount & Blade: Warband
  • Crusader Kings II: The Republic
  • Europa Universalis IV
  • Europa Universalis III Complete
  • Europa Universalis III Complete
  • The Showdown Effect
  • Warlock: Master of the Arcane
  • War of the Roses
  • 500k Club
  • Crusader Kings II: Way of Life
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: Charlemagne
  • Europa Universalis IV: Res Publica
  • Europa Universalis IV: Call to arms event
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Art of War
  • Crusader Kings II
  • Cities: Skylines
Excellent! As expected, modding anomalies will be just like events, so modders will be churning them out like clockwork.

Greatly looking forward to next week's DD--I need to know species portraits' animation format and specs.
 
  • 3
Reactions:

Hull-Tanker

Sergeant
70 Badges
Mar 7, 2016
96
377
  • Crusader Kings II: Charlemagne
  • Europa Universalis IV: Mare Nostrum
  • Cities: Skylines - After Dark
  • Europa Universalis IV: Third Rome
  • Crusader Kings II
  • Semper Fi
  • Europa Universalis IV: Res Publica
  • Magicka
  • Hearts of Iron III: Their Finest Hour
  • Hearts of Iron III
  • For the Motherland
  • Europa Universalis IV: Wealth of Nations
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Europa Universalis IV: Conquest of Paradise
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sword of Islam
  • Darkest Hour
  • Europa Universalis IV
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Rights of Man
  • Stellaris: Leviathans Story Pack
  • Hearts of Iron IV: Together for Victory
  • Stellaris: Apocalypse
  • Crusader Kings II: Monks and Mystics
  • Stellaris: Necroids
  • Europa Universalis IV: Mandate of Heaven
  • Hearts of Iron IV: Death or Dishonor
  • Stellaris: Synthetic Dawn
  • Europa Universalis IV: Cradle of Civilization
  • Europa Universalis IV: Rule Britannia
  • Hearts of Iron IV: Expansion Pass
  • Stellaris: Humanoids Species Pack
  • Crusader Kings II: Reapers Due
  • Hearts of Iron IV: Cadet
  • Stellaris Sign-up
  • Stellaris
  • Crusader Kings II: Conclave
  • Stellaris: Distant Stars
  • Crusader Kings II: Horse Lords
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Way of Life
  • Mount & Blade: Warband
  • Europa Universalis IV: El Dorado
  • Cities: Skylines
  • Victoria 2: Heart of Darkness
  • Victoria 2: A House Divided
I mean I don't know anything about modding and programming and I don't really understand anything in this dev diary expect that it will be easy for people smarter than me to mod.

So that's nice!
 
  • 14
Reactions:

Cpack

Field Marshal
39 Badges
Jan 16, 2003
3.014
721
  • Cities: Skylines Industries
  • Cities: Skylines - Natural Disasters
  • Stellaris - Path to Destruction bundle
  • Cities: Skylines - Mass Transit
  • Hearts of Iron IV: Death or Dishonor
  • Cities: Skylines - Green Cities
  • Hearts of Iron IV: Expansion Pass
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Cities: Skylines - Parklife
  • Hearts of Iron IV: Field Marshal
  • Stellaris: Megacorp
  • Imperator: Rome Deluxe Edition
  • Imperator: Rome
  • Hearts of Iron IV: Expansion Pass
  • Cities: Skylines - Campus
  • Hearts of Iron IV: La Resistance
  • Stellaris: Federations
  • Battle for Bosporus
  • Stellaris: Nemesis
  • Cities: Skylines - After Dark
  • Europa Universalis III Complete
  • For the Motherland
  • Hearts of Iron III
  • Hearts of Iron III: Their Finest Hour
  • Europa Universalis III Complete
  • Europa Universalis III Complete
  • Semper Fi
  • 500k Club
  • Cities: Skylines
  • Hearts of Iron II: Armageddon
  • Cities: Skylines - Snowfall
  • Stellaris
  • Stellaris: Galaxy Edition
  • Stellaris: Galaxy Edition
  • Hearts of Iron IV Sign-up
  • Stellaris Sign-up
  • Hearts of Iron IV: Cadet
  • Hearts of Iron IV: Colonel
About random vs. static galaxy
In my opinion, as posted in another thread, the galaxy is a little bit to sorted, the star systems are too even arranged, nearly all have the same distance to each other, there's no crowded spot of closer systems to the core f.e and way more distances in the outer rims etc.
Is it possible to get something like a random calculator for arranging star systems? To get more uneven results like the Star wars galaxy f.e

Or how easy / hard is it to mod the galaxy?


An editor would be great where you can just "drag and drop" or "move" star systems around in your galaxy.How they look like in the game then is random.
I know that the starting conditions in this case are not the same, but... ey, thats random challenge!!!

like this f.e.:
Galaxy Spread.jpg
 
  • 36
  • 1
Reactions:

loup99

Godogost of Armorica
78 Badges
Jan 22, 2013
16.573
6.106
  • Crusader Kings III
  • Europa Universalis IV
  • Warlock 2: The Exiled
  • 500k Club
  • Pride of Nations
  • Stellaris
  • Hearts of Iron IV: Cadet
  • Crusader Kings Complete
  • Imperator: Rome Deluxe Edition
  • Victoria 2
  • Arsenal of Democracy
  • Cities in Motion
  • Crusader Kings II
  • Darkest Hour
  • Europa Universalis III: Chronicles
  • For The Glory
  • Hearts of Iron III
  • March of the Eagles
  • Rome Gold
  • Sengoku
  • Victoria 2: A House Divided
  • Victoria: Revolutions
  • Cities: Skylines
  • Europa Universalis IV: Pre-order
This looks like a good approach! I appreciate that you give this information before release, it will help those players who plan on starting mods.
 

LordMune

Content Design Lead
26 Badges
Mar 15, 2015
142
941
  • Europa Universalis IV
  • IPO Investor
  • Stellaris: Galaxy Edition
  • Crusader Kings II
Is it possible to add new language to the localisation category?

Secondly, is it possible for an anomaly event to act as a trigger for another anomaly or another event in general to script some anomaly "chains"?
It should not be impossible to add additional languages.

Yes, anomaly events (and even anomaly categories just spawning) can be used to trigger other anomalies. We make some use of this in the base game.
 
  • 25
Reactions:

Aegrim

First Lieutenant
47 Badges
Oct 10, 2015
267
567
  • Crusader Kings II: Legacy of Rome
  • Stellaris
  • Stellaris - Path to Destruction bundle
  • Steel Division: Normandy 44
  • Stellaris: Synthetic Dawn
  • Sword of the Stars
  • Semper Fi
  • Naval War: Arctic Circle
  • Hearts of Iron III: Their Finest Hour
  • Hearts of Iron III
  • For the Motherland
  • Darkest Hour
  • Crusader Kings II
  • Stellaris: Nemesis
  • Cities: Skylines - Green Cities
  • Hearts of Iron IV: Expansion Pass
  • Hearts of Iron IV: Death or Dishonor
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Cities: Skylines - Parklife
  • Stellaris: Distant Stars
  • Cities: Skylines Industries
  • Imperator: Rome
  • Prison Architect
  • Cities: Skylines - Campus
  • Stellaris: Ancient Relics
  • Stellaris: Lithoids
  • Stellaris: Federations
  • Stellaris: Necroids
  • Stellaris Sign-up
  • Europa Universalis IV
  • Victoria 2
  • Cities: Skylines
  • Europa Universalis IV: El Dorado
  • Cities: Skylines - After Dark
  • Cities: Skylines - Snowfall
  • Hearts of Iron IV Sign-up
  • Surviving Mars
  • Hearts of Iron IV: Cadet
  • Hearts of Iron IV: Colonel
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Cities: Skylines - Natural Disasters
  • Hearts of Iron IV: Together for Victory
  • Cities: Skylines - Mass Transit
  • Crusader Kings II: The Old Gods
  • Stellaris: Megacorp
I'd love to make a pack of anomalies on day 1, but I'd worry if I was making duplicates of stock ones and wouldn't know if mine were easier/harder or more/less generous with rewards.
 
  • 3
Reactions:

TheDarkMaster

Field Marshal
72 Badges
Jan 1, 2012
6.790
2.061
  • Victoria 2: A House Divided
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • Gettysburg
  • Heir to the Throne
  • Magicka
  • Naval War: Arctic Circle
  • Europa Universalis IV: Res Publica
  • Sword of the Stars II
  • Crusader Kings II
  • Victoria 2: Heart of Darkness
  • Warlock 2: The Exiled
  • Warlock 2: Wrath of the Nagas
  • Stellaris: Synthetic Dawn
  • Europa Universalis IV: Pre-order
  • Cities: Skylines - After Dark
  • Europa Universalis IV: Mare Nostrum
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Charlemagne
  • Cities in Motion
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sword of Islam
  • Dungeonland
  • Europa Universalis III
  • Europa Universalis III: Chronicles
  • Europa Universalis III Complete
  • Divine Wind
  • Europa Universalis IV: Art of War
  • Crusader Kings II: Reapers Due
  • Stellaris: Digital Anniversary Edition
  • Crusader Kings II: Holy Fury
  • Europa Universalis IV: Rights of Man
  • Stellaris Sign-up
  • Tyranny: Archon Edition
  • Stellaris
  • Crusader Kings II: Conclave
  • Crusader Kings II: Horse Lords
  • Europa Universalis IV: Common Sense
  • Pillars of Eternity
  • Crusader Kings II: Way of Life
  • Europa Universalis IV: El Dorado
  • 500k Club
  • Warlock: Master of the Arcane
  • Victoria 2
  • Europa Universalis III Complete
  • Europa Universalis III Complete
And now modders can make some anomaly mods that will be ready to go on day one. Well, assuming we can get a full list of possible things that can happen as a result of scanning an anomaly and what their commands codes are.