• 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:
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:
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:
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:
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.
 
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:
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:
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.