Anatomy of a Game: Startup and Loading

Meneth

Crusader Kings 3 Programmer
128 Badges
Feb 9, 2011
10.056
5.367
www.paradoxwikis.com
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Holy Knight (pre-order)
  • Crusader Kings II
  • Crusader Kings II: Sword of Islam
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: The Republic
  • Teleglitch: Die More Edition
  • Crusader Kings II: Conclave
  • Hearts of Iron IV Sign-up
  • Surviving Mars
  • Stellaris: Galaxy Edition
  • 500k Club
  • Hearts of Iron IV: Colonel
  • Europa Universalis IV: El Dorado
  • Europa Universalis IV: Cradle of Civilization
  • Magicka: Wizard Wars Founder Wizard
  • Mount & Blade: Warband
  • Mount & Blade: With Fire and Sword
  • Crusader Kings II: Way of Life
  • Stellaris: Digital Anniversary Edition
  • Hearts of Iron IV: Death or Dishonor
  • Hearts of Iron IV: Field Marshal
  • Age of Wonders III
  • Europa Universalis III Complete
  • Crusader Kings II: The Old Gods
  • Hearts of Iron IV: Cadet
  • Steel Division: Normand 44 Sign-up
  • Crusader Kings Complete
  • Europa Universalis IV
  • Hearts of Iron IV: Expansion Pass
  • Hearts of Iron IV: Expansion Pass
  • Cities: Skylines - Parklife
  • Prison Architect
  • Stellaris: Leviathans Story Pack
  • Crusader Kings II: Reapers Due
  • Stellaris Sign-up
  • Europa Universalis III Complete
  • Europa Universalis IV: Mandate of Heaven
  • Europa Universalis IV: Rule Britannia
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: Charlemagne
  • Magicka 2 - Signup Campaign
  • Knights of Pen and Paper 2
  • Europa Universalis IV: Mare Nostrum
  • Knights of Honor
  • Deus Vult
  • Victoria 2: A House Divided
  • Victoria 2: Heart of Darkness
You really do not want to use debug builds while playing the game, or using any software for that matter. Debug builds might have some "additional" feature compared to release builds ( marked in c++ code with something like #ifdef DEBUG) but usually there aren't many of those. That kind of "features" are usually there to overcome some limitation of your environment, when you want some special behavior during debug. But during debug you usually want your application to behave as closer as possible to how it would actually behave.

What debug build is mostly adding additional information so execution of certain part of the code can be recognized and displayed in debugger.

For example somewhere in code you can have something like this:
Code:
auto a = 1;
auto b = a;//and after this a not used anymore in rest of the code
auto c = b;//and after this b not used anymore in rest of the code
auto d = c;//and after this c not used anymore in rest of the code
auto e = d;//and after this d not used anymore in rest of the code
auto f = e;//and after this e not used anymore in rest of the code
// now do something with f
// you will not have this example in real code, I am just showing it as example to explain what can be optimised
In release build, compiler can say, I do not need a, b, c, d, e variables anywhere, so I will replace all of this with auto f = 1; This is much faster and used much less memory. But in debug build that replacement is never done. In debug mode, you want to see when variable a get value of 1, then variable b etc. You want to know when any of those lines are executed.

Of course this is absurd example, you will never write this kind of code. But there are much more subtle optimization, where code is reduced and speed up during building release. This is just extreme example to show the point.

So if you are using software, and you are not trying to figure out why it is not working properly, you always want to use release build, and not debug build.

And about differences between "-debug_mode" and enabeling it ingame via a gui mod, I would say that there are some additional differences. File watchers are for sure attached on load time, so you will not probably have that feature with gui mod. And maybe some logging is turned on as well. I cannot come up with more ideas what "-debug_mode" can have more then gui mod. But all of that, if any additional feature exists, must be related to that flag being present during load time. And all of these are not features related to debug build, but to debug mod in release build.
To add to that, here's an actual hands-on example from CK3.
Here is the info available when I pause the execution of the game during a function that deals with handling all the data for making a frame in a Release build.
1626509590310.png

1626509599560.png

Around half the variables are just completely gone. 4 separate functions in the callstack are gone too (the ones marked "Inline Frame").
Trying to debug this is hell, so we basically only do that if there's a crash on a Release build that we have no way of reproducing on a Debug build.
In a Debug build, none of this would be gone, making my life as a programmer way easier.
 
  • 11
  • 2Like
Reactions:

magsthereal

Recruit
11 Badges
Jul 16, 2021
2
0
  • Cities in Motion 2
  • Crusader Kings II
  • Europa Universalis IV
  • Cities: Skylines
  • Mount & Blade: With Fire and Sword
  • Stellaris: Digital Anniversary Edition
  • Age of Wonders III
  • Imperator: Rome Deluxe Edition
  • Imperator: Rome
  • Imperator: Rome - Magna Graecia
  • Crusader Kings III
And about differences between "-debug_mode" and enabeling it ingame via a gui mod, I would say that there are some additional differences. File watchers are for sure attached on load time, so you will not probably have that feature with gui mod. And maybe some logging is turned on as well. I cannot come up with more ideas what "-debug_mode" can have more then gui mod. But all of that, if any additional feature exists, must be related to that flag being present during load time. And all of these are not features related to debug build, but to debug mod in release build.
That's what I figured aswell, hence why i asked to clarify
 

G S Palmer

Lt. General
57 Badges
Jan 20, 2019
1.249
1.329
  • Stellaris: Necroids
  • Crusader Kings III
  • Victoria 3 Sign Up
  • Stellaris: Nemesis
  • Crusader Kings II
  • Crusader Kings II: Jade Dragon
  • Crusader Kings II: Horse Lords
  • Crusader Kings II: Conclave
  • Crusader Kings II: Holy Fury
  • Crusader Kings II: Reapers Due
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Way of Life
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: The Republic
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sword of Islam
  • Crusader Kings II: Monks and Mystics
  • Stellaris
  • Stellaris: Galaxy Edition
  • Stellaris: Apocalypse
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Distant Stars
  • Stellaris: Megacorp
  • Stellaris: Federations
  • Stellaris: Ancient Relics
  • Stellaris: Lithoids
  • Stellaris: Leviathans Story Pack
  • Stellaris: Humanoids Species Pack
  • Stellaris: Synthetic Dawn
  • Stellaris - Path to Destruction bundle
  • Imperator: Rome
  • Imperator: Rome Deluxe Edition
  • Surviving Mars
  • Surviving Mars: First Colony Edition
  • Surviving Mars: First Colony Edition
  • Age of Wonders III
  • BATTLETECH - Digital Deluxe Edition
  • BATTLETECH: Season pass
  • BATTLETECH: Heavy Metal
  • Age of Wonders: Planetfall
  • Age of Wonders: Planetfall - Revelations
  • Europa Universalis IV
  • Europa Universalis IV: Rights of Man
  • Europa Universalis IV: Common Sense
  • Europa Universalis IV: Art of War
  • Victoria 2
  • Victoria 2: A House Divided
I'm curious how the system you've set up where events, localization, and some other files can be reloaded while in game when modding works.
 

blackninja9939

Experienced Programmer - Crusader Kings 3
77 Badges
Aug 28, 2013
2.369
6.249
  • Crusader Kings III
  • Stellaris: Federations
  • Battle for Bosporus
  • Stellaris: Nemesis
  • Stellaris: Necroids
  • Europa Universalis IV
  • Crusader Kings III: Royal Edition
  • Europa Universalis 4: Emperor
  • Crusader Kings II
  • Crusader Kings II: Holy Fury
  • Imperator: Rome - Magna Graecia
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: The Old Gods
  • Europa Universalis IV: Rights of Man
  • Europa Universalis IV: Cradle of Civilization
  • Stellaris: Synthetic Dawn
  • Surviving Mars
  • BATTLETECH
  • Europa Universalis IV: Mandate of Heaven
  • Crusader Kings II: Monks and Mystics
  • Tyranny: Archon Edition
  • Europa Universalis IV: Rule Britannia
  • Crusader Kings II: Reapers Due
  • Hearts of Iron IV: Colonel
  • Stellaris Sign-up
  • Hearts of Iron IV: Expansion Pass
  • Stellaris: Apocalypse
  • Stellaris: Lithoids
  • Stellaris: Distant Stars
  • Europa Universalis IV: Dharma
  • Shadowrun Returns
  • Imperator: Rome Deluxe Edition
  • Prison Architect
  • Imperator: Rome Sign Up
  • Stellaris: Ancient Relics
  • Age of Wonders: Planetfall
  • Crusader Kings II: Conclave
  • Crusader Kings II: The Republic
  • Victoria 2
  • Cities: Skylines
  • Europa Universalis IV: El Dorado
  • Crusader Kings II: Way of Life
  • Stellaris
  • Mount & Blade: Warband
  • Crusader Kings II: Horse Lords
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Legacy of Rome
You really do not want to use debug builds while playing the game, or using any software for that matter. Debug builds might have some "additional" feature compared to release builds ( marked in c++ code with something like #ifdef DEBUG) but usually there aren't many of those. That kind of "features" are usually there to overcome some limitation of your environment, when you want some special behavior during debug. But during debug you usually want your application to behave as closer as possible to how it would actually behave.

What debug build is mostly adding additional information so execution of certain part of the code can be recognized and displayed in debugger.

For example somewhere in code you can have something like this:
Code:
auto a = 1;
auto b = a;//and after this a not used anymore in rest of the code
auto c = b;//and after this b not used anymore in rest of the code
auto d = c;//and after this c not used anymore in rest of the code
auto e = d;//and after this d not used anymore in rest of the code
auto f = e;//and after this e not used anymore in rest of the code
// now do something with f
// you will not have this example in real code, I am just showing it as example to explain what can be optimised
In release build, compiler can say, I do not need a, b, c, d, e variables anywhere, so I will replace all of this with auto f = 1; This is much faster and used much less memory. But in debug build that replacement is never done. In debug mode, you want to see when variable a get value of 1, then variable b etc. You want to know when any of those lines are executed.

Of course this is absurd example, you will never write this kind of code. But there are much more subtle optimization, where code is reduced and speed up during building release. This is just extreme example to show the point.

So if you are using software, and you are not trying to figure out why it is not working properly, you always want to use release build, and not debug build.

And about differences between "-debug_mode" and enabeling it ingame via a gui mod, I would say that there are some additional differences. File watchers are for sure attached on load time, so you will not probably have that feature with gui mod. And maybe some logging is turned on as well. I cannot come up with more ideas what "-debug_mode" can have more then gui mod. But all of that, if any additional feature exists, must be related to that flag being present during load time. And all of these are not features related to debug build, but to debug mod in release build.
Very good summary, thanks for your post!

Your guess about the command line vs console command for debug mode is also mostly spot on, it just turns it on sooner so anything needing debug mode to be active during load happens. Such as attaching file watchers and doing extra logging during that time before you’d be in game with the UI setup to turn on debug mode then.
 
  • 4
Reactions:

blackninja9939

Experienced Programmer - Crusader Kings 3
77 Badges
Aug 28, 2013
2.369
6.249
  • Crusader Kings III
  • Stellaris: Federations
  • Battle for Bosporus
  • Stellaris: Nemesis
  • Stellaris: Necroids
  • Europa Universalis IV
  • Crusader Kings III: Royal Edition
  • Europa Universalis 4: Emperor
  • Crusader Kings II
  • Crusader Kings II: Holy Fury
  • Imperator: Rome - Magna Graecia
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: The Old Gods
  • Europa Universalis IV: Rights of Man
  • Europa Universalis IV: Cradle of Civilization
  • Stellaris: Synthetic Dawn
  • Surviving Mars
  • BATTLETECH
  • Europa Universalis IV: Mandate of Heaven
  • Crusader Kings II: Monks and Mystics
  • Tyranny: Archon Edition
  • Europa Universalis IV: Rule Britannia
  • Crusader Kings II: Reapers Due
  • Hearts of Iron IV: Colonel
  • Stellaris Sign-up
  • Hearts of Iron IV: Expansion Pass
  • Stellaris: Apocalypse
  • Stellaris: Lithoids
  • Stellaris: Distant Stars
  • Europa Universalis IV: Dharma
  • Shadowrun Returns
  • Imperator: Rome Deluxe Edition
  • Prison Architect
  • Imperator: Rome Sign Up
  • Stellaris: Ancient Relics
  • Age of Wonders: Planetfall
  • Crusader Kings II: Conclave
  • Crusader Kings II: The Republic
  • Victoria 2
  • Cities: Skylines
  • Europa Universalis IV: El Dorado
  • Crusader Kings II: Way of Life
  • Stellaris
  • Mount & Blade: Warband
  • Crusader Kings II: Horse Lords
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Legacy of Rome
I'm curious how the system you've set up where events, localization, and some other files can be reloaded while in game when modding works.
We have a system of file watcher set up where we use platform specific functionality wrapped into a unified interface to be notified about changes to a file path.

When it’s changed it notifies the database that then reload its, reloading is just destroying what is already there as then re-reading in the new data. To ensure that we don’t cause issues with our databases leaving dangling pointers around of things using it we destroy and recreate the data in the same memory location.

So code who are storing and using some trait from the databases for example don’t ever know that the trait has changed, just the next time they try to get the modifier a trait applies for instance then they’ll see the new values and use them.
 
  • 5
Reactions:

Keizer Harm

Swamp German
40 Badges
Jan 28, 2013
2.704
3.906
  • Crusader Kings III: Royal Edition
  • Crusader Kings II: Sunset Invasion
  • Victoria 2
and recreate the data in the same memory location.
Will I cause a segfault if I hotload a change that replaces a one-liner script value with a 300 line formula that uses every database in the game?
 

Meneth

Crusader Kings 3 Programmer
128 Badges
Feb 9, 2011
10.056
5.367
www.paradoxwikis.com
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Holy Knight (pre-order)
  • Crusader Kings II
  • Crusader Kings II: Sword of Islam
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: The Republic
  • Teleglitch: Die More Edition
  • Crusader Kings II: Conclave
  • Hearts of Iron IV Sign-up
  • Surviving Mars
  • Stellaris: Galaxy Edition
  • 500k Club
  • Hearts of Iron IV: Colonel
  • Europa Universalis IV: El Dorado
  • Europa Universalis IV: Cradle of Civilization
  • Magicka: Wizard Wars Founder Wizard
  • Mount & Blade: Warband
  • Mount & Blade: With Fire and Sword
  • Crusader Kings II: Way of Life
  • Stellaris: Digital Anniversary Edition
  • Hearts of Iron IV: Death or Dishonor
  • Hearts of Iron IV: Field Marshal
  • Age of Wonders III
  • Europa Universalis III Complete
  • Crusader Kings II: The Old Gods
  • Hearts of Iron IV: Cadet
  • Steel Division: Normand 44 Sign-up
  • Crusader Kings Complete
  • Europa Universalis IV
  • Hearts of Iron IV: Expansion Pass
  • Hearts of Iron IV: Expansion Pass
  • Cities: Skylines - Parklife
  • Prison Architect
  • Stellaris: Leviathans Story Pack
  • Crusader Kings II: Reapers Due
  • Stellaris Sign-up
  • Europa Universalis III Complete
  • Europa Universalis IV: Mandate of Heaven
  • Europa Universalis IV: Rule Britannia
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: Charlemagne
  • Magicka 2 - Signup Campaign
  • Knights of Pen and Paper 2
  • Europa Universalis IV: Mare Nostrum
  • Knights of Honor
  • Deus Vult
  • Victoria 2: A House Divided
  • Victoria 2: Heart of Darkness
Will I cause a segfault if I hotload a change that replaces a one-liner script value with a 300 line formula that uses every database in the game?
Probably not. But also please don't do that.

The bit of memory reused is the statically sized part of the database object, so you using more dynamically sized memory shouldn't really affect anything.
 
  • 2Like
  • 1
Reactions:

Ondolindë

Private
87 Badges
Jan 27, 2020
24
49
  • Crusader Kings II: Charlemagne
  • Prison Architect
  • Stellaris: Nemesis
  • Stellaris: Necroids
  • Victoria 2
  • Empire of Sin
  • Prison Architect: Psych Ward
  • Island Bound
  • Europa Universalis 4: Emperor
  • Battle for Bosporus
  • Crusader Kings III
  • Imperator: Rome - Magna Graecia
  • Stellaris: Federations
  • Age of Wonders: Planetfall - Revelations
  • Age of Wonders: Planetfall Season pass
  • Age of Wonders: Planetfall Premium edition
  • Age of Wonders: Planetfall Deluxe edition
  • Age of Wonders: Planetfall
  • Surviving Mars: First Colony Edition
  • Crusader Kings II: Holy Fury
  • Crusader Kings II: Jade Dragon
  • Crusader Kings II: Monks and Mystics
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sunset Invasion
  • Europa Universalis IV
  • Surviving Mars: Digital Deluxe Edition
  • Europa Universalis IV: Third Rome
  • Age of Wonders III
  • Europa Universalis IV: Rule Britannia
  • Stellaris: Apocalypse
  • Stellaris: Humanoids Species Pack
  • Hearts of Iron IV: Expansion Pass
  • Europa Universalis IV: Cradle of Civilization
  • Cities: Skylines - Green Cities
  • Cities: Skylines - Parklife
  • Stellaris: Synthetic Dawn
  • Hearts of Iron IV: Death or Dishonor
  • Surviving Mars
  • Europa Universalis IV: Mandate of Heaven
  • Cities: Skylines - Mass Transit
  • Stellaris - Path to Destruction bundle
  • Stellaris: Distant Stars
  • Europa Universalis IV: Dharma
  • Surviving Mars: First Colony Edition
  • Cities: Skylines Industries
  • Stellaris: Megacorp
  • Europa Universalis IV: Golden Century
  • Imperator: Rome Deluxe Edition
  • Imperator: Rome
I really enjoyed your post. It actually was an easy read and it gave me the basic understanding of what goes behind the game. I appreciate things like this because it is not only interesting to learn new things, but that you took the time.
 
Last edited:
  • 1
Reactions:

Cryoshakespeare

Second Lieutenant
54 Badges
May 19, 2015
170
128
  • Crusader Kings II: Charlemagne
  • Europa Universalis IV: Mare Nostrum
  • Victoria 2: Heart of Darkness
  • Victoria 2: A House Divided
  • 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: Call to arms event
  • Europa Universalis IV: Conquest of Paradise
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Europa Universalis IV: Wealth of Nations
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sword of Islam
  • Crusader Kings II
  • Europa Universalis IV: Art of War
  • Stellaris: Leviathans Story Pack
  • Crusader Kings II: Monks and Mystics
  • Stellaris - Path to Destruction bundle
  • Cities: Skylines - Mass Transit
  • Crusader Kings III
  • Crusader Kings II: Holy Fury
  • Cities: Skylines - Green Cities
  • Crusader Kings II: Jade Dragon
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Cities: Skylines - Parklife
  • Stellaris: Distant Stars
  • Europa Universalis IV: Dharma
  • Cities: Skylines Industries
  • Stellaris: Megacorp
  • Stellaris: Digital Anniversary Edition
  • Tyranny: Archon Edition
  • Europa Universalis IV: Rights of Man
  • Crusader Kings II: Reapers Due
  • Stellaris
  • Crusader Kings II: Conclave
  • Europa Universalis IV: Cossacks
  • Cities: Skylines - After Dark
  • Crusader Kings II: Horse Lords
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Way of Life
  • Europa Universalis IV: El Dorado
  • Cities: Skylines
  • Victoria 2
Yeah, just wanted to chime in and say this really was fascinating! As someone only beginning to get into programming, the level of knowledge and experience at play to understand and work these systems is a bit daunting, but on the other hand your explanation of the higher level flow really makes it quite digestible.

Without knowing enough to ask a super precise question, I was curious as to how modding functions were translated from the game's base code to paradox script. Is the language at either end comparable, or are things really mutated a lot? And what sort of checks go into the process of adding some new functionality to the language, is security a big concern?
 
  • 1
  • 1Like
Reactions:

blackninja9939

Experienced Programmer - Crusader Kings 3
77 Badges
Aug 28, 2013
2.369
6.249
  • Crusader Kings III
  • Stellaris: Federations
  • Battle for Bosporus
  • Stellaris: Nemesis
  • Stellaris: Necroids
  • Europa Universalis IV
  • Crusader Kings III: Royal Edition
  • Europa Universalis 4: Emperor
  • Crusader Kings II
  • Crusader Kings II: Holy Fury
  • Imperator: Rome - Magna Graecia
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: The Old Gods
  • Europa Universalis IV: Rights of Man
  • Europa Universalis IV: Cradle of Civilization
  • Stellaris: Synthetic Dawn
  • Surviving Mars
  • BATTLETECH
  • Europa Universalis IV: Mandate of Heaven
  • Crusader Kings II: Monks and Mystics
  • Tyranny: Archon Edition
  • Europa Universalis IV: Rule Britannia
  • Crusader Kings II: Reapers Due
  • Hearts of Iron IV: Colonel
  • Stellaris Sign-up
  • Hearts of Iron IV: Expansion Pass
  • Stellaris: Apocalypse
  • Stellaris: Lithoids
  • Stellaris: Distant Stars
  • Europa Universalis IV: Dharma
  • Shadowrun Returns
  • Imperator: Rome Deluxe Edition
  • Prison Architect
  • Imperator: Rome Sign Up
  • Stellaris: Ancient Relics
  • Age of Wonders: Planetfall
  • Crusader Kings II: Conclave
  • Crusader Kings II: The Republic
  • Victoria 2
  • Cities: Skylines
  • Europa Universalis IV: El Dorado
  • Crusader Kings II: Way of Life
  • Stellaris
  • Mount & Blade: Warband
  • Crusader Kings II: Horse Lords
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Legacy of Rome
Yeah, just wanted to chime in and say this really was fascinating! As someone only beginning to get into programming, the level of knowledge and experience at play to understand and work these systems is a bit daunting, but on the other hand your explanation of the higher level flow really makes it quite digestible.

Without knowing enough to ask a super precise question, I was curious as to how modding functions were translated from the game's base code to paradox script. Is the language at either end comparable, or are things really mutated a lot? And what sort of checks go into the process of adding some new functionality to the language, is security a big concern?
Glad you found it interesting! I definitely get the daunting nature of it, when I started learning programming a few years ago it seemed so huge and that there was so much stuff there. But the upside is that you only need to learn a little bit every day or week before you get to a critical mass of being able to code something fairly decently, and from there you can learn and refine and discover more things as you go!

I'll not answer this question too much for now because the script system as a whole is one of my planned future posts, but the highest level gist of it is that we read in the files and translate them into the objects in code for triggers and effects based on the key and store any other values need, so when it sees gold > 500 it knows to make an instance of the gold trigger and store the value 500. Every trigger and effect then knows what to do with its store data when we evaluate/execute it or build a tooltip for it. At run time we have a context that we pass through that tree to evaluate/execute something for the given character so it knows what value of gold it needs to compare against 500 for instance.
 
  • 4Like
  • 3
Reactions:

contentand

Recruit
Mar 17, 2020
5
2
Thanks for the article. I love the behind-the-scenes topics :)

Now I understand why my EU4 loads like a blitz when on Linux.
I wish the Microsoft team did something about this loading-many-small-files-takes-forever issue.
 

Chatoustikmou

Major
83 Badges
May 21, 2016
601
940
  • Crusader Kings II: Charlemagne
  • Stellaris: Synthetic Dawn
  • Europa Universalis IV: Third Rome
  • Europa Universalis IV: Mandate of Heaven
  • Cities: Skylines - Mass Transit
  • Stellaris - Path to Destruction bundle
  • Tyranny: Archon Edition
  • Europa Universalis IV: Rights of Man
  • Stellaris: Galaxy Edition
  • Stellaris: Galaxy Edition
  • Crusader Kings II: Jade Dragon
  • Europa Universalis IV: Mare Nostrum
  • Cities: Skylines - Snowfall
  • Europa Universalis IV: Cossacks
  • Cities: Skylines - After Dark
  • Magicka 2
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II
  • Crusader Kings II: Sons of Abraham
  • Cities: Skylines Deluxe Edition
  • 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: Sword of Islam
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Art of War
  • Cities: Skylines - Natural Disasters
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Hearts of Iron IV: Cadet
  • Crusader Kings II: Monks and Mystics
  • Surviving Mars
  • Hearts of Iron IV: Death or Dishonor
  • Cities: Skylines - Green Cities
  • Crusader Kings II: Reapers Due
  • Hearts of Iron IV: Field Marshal
  • Hearts of Iron IV: Colonel
  • Europa Universalis IV
  • Stellaris: Galaxy Edition
  • Crusader Kings II: Conclave
  • Stellaris: Nemesis
  • Hearts of Iron IV: Expansion Pass
  • Crusader Kings II: Horse Lords
  • Europa Universalis IV: Common Sense
  • Cities: Skylines
  • Pillars of Eternity
  • Crusader Kings II: Way of Life
  • Europa Universalis IV: Pre-order
In case you didn't plan a post on it already, I'm interested to learn more about desync, and what goes into the multiplayer side of things.

Also I'd love to know more about the organisationnal aspect of your work. Like how are things prioritized, how is time allocated, how much of you and your team's time is spent actually coding vs other stuff (meetings, testing and such)? How much of that is for New Things, for bug fixing, for mod support?

As it happens, there's a programing school right where I live and work, and I know quite a few people who attended there. They learn coding skills, but I feel like they don't really learn project management, how to handle an efficient workflow as a team, and so forth.
 

mcmanusaur

Colonel
2 Badges
Sep 1, 2013
1.124
828
  • Europa Universalis IV
  • Stellaris
I'm just a Python prototyping guy, but big respect to the actual developers who have the chops for these kinds of complicated engineering problems! This post was extremely informative, thanks! Looking forward to more.
 
  • 1Like
Reactions:

BrotherJonathan

Petty King of Washington
48 Badges
Jun 15, 2015
591
736
  • Victoria 3 Sign Up
  • Battle for Bosporus
  • Surviving Mars
  • Crusader Kings III
  • Europa Universalis IV
  • Victoria 2
  • Victoria 2: A House Divided
  • Victoria 2: Heart of Darkness
  • Europa Universalis IV: Art of War
  • Crusader Kings II
  • Crusader Kings II: Reapers Due
  • Crusader Kings II: Way of Life
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Conclave
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: Monks and Mystics
  • Crusader Kings II: Holy Fury
  • Crusader Kings II: Sword of Islam
  • Knights of Honor
  • Steel Division: Normandy 44
  • Steel Division: Normand 44 - Second Wave
  • Steel Division: Normandy 44 Deluxe Edition
  • Europa Universalis IV: Rule Britannia
  • Europa Universalis IV: Common Sense
  • Europa Universalis IV: Rights of Man
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Mandate of Heaven
  • Europa Universalis IV: Dharma
  • Hearts of Iron IV: Expansion Pass
  • Hearts of Iron IV: La Resistance
  • Hearts of Iron IV: Death or Dishonor
  • Hearts of Iron IV: Expansion Pass
  • Hearts of Iron IV: Together for Victory
  • Hearts of Iron IV: Cadet
  • Hearts of Iron IV: Colonel
  • Hearts of Iron IV: Expansion Pass
I have no idea what half of this even means, but it is interesting. I say keep these coming.
 
  • 1Like
  • 1
Reactions:

blackninja9939

Experienced Programmer - Crusader Kings 3
77 Badges
Aug 28, 2013
2.369
6.249
  • Crusader Kings III
  • Stellaris: Federations
  • Battle for Bosporus
  • Stellaris: Nemesis
  • Stellaris: Necroids
  • Europa Universalis IV
  • Crusader Kings III: Royal Edition
  • Europa Universalis 4: Emperor
  • Crusader Kings II
  • Crusader Kings II: Holy Fury
  • Imperator: Rome - Magna Graecia
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: The Old Gods
  • Europa Universalis IV: Rights of Man
  • Europa Universalis IV: Cradle of Civilization
  • Stellaris: Synthetic Dawn
  • Surviving Mars
  • BATTLETECH
  • Europa Universalis IV: Mandate of Heaven
  • Crusader Kings II: Monks and Mystics
  • Tyranny: Archon Edition
  • Europa Universalis IV: Rule Britannia
  • Crusader Kings II: Reapers Due
  • Hearts of Iron IV: Colonel
  • Stellaris Sign-up
  • Hearts of Iron IV: Expansion Pass
  • Stellaris: Apocalypse
  • Stellaris: Lithoids
  • Stellaris: Distant Stars
  • Europa Universalis IV: Dharma
  • Shadowrun Returns
  • Imperator: Rome Deluxe Edition
  • Prison Architect
  • Imperator: Rome Sign Up
  • Stellaris: Ancient Relics
  • Age of Wonders: Planetfall
  • Crusader Kings II: Conclave
  • Crusader Kings II: The Republic
  • Victoria 2
  • Cities: Skylines
  • Europa Universalis IV: El Dorado
  • Crusader Kings II: Way of Life
  • Stellaris
  • Mount & Blade: Warband
  • Crusader Kings II: Horse Lords
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Legacy of Rome
In case you didn't plan a post on it already, I'm interested to learn more about desync, and what goes into the multiplayer side of things.

Also I'd love to know more about the organisationnal aspect of your work. Like how are things prioritized, how is time allocated, how much of you and your team's time is spent actually coding vs other stuff (meetings, testing and such)? How much of that is for New Things, for bug fixing, for mod support?

As it happens, there's a programing school right where I live and work, and I know quite a few people who attended there. They learn coding skills, but I feel like they don't really learn project management, how to handle an efficient workflow as a team, and so forth.
I’ll note that down as an idea for a future one!
 
  • 6Like
  • 1
Reactions:

Meneth

Crusader Kings 3 Programmer
128 Badges
Feb 9, 2011
10.056
5.367
www.paradoxwikis.com
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Holy Knight (pre-order)
  • Crusader Kings II
  • Crusader Kings II: Sword of Islam
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: The Republic
  • Teleglitch: Die More Edition
  • Crusader Kings II: Conclave
  • Hearts of Iron IV Sign-up
  • Surviving Mars
  • Stellaris: Galaxy Edition
  • 500k Club
  • Hearts of Iron IV: Colonel
  • Europa Universalis IV: El Dorado
  • Europa Universalis IV: Cradle of Civilization
  • Magicka: Wizard Wars Founder Wizard
  • Mount & Blade: Warband
  • Mount & Blade: With Fire and Sword
  • Crusader Kings II: Way of Life
  • Stellaris: Digital Anniversary Edition
  • Hearts of Iron IV: Death or Dishonor
  • Hearts of Iron IV: Field Marshal
  • Age of Wonders III
  • Europa Universalis III Complete
  • Crusader Kings II: The Old Gods
  • Hearts of Iron IV: Cadet
  • Steel Division: Normand 44 Sign-up
  • Crusader Kings Complete
  • Europa Universalis IV
  • Hearts of Iron IV: Expansion Pass
  • Hearts of Iron IV: Expansion Pass
  • Cities: Skylines - Parklife
  • Prison Architect
  • Stellaris: Leviathans Story Pack
  • Crusader Kings II: Reapers Due
  • Stellaris Sign-up
  • Europa Universalis III Complete
  • Europa Universalis IV: Mandate of Heaven
  • Europa Universalis IV: Rule Britannia
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: Charlemagne
  • Magicka 2 - Signup Campaign
  • Knights of Pen and Paper 2
  • Europa Universalis IV: Mare Nostrum
  • Knights of Honor
  • Deus Vult
  • Victoria 2: A House Divided
  • Victoria 2: Heart of Darkness
  • 7
Reactions:

Viridianus

Major
40 Badges
Feb 12, 2017
645
818
  • Crusader Kings II
  • Pillars of Eternity
  • Surviving Mars
  • Imperator: Rome Deluxe Edition
  • Europa Universalis IV
  • Imperator: Rome
  • Crusader Kings II: The Republic
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sword of Islam
  • Crusader Kings II: Horse Lords
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Way of Life
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Conclave
  • Crusader Kings II: Reapers Due
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Monks and Mystics
  • Crusader Kings II: Jade Dragon
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: Holy Fury
  • Crusader Kings III
  • Tyranny: Archon Edition
  • Stellaris
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Stellaris - Path to Destruction bundle
  • Europa Universalis IV: Mandate of Heaven
  • Europa Universalis IV: Cradle of Civilization
  • Europa Universalis IV: Rule Britannia
  • Europa Universalis IV: Common Sense
  • Europa Universalis IV: El Dorado
  • Europa Universalis IV: Cossacks
  • Europa Universalis IV: Third Rome
  • Europa Universalis IV: Res Publica
  • Europa Universalis IV: Rights of Man
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Mare Nostrum
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Art of War
1)The long arrow from CLifeStyleDatabase to NModifier::SDynamicModifiersForTerrainAndGovernmentTypeDependency is frightening.
2)I always have the longest load screens (because I tend not to close the browser in the background) so the main theme is properly heard... for a good ten to twenty minutes, I can make some tea listening to it ;)
3)Is the fact that you now create new game via creating a save game the reason either for the fact you can't switch the year after you chose it once in CK3 (unlike CK2 where you could do that) or for the fact that back in CK2 switching back and forth through the time created some bugs? (Or for both)
 
  • 1Like
Reactions:

blackninja9939

Experienced Programmer - Crusader Kings 3
77 Badges
Aug 28, 2013
2.369
6.249
  • Crusader Kings III
  • Stellaris: Federations
  • Battle for Bosporus
  • Stellaris: Nemesis
  • Stellaris: Necroids
  • Europa Universalis IV
  • Crusader Kings III: Royal Edition
  • Europa Universalis 4: Emperor
  • Crusader Kings II
  • Crusader Kings II: Holy Fury
  • Imperator: Rome - Magna Graecia
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: The Old Gods
  • Europa Universalis IV: Rights of Man
  • Europa Universalis IV: Cradle of Civilization
  • Stellaris: Synthetic Dawn
  • Surviving Mars
  • BATTLETECH
  • Europa Universalis IV: Mandate of Heaven
  • Crusader Kings II: Monks and Mystics
  • Tyranny: Archon Edition
  • Europa Universalis IV: Rule Britannia
  • Crusader Kings II: Reapers Due
  • Hearts of Iron IV: Colonel
  • Stellaris Sign-up
  • Hearts of Iron IV: Expansion Pass
  • Stellaris: Apocalypse
  • Stellaris: Lithoids
  • Stellaris: Distant Stars
  • Europa Universalis IV: Dharma
  • Shadowrun Returns
  • Imperator: Rome Deluxe Edition
  • Prison Architect
  • Imperator: Rome Sign Up
  • Stellaris: Ancient Relics
  • Age of Wonders: Planetfall
  • Crusader Kings II: Conclave
  • Crusader Kings II: The Republic
  • Victoria 2
  • Cities: Skylines
  • Europa Universalis IV: El Dorado
  • Crusader Kings II: Way of Life
  • Stellaris
  • Mount & Blade: Warband
  • Crusader Kings II: Horse Lords
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Legacy of Rome
1)The long arrow from CLifeStyleDatabase to NModifier::SDynamicModifiersForTerrainAndGovernmentTypeDependency is frightening.
2)I always have the longest load screens (because I tend not to close the browser in the background) so the main theme is properly heard... for a good ten to twenty minutes, I can make some tea listening to it ;)
3)Is the fact that you now create new game via creating a save game the reason either for the fact you can't switch the year after you chose it once in CK3 (unlike CK2 where you could do that) or for the fact that back in CK2 switching back and forth through the time created some bugs? (Or for both)
  1. It isn't toooo bad, the graph makes it look a lot more pain than it is, it all loads quite quickly now
  2. I also would think for that load time you're on a HDD which is a lot lot slower than an SSD
  3. General simplicity really (so a bit of both your points), the switching dates back and forth was always a bit buggy as it meant we need to have a game state we could modify and undo changes to per day and also just a maintenance nightmare of supporting every single date to in theory be playable despite the fact that nobody ever played outside the main start dates really. Makes it so that we can differentiate between has a game state and does not very clear cut and once we've got the game state that is the save we are using and data we have to pick characters or have someone join in an MP game.
 
  • 4
Reactions: