Welcome to a brief unannounced surprise bonus dev diary!

PDXCon preparations are taking up most of our time, but with attendees getting some early hands-on time with the Distant Stars Story Pack, we figured we'd give the modders among you a glimpse of some of the under-the-hood-changes coming in the update. We've discussed the changes coming to Anomalies in 2.1 'Niven' in the past, but what do they actually mean for you, the intrepid modder? Well, hopefully the reworked Anomaly back-end will make your life a lot easier.

Now strap in, we're going to get a little bit technical.

Let's take a look back at an old favorite, Anomaly category "Buried in the Sand" as writ in the olden days:
00_anomaly_categories_3.txt said:
Code:
anomaly_category = {
    key = "DES_BURIED_CAT"
    desc = "DES_BURIED_DESC"
    picture = "GFX_evt_desert"
    level = 2

    spawn_chance = {
        modifier = {
            add = 3
            is_planet_class = pc_desert
            from = {
                owner = {
                    NOT = {
                        has_country_flag = masters_writings_politics_found
                        has_country_flag = ai_admiral_found
                    }
                }
            }
        }
    }

    on_spawn = {
    }

    on_success = {
    }

    on_fail = {
        ship_event = { id = anomaly_failure.4030 }
    }
}
00_anomalies_3.txt said:
Code:
anomaly = {
    event = anomaly.4030
    category = "DES_BURIED_CAT"

    weight = 1

    potential = {
        always = yes
    }
}

anomaly = {
    event = anomaly.4135
    category = "DES_BURIED_CAT"
   
    weight = 1
   
    potential = {
        owner = {
            NOT = { has_ethic = ethic_gestalt_consciousness }
        }
    }
}
Awful, right? That's 50 lines of script split into three entries across two different files. But fear not, the future is bright!

New script in 03_anomaly_categories.txt said:
Code:
DES_BURIED_CAT = {
    picture = "GFX_evt_desert"
    level = 4
   
    spawn_chance = {
        modifier = {
            add = 3
            is_planet_class = pc_desert
        }
    }

    max_once = yes
   
    on_success = {
        1 = anomaly.4030
        1 = {
            modifier = {
                factor = 0
                owner = { has_ethic = ethic_gestalt_consciousness }
            }
            anomaly_event = anomaly.4135
        }
    }
}
Less than 25 lines of script, all in one file! Clean. Efficient. Sleek, even.

We have prepared a handy explainer in case you want to start low-key updating your event mods for 2.1 already;
Code:
an_anomaly_category = {                # Anomaly category ID key

    should_ai_use = yes/no            # Allows AI empires to generate the category. Default: no

    desc = "key"                    # Optional, if no desc is given "<category key>_desc" is assumed

    desc = {                        # Can also use triggered descs. First valid entry will be used.
        trigger = { ... }            # Scope: planet, from = ship
        text = "key"                # Localization key for description
    }
    picture = GFX_picture            # Picture displayed in category window
    level = int                        # Anomaly level, 1 to 10

    null_spawn_chance = 0.5            # Default 0. 0.0 - 1.0 (0 to 100%) chance category will NOT spawn
                                    # even if it is picked by the anomaly die roll. Used to make
                                    # categories for unusual objects (e.g. black holes) actually rare.
   
    max_once = yes/no                # default NO, if true will spawn category only once per empire
    max_once_global = yes/no        # default NO, if true will spawn category only once per game

    spawn_chance = {                # Chance for this anomaly category to spawn, 
        base = <num>                # relative to other valid categories. Default: base = 0
        modifier = {                # Spawn chance modifier
            add/factor = <num>
            <triggers>                # Scope: planet, from = ship
        }
    }

    on_spawn = { <effects> }        # Executes immediately when anomaly category is spawned. 
                                    # Scopes are this/root: planet, from: ship
                                    # NOTE: on_spawn effects will not run if category is spawned through console

    on_success = {                    # Picks anomaly event to fire; similar to random_list
        1 = {                        # Base chance
            max_once = yes            # Individual outcomes default to max_once = yes,
            max_once_global = no     # and max_once_global = no
            modifier = {            # Optional modifiers
                add/factor = <num>
                <triggers>            # Scope: ship, from: planet
            }
            anomaly_event = <id>    # New effect anomaly_event fires specified event ID. Scope: ship, from: planet           
        }                            # Can also use ship_event, though it gets different scopes:
                                    # ship, from: ship, fromfrom: planet       

        1 = <event id>                # shorthand for 1 = { anomaly_event = <event id> }
    }

    on_success = <event id>            # Shorthand for on_success = { 1 = { anomaly_event = <event id> } }
}                                    # Only use if there is only one outcome in the category

That's all for now! Keep an eye and ear out for news from PDXCon.
 

FleetingRain

Field Marshal
58 Badges
Aug 2, 2014
2.670
3.684
  • Europa Universalis IV
  • Surviving Mars
  • Stellaris: Federations
  • Crusader Kings III
  • Crusader Kings II
  • Stellaris
  • Pillars of Eternity
  • Imperator: Rome Sign Up
So, this is an extra and we'll have a bigger Dev Diary today, or is this it until next Thursday?

Regardless, I like this. I don't mod Stellaris but sometimes I want to check something in the script to know how it works and it's currently a pain in the ass to do so.
 

BrokenSky

Field Marshal
86 Badges
May 1, 2015
4.029
4.496
  • Knights of Pen and Paper 2
  • Victoria 2: A House Divided
  • Victoria 2: Heart of Darkness
  • Rome: Vae Victis
  • Warlock: Master of the Arcane
  • Crusader Kings II
  • Warlock 2: Wrath of the Nagas
  • Europa Universalis IV: Pre-order
  • Stellaris: Synthetic Dawn
  • Cities: Skylines - After Dark
  • Warlock 2: The Exiled
  • Europa Universalis IV: Cossacks
  • Cities: Skylines - Snowfall
  • Europa Universalis IV: Mare Nostrum
  • Stellaris
  • Stellaris: Galaxy Edition
  • Stellaris: Galaxy Edition
  • Europa Universalis IV: Third Rome
  • Europa Universalis IV: Rights of Man
  • Stellaris - Path to Destruction bundle
  • Europa Universalis III
  • Crusader Kings II: Charlemagne
  • 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: Sunset Invasion
  • Crusader Kings II: Sword of Islam
  • Europa Universalis III Complete
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Call to arms event
  • Rome Gold
  • Europa Universalis IV: Res Publica
  • Crusader Kings II: Jade Dragon
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Conquest of Paradise
  • Crusader Kings II: Conclave
  • Europa Universalis IV: El Dorado
  • Cities: Skylines
  • Victoria 2
  • Stellaris: Galaxy Edition
  • Crusader Kings II: Way of Life
  • Europa Universalis III Complete
  • Stellaris Sign-up
  • Crusader Kings II: Reapers Due
  • Stellaris: Nemesis
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Hearts of Iron IV: Together for Victory
So, this is an extra and we'll have a bigger Dev Diary today, or is this it until next Thursday?

Regardless, I like this. I don't mod Stellaris but sometimes I want to check something in the script to know how it works and it's currently a pain in the ass to do so.

Last week's dev diary said there wouldn't be one this week because of Pdxcon.
 

Guilliman88

Planet Modifier Guy
42 Badges
Mar 21, 2015
542
413
  • Magicka
  • Stellaris
  • BATTLETECH - Digital Deluxe Edition
  • Surviving Mars: Digital Deluxe Edition
  • Stellaris: Distant Stars
  • Surviving Mars: First Colony Edition
  • BATTLETECH: Flashpoint
  • Stellaris: Megacorp
  • Prison Architect
  • Surviving Mars: First Colony Edition
  • BATTLETECH: Season pass
  • Age of Wonders: Planetfall
  • Age of Wonders: Planetfall Deluxe edition
  • Age of Wonders: Planetfall Premium edition
  • Age of Wonders: Planetfall Season pass
  • Stellaris: Lithoids
  • BATTLETECH: Heavy Metal
  • Stellaris: Federations
  • Crusader Kings III
  • Stellaris: Necroids
  • Stellaris: Nemesis
  • Stellaris: Apocalypse
  • Cities: Skylines
  • Crusader Kings II: Way of Life
  • Pillars of Eternity
  • Cities: Skylines - After Dark
  • Cities: Skylines - Snowfall
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Stellaris - Path to Destruction bundle
  • Cities: Skylines - Mass Transit
  • BATTLETECH
  • Surviving Mars
  • Age of Wonders III
  • Stellaris: Humanoids Species Pack
  • Stellaris: Ancient Relics
  • Stellaris: Synthetic Dawn
  • Age of Wonders: Planetfall - Revelations
  • Crusader Kings II
  • Crusader Kings II: Sword of Islam
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Legacy of Rome
Love it :D
This will make making new anomalies a whole lot faster! Thank you for this :>
 

DominusNovus

Field Marshal
85 Badges
Oct 2, 2007
6.951
3.820
  • Europa Universalis IV: Cradle of Civilization
  • Crusader Kings II
  • Victoria 2: A House Divided
  • Victoria 2: Heart of Darkness
  • Rome: Vae Victis
  • Crusader Kings II: Monks and Mystics
  • Cities: Skylines Deluxe Edition
  • Crusader Kings II: Holy Knight (pre-order)
  • Europa Universalis IV: Rights of Man
  • Europa Universalis IV: Pre-order
  • Crusader Kings II: Charlemagne
  • Europa Universalis IV: Third Rome
  • Cities: Skylines - After Dark
  • Europa Universalis IV: Cossacks
  • Stellaris - Path to Destruction bundle
  • Cities: Skylines - Snowfall
  • Europa Universalis IV: Mare Nostrum
  • Stellaris
  • Stellaris: Galaxy Edition
  • Stellaris: Galaxy Edition
  • Europa Universalis IV: Art of War
  • 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
  • Europa Universalis III
  • Divine Wind
  • Crusader Kings II: Jade Dragon
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Call to arms event
  • Hearts of Iron III
  • Europa Universalis: Rome
  • Hearts of Iron III: Their Finest Hour
  • Heir to the Throne
  • Europa Universalis III Complete
  • Europa Universalis IV: Res Publica
  • Hearts of Iron IV: Cadet
  • Stellaris: Leviathans Story Pack
  • Hearts of Iron IV: Colonel
  • Crusader Kings II: Reapers Due
  • Stellaris: Digital Anniversary Edition
  • Stellaris Sign-up
  • Stellaris: Galaxy Edition
  • Crusader Kings II: Conclave
  • Europa Universalis 4: Emperor
  • Europa Universalis IV: El Dorado
  • 500k Club
More importantly: Why did you bury the poor cat? I hope it was already dead!
 

208

General
91 Badges
Jan 4, 2004
1.917
1.438
  • Europa Universalis IV: El Dorado
  • Victoria: Revolutions
  • Semper Fi
  • Sengoku
  • Sword of the Stars II
  • Victoria 2
  • Victoria 2: A House Divided
  • Victoria 2: Heart of Darkness
  • Warlock: Master of the Arcane
  • Warlock 2: The Exiled
  • 500k Club
  • Cities: Skylines
  • Elven Legacy Collection
  • Europa Universalis IV: Res Publica
  • Europa Universalis IV: Pre-order
  • Pride of Nations
  • Crusader Kings II: Way of Life
  • Pillars of Eternity
  • Europa Universalis IV: Common Sense
  • Knights of Pen and Paper 2
  • Europa Universalis IV: Cossacks
  • Europa Universalis IV: Mare Nostrum
  • Stellaris
  • Stellaris: Galaxy Edition
  • Stellaris: Galaxy Edition
  • Stellaris: Nemesis
  • Europa Universalis IV
  • Hearts of Iron II: Armageddon
  • Crusader Kings II
  • Crusader Kings II: Charlemagne
  • 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
  • Deus Vult
  • Europa Universalis III
  • Divine Wind
  • A Game of Dwarves
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • For the Motherland
  • Hearts of Iron III
  • Hearts of Iron III: Their Finest Hour
  • Heir to the Throne
  • Europa Universalis III Complete
  • Lead and Gold
  • Magicka
should_ai_use = yes/no # Allows AI empires to generate the category. Default: no

Are there a lot of anomalies that the AI doesn't get, or is this intended more for long story-chain anomalies like Horizon Signal and Precursors?

null_spawn_chance = 0.5 # Default 0. 0.0 - 1.0 (0 to 100%) chance category will NOT spawn
# even if it is picked by the anomaly die roll. Used to make
# categories for unusual objects (e.g. black holes) actually rare.

Is a different anomaly category picked if the roll comes up negative, or is it just a lost anomaly opportunity in that case? When is this rolled, when the galaxy is created or when the survey is conducted?

on_success = { # Picks anomaly event to fire; similar to random_list

Is it possible to add additional events to an existing anomaly via a separate file/entry?
 

Jorlem

Field Marshal
117 Badges
May 9, 2012
4.486
3.750
  • Hearts of Iron IV: Expansion Pass
  • Hearts of Iron IV: La Resistance
  • Stellaris: Federations
  • Imperator: Rome - Magna Graecia
  • Crusader Kings III
  • Crusader Kings III: Royal Edition
  • Battle for Bosporus
  • Europa Universalis 4: Emperor
  • Stellaris: Necroids
  • Europa Universalis IV
  • Victoria 3 Sign Up
  • Steel Division: Normandy 44 Deluxe Edition
  • Steel Division: Normandy 44
  • Crusader Kings II
  • Crusader Kings II: Charlemagne
  • 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: Sunset Invasion
  • Crusader Kings II: Sword of Islam
  • Dungeonland
  • Europa Universalis III
  • Europa Universalis III Complete
  • Europa Universalis III Complete
  • The Showdown Effect
  • War of the Roses
  • 500k Club
  • Europa Universalis IV: El Dorado
  • Crusader Kings II: Way of Life
  • Humble Paradox Bundle
  • Crusader Kings II: Horse Lords
  • Crusader Kings II: Conclave
  • Stellaris
  • Stellaris: Galaxy Edition
  • Hearts of Iron IV Sign-up
  • Stellaris Sign-up
  • Hearts of Iron IV: Cadet
  • Hearts of Iron IV: Colonel
  • Hearts of Iron IV: Field Marshal
  • Europa Universalis IV: Rights of Man
  • Tyranny: Archon Edition
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Europa Universalis IV: Mandate of Heaven
  • Surviving Mars
  • Hearts of Iron IV: Death or Dishonor
  • Tyranny - Bastards Wound
  • Europa Universalis IV: Cradle of Civilization
Less than 25 lines of script, all in one file! Clean. Efficient. Sleek, even.
Any chance that ship designs will receive a similar treatment?
 

LeSingeAffame

Loyal ally to Durcorach the Black Drake
73 Badges
Sep 16, 2012
3.590
2.277
  • Crusader Kings II
  • Europa Universalis IV
  • Victoria 3 Sign Up
  • Europa Universalis 4: Emperor
  • Crusader Kings III
  • Crusader Kings II: Sword of Islam
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: The Republic
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Horse Lords
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: Conclave
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Way of Life
  • Crusader Kings II: Reapers Due
  • Crusader Kings II: Jade Dragon
  • Crusader Kings II: Monks and Mystics
  • Crusader Kings II: Holy Fury
  • Stellaris
  • Stellaris: Galaxy Edition
  • Stellaris: Galaxy Edition
  • Stellaris: Synthetic Dawn
  • Stellaris: Leviathans Story Pack
  • Stellaris - Path to Destruction bundle
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Distant Stars
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Stellaris: Megacorp
  • Hearts of Iron IV: Expansion Pass
  • Imperator: Rome
  • Imperator: Rome Deluxe Edition
  • Imperator: Rome Sign Up
  • Imperator: Rome - Magna Graecia
So, they disrupted ability to simply add new outcomes to categories without overwrites, because now outcomes are part of category.
We don't know what overwriting behaviour the file will have
It might be possible to add new outcomes in separate files without breaking everything, like for the on_actions
 

LeSingeAffame

Loyal ally to Durcorach the Black Drake
73 Badges
Sep 16, 2012
3.590
2.277
  • Crusader Kings II
  • Europa Universalis IV
  • Victoria 3 Sign Up
  • Europa Universalis 4: Emperor
  • Crusader Kings III
  • Crusader Kings II: Sword of Islam
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: The Republic
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Horse Lords
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: Conclave
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Way of Life
  • Crusader Kings II: Reapers Due
  • Crusader Kings II: Jade Dragon
  • Crusader Kings II: Monks and Mystics
  • Crusader Kings II: Holy Fury
  • Stellaris
  • Stellaris: Galaxy Edition
  • Stellaris: Galaxy Edition
  • Stellaris: Synthetic Dawn
  • Stellaris: Leviathans Story Pack
  • Stellaris - Path to Destruction bundle
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Distant Stars
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Stellaris: Megacorp
  • Hearts of Iron IV: Expansion Pass
  • Imperator: Rome
  • Imperator: Rome Deluxe Edition
  • Imperator: Rome Sign Up
  • Imperator: Rome - Magna Graecia
Considering how many boolean data there is to the file, I highly doubt it would be able to merge.
I don't think it'd be a problem, we can already rewrite some parts of the landed_titles files from CK2 and they can contain quite a bit on information, they may have imported this possibility in Stellaris
 

jazzglands

First Lieutenant
35 Badges
Oct 12, 2015
287
137
  • Crusader Kings II: Charlemagne
  • Stellaris
  • Europa Universalis IV: Mare Nostrum
  • Cities: Skylines - Snowfall
  • Europa Universalis IV: Cossacks
  • Cities: Skylines - After Dark
  • Stellaris: Synthetic Dawn
  • Crusader Kings II
  • Europa Universalis IV: Res Publica
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Art of War
  • Europa Universalis IV
  • Crusader Kings II: Sword of Islam
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: The Republic
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Legacy of Rome
  • Stellaris: Humanoids Species Pack
  • Age of Wonders
  • Age of Wonders III
  • Stellaris - Path to Destruction bundle
  • Stellaris: Apocalypse
  • Stellaris: Leviathans Story Pack
  • Stellaris: Digital Anniversary Edition
  • Europa Universalis IV: Rights of Man
  • Crusader Kings II: Reapers Due
  • Crusader Kings II: Conclave
  • Crusader Kings II: Horse Lords
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Way of Life
  • Europa Universalis IV: El Dorado
  • Cities: Skylines
Will there be some kind of composition or inheritance concept for the new anomaly categories? For example, if there are two definitions of a category with different "on_success" objects, will one overwrite the other, or will the final "on_success" be a union of the members of each? If they're a union, then what would happen if you redefined something with a different weight?
 

Axe99

Ships for Victory
125 Badges
Feb 13, 2003
15.286
11.074
  • Europa Universalis IV
  • Stellaris: Lithoids
  • Stellaris: Federations
  • Crusader Kings III
  • Crusader Kings III: Royal Edition
  • Battle for Bosporus
  • Europa Universalis 4: Emperor
  • Stellaris: Necroids
  • Stellaris: Nemesis
  • Victoria 3 Sign Up
  • Crusader Kings II: The Republic
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Call to arms event
  • For The Glory
  • For the Motherland
  • Hearts of Iron III
  • Hearts of Iron III: Their Finest Hour
  • Heir to the Throne
  • Europa Universalis III Complete
  • Lead and Gold
  • The Kings Crusade
  • Magicka
  • Majesty 2
  • Majesty 2 Collection
  • March of the Eagles
  • Europa Universalis III Complete
  • Europa Universalis IV: Res Publica
  • Victoria: Revolutions
  • Rome Gold
  • Semper Fi
  • Ship Simulator Extremes
  • Sword of the Stars
  • Supreme Ruler 2020
  • Victoria 2
  • Victoria 2: A House Divided
  • Victoria 2: Heart of Darkness
  • Rome: Vae Victis
  • 500k Club
  • Cities: Skylines
  • Europa Universalis IV: El Dorado
  • Europa Universalis IV: Pre-order
  • Pride of Nations
  • Rise of Prussia
  • Crusader Kings II: Way of Life
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Horse Lords
  • Cities: Skylines - After Dark
  • Europa Universalis IV: Cossacks
  • Crusader Kings II: Conclave
Cheers for the bonus DD LordMune :). Not a Stellaris modder m'self, but very much appreciate a more elegant scripting set-up, great work :D.

So, this is an extra and we'll have a bigger Dev Diary today, or is this it until next Thursday?

Regardless, I like this. I don't mod Stellaris but sometimes I want to check something in the script to know how it works and it's currently a pain in the ass to do so.

We will get a stream on Stellaris by Wiz via PDXCon, so I reckon we'll do alright for the week in terms of Stellaris news :).