Stellaris Dev Diary #182 : The Perils of Scripting and How to Avoid Them

  • Crusader Kings II Expansion Subscription

    Subscribe to the CK II Expansion and enjoy unlimited access to 13 major expansions and more!


  • Crusader Kings III Available Now!

    The realm rejoices as Paradox Interactive announces the launch of Crusader Kings III, the latest entry in the publisher’s grand strategy role-playing game franchise. Advisors may now jockey for positions of influence and adversaries should save their schemes for another day, because on this day Crusader Kings III can be purchased on Steam, the Paradox Store, and other major online retailers.


    Real Strategy Requires Cunning

Demos

Recruit
49 Badges
Dec 31, 2016
1
4
  • Ancient Space
  • Stellaris: Synthetic Dawn
  • Pillars of Eternity
  • Sword of the Stars II
  • Magicka
  • Lead and Gold
  • Dungeonland
  • 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
  • Age of Wonders: Planetfall - Revelations
  • Cities: Skylines - Parklife
  • Stellaris: Distant Stars
  • Shadowrun Returns
  • Shadowrun: Dragonfall
  • Cities: Skylines - Parklife Pre-Order
  • Shadowrun: Hong Kong
  • Surviving Mars: First Colony Edition
  • Cities: Skylines Industries
  • Stellaris: Megacorp
  • Surviving Mars: First Colony Edition
  • Cities: Skylines - Campus
  • Stellaris: Ancient Relics
  • Age of Wonders: Planetfall
  • Age of Wonders: Planetfall Deluxe edition
  • Age of Wonders: Planetfall Premium edition
  • Age of Wonders: Planetfall Season pass
  • Stellaris: Lithoids
  • Cities: Skylines - Natural Disasters
  • Crusader Kings II: The Old Gods
  • Cities: Skylines
  • Crusader Kings II: Way of Life
  • Cities: Skylines - After Dark
  • Cities: Skylines - Snowfall
  • Stellaris
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Steel Division: Normandy 44 -  Back to Hell
  • Stellaris - Path to Destruction bundle
  • Steel Division: Normandy 44
  • Cities: Skylines - Mass Transit
  • Surviving Mars
  • Cities: Skylines - Green Cities
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Steel Division: Normand 44 - Second Wave
Static and dynamic analysis can go a long way (think better debugging and profiling tools). It's just ... when you're the only one using a particular scripting system you tend to muddle along with whatever you use to profile the engine itself. Just making it so scripters know when they've done something boneheaded goes a long way, tbh that goes for all programmers.
 
  • 4
Reactions:

Caligula Caesar

Stellaris Technical Scripter
64 Badges
Nov 1, 2014
703
873
  • Europa Universalis III Complete
  • Europa Universalis IV: Res Publica
  • Europa Universalis IV: Third Rome
  • Heir to the Throne
  • 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
  • Divine Wind
  • Europa Universalis III
  • Europa Universalis IV: Pre-order
  • Hearts of Iron IV: Cadet
  • Stellaris: Lithoids
  • Crusader Kings II: Monks and Mystics
  • Hearts of Iron IV: Together for Victory
  • Stellaris: Leviathans Story Pack
  • Stellaris: Digital Anniversary Edition
  • Europa Universalis IV: Rights of Man
  • Europa Universalis IV: Mandate of Heaven
  • Crusader Kings II: Reapers Due
  • Europa Universalis IV: Common Sense
  • Hearts of Iron IV: Death or Dishonor
  • Europa Universalis IV: Dharma
  • Europa Universalis IV: Cradle of Civilization
  • Stellaris: Distant Stars
  • Hearts of Iron IV: Expansion Pass
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Europa Universalis IV: Rule Britannia
  • Cities: Skylines - Parklife Pre-Order
  • Cities: Skylines - Parklife
  • Crusader Kings III
  • Stellaris: Federations
  • Age of Wonders: Planetfall
  • Imperator: Rome Deluxe Edition
  • Crusader Kings II: Holy Fury
  • Crusader Kings III: Royal Edition
  • Europa Universalis IV
  • Europa Universalis III Complete
  • Europa Universalis III Complete
  • Cities: Skylines
  • Europa Universalis IV: El Dorado
  • Crusader Kings II: Way of Life
  • Europa Universalis IV: Golden Century
  • Crusader Kings II: Horse Lords
  • Europa Universalis IV: Cossacks
  • Crusader Kings II: Conclave
  • Stellaris
  • Crusader Kings II: The Republic
  • Crusader Kings II: Rajas of India
"The Perils of Scripting and How to Avoid Them"

Sentence like these, usually show that there is an issue. A underlying asumption that is a dead end: "It works fine, as long as nobody ever makes a mistake."

The asumption that nobody makes a mistake, does not survive success. The easier to use something is or the more popular, the more programmers you get. And the more likely someone will make a mistake. Another rule of programming takes over: Everything that can happen, will happen if something is just used often enough.

"Nobody makes a mistake" is what killed Cooperative Multitasking. It made programmer easier/more accessible, meaning more people made a mistake.
"Nobody makes a mistake" is what killed handling Naked Pointers. And ended up with us having to invent Memory Protection and workarounds to handling Naked Pointers.
I do not think it is going to work here either.

It should not be possible to make a mistake, or at least you should have to go out of your way:
- Taking a worst case scenario like itterating over all empires, every pop: You may want to simply disallow those two to be in the same event. It forces the programmer to fire off a seperate event for each country, wich should allow decent multitasking. Or get's the user not to try that in the first place and look for something more efficient
- You could enforce that flags have to be checked before any other condition in every scope, to allow the more efficient short-circuiting to hit first
- you could disallow the "has_job" limit for count pops scope
- stuff that uses a loop could be capped to 10k itterations or something like that

It may feel a bit restrictive at first. But in the end, 90% of all programming language is there to prevent the programmer (both current and any future one) from making a mistake.

I dunno, that was a title I pulled out of... thin air
Arbitrary restrictions don't feel great, and much as I'd like to pretend pops don't exist, they are such an integral part of the game's scripts and code I can't see them going anywhere soon. So I'm not sure how one could practically disallow doing things that are bad for performance, especially since doing anything once is almost never an issue, it's doing something way too much that's a problem... That said, making there be better error logging for anyone working with Stellaris scripts is something close to my heart and something I work on improving whenever I get the chance
 
  • 6Like
  • 5
  • 1
Reactions:

GnoSIS

Major
20 Badges
Jan 27, 2009
572
913
  • Victoria 2: A House Divided
  • Victoria 2: Heart of Darkness
  • Warlock 2: Wrath of the Nagas
  • Victoria: Revolutions
  • Stellaris - Path to Destruction bundle
  • Stellaris: Necroids
  • Stellaris: Federations
  • Stellaris: Lithoids
  • Stellaris: Ancient Relics
  • Stellaris: Megacorp
  • Stellaris: Distant Stars
  • Stellaris: Apocalypse
  • Stellaris: Humanoids Species Pack
  • Stellaris: Leviathans Story Pack
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Galaxy Edition
  • Stellaris
  • Warlock 2: The Exiled
  • Victoria 2
  • Stellaris: Synthetic Dawn
I dunno, that was a title I pulled out of... thin air
Arbitrary restrictions don't feel great, and much as I'd like to pretend pops don't exist, they are such an integral part of the game's scripts and code I can't see them going anywhere soon. So I'm not sure how one could practically disallow doing things that are bad for performance, especially since doing anything once is almost never an issue, it's doing something way too much that's a problem... That said, making there be better error logging for anyone working with Stellaris scripts is something close to my heart and something I work on improving whenever I get the chance

A performance or profiler tool that would dump some statistics and/or warnings like "warning: script xyz was called 10000 times last game day" would be invaluable.
 
  • 8
  • 4Like
Reactions:

The Founder

Field Marshal
On Probation
55 Badges
Mar 13, 2013
12.860
2.820
  • A Game of Dwarves
  • Stellaris: Synthetic Dawn
  • Sword of the Stars II
  • Crusader Kings II: Sword of Islam
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II
  • Surviving Mars: First Colony Edition
  • Surviving Mars
  • Age of Wonders III
  • Hearts of Iron IV: Expansion Pass
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Surviving Mars: Digital Deluxe Edition
  • Cities: Skylines - Parklife Pre-Order
  • Cities: Skylines - Parklife
  • Stellaris: Distant Stars
  • Shadowrun: Dragonfall
  • Shadowrun: Hong Kong
  • Stellaris: Federations
  • Age of Wonders: Planetfall - Revelations
  • Surviving Mars: First Colony Edition
  • Stellaris: Ancient Relics
  • Age of Wonders: Planetfall
  • Age of Wonders: Planetfall Deluxe edition
  • Age of Wonders: Planetfall Sign Up
  • Stellaris: Lithoids
  • BATTLETECH
  • Europa Universalis IV
  • Crusader Kings III
  • Warlock 2: The Exiled
  • Warlock 2: Wrath of the Nagas
  • Cities: Skylines
  • Stellaris: Necroids
  • Crusader Kings II: Legacy of Rome
  • Europa Universalis IV: Common Sense
  • Stellaris
  • Hearts of Iron IV: Cadet
  • Europa Universalis IV: Rights of Man
  • Major Wiki Contributor
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Hearts of Iron IV: Together for Victory
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Republic
  • Hearts of Iron IV: Death or Dishonor
  • Ancient Space
  • Stellaris: Distant Stars Pre-Order
  • Imperator: Rome
I dunno, that was a title I pulled out of... thin air
Arbitrary restrictions don't feel great, and much as I'd like to pretend pops don't exist, they are such an integral part of the game's scripts and code I can't see them going anywhere soon. So I'm not sure how one could practically disallow doing things that are bad for performance, especially since doing anything once is almost never an issue, it's doing something way too much that's a problem... That said, making there be better error logging for anyone working with Stellaris scripts is something close to my heart and something I work on improving whenever I get the chance
"Arbitrary restrictions don't feel great"
Arbitrary rules such as:
- variable scope
- acessors like private
- strong typisation
- garbage collection memory management
?
Because they used to be arbitrary and "did not feel great" when introduced, but you are hard press to find a modern language without them. Those languages are around 90% those limitations.
Each of those rules have one thing in common: They prevent the programmer from doing *bleep* with the code he was not supposed to do.

"as I'd like to pretend pops don't exist, they are such an integral part of the game's scripts and code I can't see them going anywhere soon"
???
I never said anything about removing pops, so I am not sure what you are arguing against here?
I talked about forcefully seperating "all country" and "all pop" calls. Because combining them is a mistake that is entirely to impactfull - and way to easy to do.

"That said, making there be better error logging for anyone working with Stellaris scripts is something close to my heart and something I work on improving whenever I get the chance"
I would say: Less logging, more crashing. Expecting every modder to look in the error log after every update is a classical example for "expecting nobody to ever make a mistake". It will not happen. Bad code will continue.
Exceptions are for things that should not be ignored. Do not hide them, but slap them in the modders face. If the game stops working when it hits faulty code, that is pretty hard to ignore.
 
  • 5
Reactions:

Pachakamaq

Sergeant
41 Badges
Sep 2, 2011
59
32
  • Europa Universalis III: Chronicles
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Res Publica
  • Sword of the Stars II
  • Surviving Mars
  • Stellaris: Necroids
  • Hearts of Iron IV: Death or Dishonor
  • Hearts of Iron IV: Expansion Pass
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Surviving Mars: Digital Deluxe Edition
  • Stellaris: Distant Stars
  • Shadowrun: Dragonfall
  • Shadowrun: Hong Kong
  • Surviving Mars: First Colony Edition
  • Surviving Mars: First Colony Edition
  • Stellaris: Lithoids
  • Stellaris: Federations
  • Hearts of Iron IV: Together for Victory
  • Stellaris: Leviathans Story Pack
  • Stellaris: Digital Anniversary Edition
  • Europa Universalis IV
  • 500k Club
  • Tyranny: Archon Edition
  • Tyranny: Archon Edition
  • Hearts of Iron IV: Cadet
  • Stellaris Sign-up
  • Stellaris
  • Europa Universalis IV: Common Sense
  • Pillars of Eternity
  • Europa Universalis IV: El Dorado
  • Darkest Hour
  • Stellaris: Ancient Relics
  • Cities: Skylines
  • Hearts of Iron IV: Expansion Pass
  • Stellaris: Megacorp
  • Tyranny - Tales from the Tiers
  • Stellaris: Synthetic Dawn
  • Stellaris - Path to Destruction bundle
Weird. I set my start date to 1 and have since 1.9 without ill effect.

Consider yourself lucky! I still have nightmares from launching the game 10x times in a row, trying in vain to find out why I'm not allowed to share this mod online, or the Day All My Factions Went Away or the day when the mod just stopped working at all and only changing the relevant text file directly would work...

Eventually, I just gave up. Nowadays, if I want a game with custom start dates, I pull out Space Empires V again.
 

Eios

Private
14 Badges
Jan 30, 2019
19
88
  • Crusader Kings II
  • Stellaris
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Stellaris - Path to Destruction bundle
  • Age of Wonders III
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Stellaris: Distant Stars
  • Stellaris: Megacorp
  • Stellaris: Ancient Relics
  • Stellaris: Lithoids
  • Stellaris: Federations
  • Stellaris: Synthetic Dawn
Another weird thing that is connected to the game date is the autosave deletion function. Usually the oldest autosave files get deleted, but when you set the game date to year 1 for example, they all clog up and stop you from saving your game.
 
  • 1Like
  • 1
Reactions:

The Founder

Field Marshal
On Probation
55 Badges
Mar 13, 2013
12.860
2.820
  • A Game of Dwarves
  • Stellaris: Synthetic Dawn
  • Sword of the Stars II
  • Crusader Kings II: Sword of Islam
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II
  • Surviving Mars: First Colony Edition
  • Surviving Mars
  • Age of Wonders III
  • Hearts of Iron IV: Expansion Pass
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Surviving Mars: Digital Deluxe Edition
  • Cities: Skylines - Parklife Pre-Order
  • Cities: Skylines - Parklife
  • Stellaris: Distant Stars
  • Shadowrun: Dragonfall
  • Shadowrun: Hong Kong
  • Stellaris: Federations
  • Age of Wonders: Planetfall - Revelations
  • Surviving Mars: First Colony Edition
  • Stellaris: Ancient Relics
  • Age of Wonders: Planetfall
  • Age of Wonders: Planetfall Deluxe edition
  • Age of Wonders: Planetfall Sign Up
  • Stellaris: Lithoids
  • BATTLETECH
  • Europa Universalis IV
  • Crusader Kings III
  • Warlock 2: The Exiled
  • Warlock 2: Wrath of the Nagas
  • Cities: Skylines
  • Stellaris: Necroids
  • Crusader Kings II: Legacy of Rome
  • Europa Universalis IV: Common Sense
  • Stellaris
  • Hearts of Iron IV: Cadet
  • Europa Universalis IV: Rights of Man
  • Major Wiki Contributor
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Hearts of Iron IV: Together for Victory
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Republic
  • Hearts of Iron IV: Death or Dishonor
  • Ancient Space
  • Stellaris: Distant Stars Pre-Order
  • Imperator: Rome
Weird. I set my start date to 1 and have since 1.9 without ill effect.
Consider yourself lucky! I still have nightmares from launching the game 10x times in a row, trying in vain to find out why I'm not allowed to share this mod online, or the Day All My Factions Went Away or the day when the mod just stopped working at all and only changing the relevant text file directly would work...

Eventually, I just gave up. Nowadays, if I want a game with custom start dates, I pull out Space Empires V again.
Another weird thing that is connected to the game date is the autosave deletion function. Usually the oldest autosave files get deleted, but when you set the game date to year 1 for example, they all clog up and stop you from saving your game.
I think I saw specific dates ages ago in the files. But nowadays everything is "years since game start" or something else more reliable.

What you want to do is change the Start Date offset (START_YEAR in defines). With that one you got some hope of it not breaking everything.
And if it still breaks, that sounds like a case for a bug report. Because clearly some code is not working as it should :)
 
  • 1Like
  • 1
Reactions:

WanderTrue

Recruit
Apr 15, 2018
1
2
Anything that needs you to calculate or recalculate pathfinding (e.g. can_access_system trigger, creating new hyperlanes, especially creating new systems)

Its funny you use both can_access_system and pathfinding as examples.

I have a sad tale to tell about these.

I was working on a mod awhile ago that tried to use both of these, but I ended up giving up in frustration and never publishing the mod, because it did not appear to be possible to use Paradox's scopes/conditions to do what I wanted.

Here's what I was trying to do:
- Allow you to break up a large empire into smaller ones by seizing chokepoints and cutting a section of it off from its capital.
- To do that, for each country, identify all systems that are NOT reachable by the empire's ships starting from its capital.
- This has to account for all forms of travel, including hyperlanes, wormholes, gateways, L-gates, and even jump drives.

Here's what I found:
-"can_access_system" is utterly useless, as it always returns TRUE for systems in your borders. Yes, even tiny disconnected 1-system enclaves surrounded by your rivals.
-"has_hyperlane_to" is very limited as well, as it only considers hyperlanes, it doesn't consider any other method of travel.

Here's what I ended up doing:
- If empire has jumpdrive tech, or any gateway within their borders, then calculating what is in fact reachable is impossible via scopes/conditions, so just give up and treat everything as reachable for them. This was the big limitation which made me end up killing the idea of publishing the mod.
- Otherwise:
-- Set a flag on the empire's home system.
-- Loop through all of the empire's systems. If they are connected to any system with a flag (via hyperlane), they also gain the flag.
-- Repeat the above loop until a loop completes with no new systems gaining the flag. Yes, this can mean for a big empire you're potentially looping over every system they own (and every hyperlane that system has), hundreds of times. No, there truly wasn't any other way to do this that I was able to find.
-- For every system owned by the empire which does NOT have the flag, it joins the "split off" new empire.

Obviously, this solution was a performance nightmare. Even breaking it up into separate events meant that an evaluation of reachable space could take a long time to complete, for large empires. Which meant that changes to what is reachable (say, taking a system) might create waves of recalculation that were also time-consuming.

Anyway, I ended up giving up on the mod, because of the limitations specifically of "can_access_system" and "has_hyperlane_to".

Basically, what I needed was a scope like:

empires_systems_not_reachable_from_capital {}

but given that nothing in the base game (as far as I know) uses a scope/condition/etc that affects unreachable systems in your empire... and given how much of a pain pathfinding is, I figured Paradox would never add it.
 
  • 2
Reactions:

SeekingEtermity

Lt. General
33 Badges
Dec 14, 2018
1.212
807
  • Pillars of Eternity
  • Stellaris: Federations
  • Stellaris: Lithoids
  • Stellaris: Ancient Relics
  • Stellaris: Megacorp
  • Shadowrun: Hong Kong
  • Stellaris: Distant Stars
  • Stellaris: Apocalypse
  • Stellaris: Humanoids Species Pack
  • Age of Wonders III
  • Surviving Mars
  • Stellaris - Path to Destruction bundle
  • Stellaris: Leviathans Story Pack
  • Stellaris: Digital Anniversary Edition
  • Stellaris
  • Ancient Space
  • Europa Universalis III: Collection
  • Hearts of Iron III: Their Finest Hour
  • Cities in Motion 2
  • Crusader Kings II
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Sons of Abraham
  • Europa Universalis III
  • Divine Wind
  • For the Motherland
  • Hearts of Iron III
  • Stellaris: Synthetic Dawn
  • Hearts of Iron III Collection
  • Heir to the Throne
  • Magicka
  • Majesty 2 Collection
  • Semper Fi
  • Magicka 2
Its funny you use both can_access_system and pathfinding as examples.

I have a sad tale to tell about these.

I was working on a mod awhile ago that tried to use both of these, but I ended up giving up in frustration and never publishing the mod, because it did not appear to be possible to use Paradox's scopes/conditions to do what I wanted.

Here's what I was trying to do:
- Allow you to break up a large empire into smaller ones by seizing chokepoints and cutting a section of it off from its capital.
- To do that, for each country, identify all systems that are NOT reachable by the empire's ships starting from its capital.
- This has to account for all forms of travel, including hyperlanes, wormholes, gateways, L-gates, and even jump drives.

Here's what I found:
-"can_access_system" is utterly useless, as it always returns TRUE for systems in your borders. Yes, even tiny disconnected 1-system enclaves surrounded by your rivals.
-"has_hyperlane_to" is very limited as well, as it only considers hyperlanes, it doesn't consider any other method of travel.

Here's what I ended up doing:
- If empire has jumpdrive tech, or any gateway within their borders, then calculating what is in fact reachable is impossible via scopes/conditions, so just give up and treat everything as reachable for them. This was the big limitation which made me end up killing the idea of publishing the mod.
- Otherwise:
-- Set a flag on the empire's home system.
-- Loop through all of the empire's systems. If they are connected to any system with a flag (via hyperlane), they also gain the flag.
-- Repeat the above loop until a loop completes with no new systems gaining the flag. Yes, this can mean for a big empire you're potentially looping over every system they own (and every hyperlane that system has), hundreds of times. No, there truly wasn't any other way to do this that I was able to find.
-- For every system owned by the empire which does NOT have the flag, it joins the "split off" new empire.

Obviously, this solution was a performance nightmare. Even breaking it up into separate events meant that an evaluation of reachable space could take a long time to complete, for large empires. Which meant that changes to what is reachable (say, taking a system) might create waves of recalculation that were also time-consuming.

Anyway, I ended up giving up on the mod, because of the limitations specifically of "can_access_system" and "has_hyperlane_to".

Basically, what I needed was a scope like:

empires_systems_not_reachable_from_capital {}

but given that nothing in the base game (as far as I know) uses a scope/condition/etc that affects unreachable systems in your empire... and given how much of a pain pathfinding is, I figured Paradox would never add it.
There's only one system I'm aware of in Stellaris that would treat an isolated system as truly "cut off", and that's trade routes. For everything else, there's a way to get there. For example, you can upgrade the starbase, set it as the "home port" of a fleet, and then hit the "return home" button. It'll say "Hey, no hyperlane route, wanna go MIA for a bit and arrive there anyhow?" and you can just say "sure" and do that.

The new reinforcement mechanism *might* also care - the exact conditions under which it does and doesn't let the MIA ships arrive are unclear to me - but most other things don't. Ships forced into MIA by closed borders can reappear in cut-off systems. Science ships with speculative hyperlane breaching can use that. I'm not sure if there's any way to force construction or colony ships there without manipulating starbase positions in potentially-impractical ways - they don't get "home systems" and just go to a nearby starbase when you hit "return home" - but you can build those if you've got a starbase there (with a shipyard) and they're interchangeable. Finally, of course, if you have gateway construction then there's no way to force a system to stay cut off; worst case it needs to upgrade the outpost to a starbase, build a shipyard, build a construction ship, and then build the gateway there (and possibly you'd also need to build one somewhere else, if you no longer have access to any).
 
  • 1
Reactions:

Voidster

Sergeant
35 Badges
Oct 29, 2011
63
2
  • Sword of the Stars
  • Sword of the Stars II
  • Leviathan: Warships
  • Stellaris: Synthetic Dawn
  • Stellaris: Galaxy Edition
  • Stellaris
  • Stellaris: Megacorp
  • Stellaris: Apocalypse
  • Surviving Mars: Digital Deluxe Edition
  • Cities: Skylines - Parklife Pre-Order
  • Cities: Skylines - Parklife
  • Stellaris: Distant Stars
  • Surviving Mars: First Colony Edition
  • Cities: Skylines Industries
  • Surviving Mars
  • Prison Architect
  • Surviving Mars: First Colony Edition
  • Cities: Skylines - Campus
  • Stellaris: Ancient Relics
  • Age of Wonders: Planetfall
  • Stellaris: Lithoids
  • Stellaris: Humanoids Species Pack
  • Cities: Skylines - Green Cities
  • Cities: Skylines - Mass Transit
  • Stellaris - Path to Destruction bundle
  • Cities: Skylines - Natural Disasters
  • Stellaris: Leviathans Story Pack
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Galaxy Edition
  • Cities: Skylines - Snowfall
  • Cities: Skylines - After Dark
  • 500k Club
  • Teleglitch: Die More Edition
  • Magicka
  • Cities: Skylines
As a simple player, not a coder or such, im absolutely sick and tired the crashes. Im no longer supporting people on patron, and removed all mods. I have yet to actually complete a game, due to late game lag/crashes and bugs. Sick of it all.
 
  • 2
  • 1Like
  • 1
Reactions:

Innomion

Recruit
18 Badges
Aug 23, 2019
5
8
  • Age of Wonders
  • Stellaris: Necroids
  • Stellaris: Federations
  • Stellaris: Lithoids
  • Stellaris: Ancient Relics
  • Stellaris: Megacorp
  • Stellaris: Apocalypse
  • Stellaris: Humanoids Species Pack
  • War of the Roses
  • Age of Wonders III
  • Stellaris - Path to Destruction bundle
  • Stellaris: Leviathans Story Pack
  • Stellaris: Digital Anniversary Edition
  • Stellaris
  • Magicka 2
  • Pillars of Eternity
  • Stellaris: Synthetic Dawn
  • Stellaris: Distant Stars
As a simple player, not a coder or such, im absolutely sick and tired the crashes. Im no longer supporting people on patron, and removed all mods. I have yet to actually complete a game, due to late game lag/crashes and bugs. Sick of it all.
You're free to do as you like. Just let me tell you that there's no way for a modder to make a mod immune to crashes. You can do everything perfectly, with no mistakes, but if another mod overwrites a file/event/etc you're using - that's it, you're potentially screwed. This is the reason no one should overwrite vanilla content, if they don't have to, as it leads to conflicts.
Of course that does not excuse poor coding on our part as there's plenty of bugs in many mods. But as a modder we can't beta test as much as professional QA, so we're essentially hoping it works as we tried it, and that players report anything that didn't, so that we can fix it for everybody else.
That's never not going to lead to some people having a crash (or just the mod not doing exactly what it promised to), especially so for long mod lists. But it's the only way to get anywhere consistently.
 
  • 4
  • 1Like
Reactions:

GnoSIS

Major
20 Badges
Jan 27, 2009
572
913
  • Victoria 2: A House Divided
  • Victoria 2: Heart of Darkness
  • Warlock 2: Wrath of the Nagas
  • Victoria: Revolutions
  • Stellaris - Path to Destruction bundle
  • Stellaris: Necroids
  • Stellaris: Federations
  • Stellaris: Lithoids
  • Stellaris: Ancient Relics
  • Stellaris: Megacorp
  • Stellaris: Distant Stars
  • Stellaris: Apocalypse
  • Stellaris: Humanoids Species Pack
  • Stellaris: Leviathans Story Pack
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Galaxy Edition
  • Stellaris
  • Warlock 2: The Exiled
  • Victoria 2
  • Stellaris: Synthetic Dawn
You're free to do as you like. Just let me tell you that there's no way for a modder to make a mod immune to crashes. You can do everything perfectly, with no mistakes, but if another mod overwrites a file/event/etc you're using - that's it, you're potentially screwed. This is the reason no one should overwrite vanilla content, if they don't have to, as it leads to conflicts.
Of course that does not excuse poor coding on our part as there's plenty of bugs in many mods. But as a modder we can't beta test as much as professional QA, so we're essentially hoping it works as we tried it, and that players report anything that didn't, so that we can fix it for everybody else.
That's never not going to lead to some people having a crash (or just the mod not doing exactly what it promised to), especially so for long mod lists. But it's the only way to get anywhere consistently.

While I agree with you, there's a balance to be had here. The engine doesn't produce a list of files that were modified to raise a warning and perhaps even an error when 2 mods attempt to overwrite the same built in files, it silently accepts everything, as if that is the right thing to do - it never is!
 

CrazyJ

Colonel
25 Badges
Nov 26, 2018
1.084
2.314
  • Stellaris: Galaxy Edition
  • Cities: Skylines Deluxe Edition
  • Age of Wonders: Planetfall
  • Hearts of Iron IV: Cadet
  • Surviving Mars: Digital Deluxe Edition
  • Prison Architect
  • Stellaris: Distant Stars
  • Stellaris: Humanoids Species Pack
  • Surviving Mars
  • Stellaris - Path to Destruction bundle
  • Stellaris: Leviathans Story Pack
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Synthetic Dawn
  • Stellaris: Ancient Relics
  • Surviving Mars: First Colony Edition
  • Age of Wonders: Planetfall - Revelations
  • Stellaris: Lithoids
  • Stellaris: Apocalypse
  • Stellaris: Federations
  • Stellaris: Necroids
  • Stellaris: Megacorp
i don't know much about modding but a simple tool that checks all of the game's files and tells you what's being modified could be a massive help with mod compatability issues. i have no idea if such a thing is even possible though, and it definitely sounds like something that would take a while to run. perhaps a button that you can press in the launcher that compares the game's files with a copy stored on a server somewhere and notes any differences? that sounds like it could work
 
Last edited:
  • 1Like
Reactions:

The Founder

Field Marshal
On Probation
55 Badges
Mar 13, 2013
12.860
2.820
  • A Game of Dwarves
  • Stellaris: Synthetic Dawn
  • Sword of the Stars II
  • Crusader Kings II: Sword of Islam
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II
  • Surviving Mars: First Colony Edition
  • Surviving Mars
  • Age of Wonders III
  • Hearts of Iron IV: Expansion Pass
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Surviving Mars: Digital Deluxe Edition
  • Cities: Skylines - Parklife Pre-Order
  • Cities: Skylines - Parklife
  • Stellaris: Distant Stars
  • Shadowrun: Dragonfall
  • Shadowrun: Hong Kong
  • Stellaris: Federations
  • Age of Wonders: Planetfall - Revelations
  • Surviving Mars: First Colony Edition
  • Stellaris: Ancient Relics
  • Age of Wonders: Planetfall
  • Age of Wonders: Planetfall Deluxe edition
  • Age of Wonders: Planetfall Sign Up
  • Stellaris: Lithoids
  • BATTLETECH
  • Europa Universalis IV
  • Crusader Kings III
  • Warlock 2: The Exiled
  • Warlock 2: Wrath of the Nagas
  • Cities: Skylines
  • Stellaris: Necroids
  • Crusader Kings II: Legacy of Rome
  • Europa Universalis IV: Common Sense
  • Stellaris
  • Hearts of Iron IV: Cadet
  • Europa Universalis IV: Rights of Man
  • Major Wiki Contributor
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Hearts of Iron IV: Together for Victory
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Republic
  • Hearts of Iron IV: Death or Dishonor
  • Ancient Space
  • Stellaris: Distant Stars Pre-Order
  • Imperator: Rome
Here's what I was trying to do:
- Allow you to break up a large empire into smaller ones by seizing chokepoints and cutting a section of it off from its capital.
- To do that, for each country, identify all systems that are NOT reachable by the empire's ships starting from its capital.
- This has to account for all forms of travel, including hyperlanes, wormholes, gateways, L-gates, and even jump drives.
Obviously, this solution was a performance nightmare. Even breaking it up into separate events meant that an evaluation of reachable space could take a long time to complete, for large empires. Which meant that changes to what is reachable (say, taking a system) might create waves of recalculation that were also time-consuming.
Your issue is that you try to include Jump Drives. Jump Drives are a pathfinding nightmare. They require a circular colission check. From every single reachable System in the Empire.
If you cut them out (as they are not a reliable or cost free form of travel), that problem would be easily solved. And efficiently.

You could also somewhat speed it up, by making the tagging process a background one. Something that processes one System per day/game tick, rather then trying to do the entire network at once.

empires_systems_not_reachable_from_capital {}
And since it would have to check for Jump Drives on every already reachable System, it would be the kind of computational nightmare no programmer would be mad enough to add or make avalible for modders.

This is a prime example of a bad idea.

While I agree with you, there's a balance to be had here. The engine doesn't produce a list of files that were modified to raise a warning and perhaps even an error when 2 mods attempt to overwrite the same built in files, it silently accepts everything, as if that is the right thing to do - it never is!
i don't know much about modding but a simple tool that checks all of the game's files and tells you what's being modified could be a massive help with mod compatability issues. i have no idea if such a thing is even possible though, and it definitely sounds like something that would take a while to run. perhaps a button that you can press in the launcher that compares the game's files with a copy stored on a server somewhere and notes any differences? that sounds like it could work
IIRC, the Logfiles on start do contain warnings is something that was already defined, has been overwritten. It is the best time to check that, as it is literally the code that parses the base and mod files.

But there is the problem as I pointed it out before:
It says so in the logfile.
It should be the kind of message the user is given on starting the game (or that should even block the start of the game), on top of the logfile.

There is timidness in their willingness to raise errors in a way the user and mod designer can not ignore. This timidness must be removed. The only way to get good mods, is to not hide mistakes from the mod maker. Or user.
 
  • 1
Reactions:

akeean

Second Lieutenant
36 Badges
May 26, 2014
126
11
  • Crusader Kings II
  • Stellaris - Path to Destruction bundle
  • BATTLETECH: Flashpoint
  • Surviving Mars: First Colony Edition
  • Shadowrun Returns
  • Stellaris: Distant Stars
  • Cities: Skylines - Parklife
  • Cities: Skylines - Parklife Pre-Order
  • Surviving Mars: Digital Deluxe Edition
  • Stellaris: Apocalypse
  • Stellaris: Humanoids Species Pack
  • Age of Wonders III
  • Surviving Mars
  • BATTLETECH
  • Crusader Kings Complete
  • Stellaris: Leviathans Story Pack
  • Stellaris: Digital Anniversary Edition
  • Stellaris
  • Crusader Kings II: Horse Lords
  • Stellaris: Megacorp
  • Cities: Skylines
  • Surviving Mars: First Colony Edition
  • Europa Universalis IV
  • BATTLETECH: Season pass
  • Stellaris: Lithoids
  • Stellaris: Federations
  • Stellaris: Necroids
  • Stellaris: Synthetic Dawn
  • Stellaris: Ancient Relics
  • Cities: Skylines Deluxe Edition
  • Magicka
  • 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: Legacy of Rome
Excellent tips for script optimization there, I know that I'll be coming back to this post for reference!

Basically, we were playing dev MP on a reasonably large galaxy and reached reasonably late into the game, and since we were all working remotely on wildly varying computers and internet connection speeds

So what do you all do while in the save game transfer phase? :D

It's insane how long that takes even on gigabit fiber over a long distance (i.e 40MB unzipped savegame with 150ms ping&no packet loss between host&client taking 5-10 minutes).

Does it like... transfer each variable in the session over a single TCP/IP connection?

Here is hoping that with the team working & testing remotely, some long standing issues in regards to multiplayer will start to be addressed.

Like the game automatically slowing down sim speed and notifying the host if a client can't keep up instead of just DCing when a heavy event triggers and in turn forcing everyone in the session to stop what they are doing wait 10 minutes for the potato client hot joining.
 

akeean

Second Lieutenant
36 Badges
May 26, 2014
126
11
  • Crusader Kings II
  • Stellaris - Path to Destruction bundle
  • BATTLETECH: Flashpoint
  • Surviving Mars: First Colony Edition
  • Shadowrun Returns
  • Stellaris: Distant Stars
  • Cities: Skylines - Parklife
  • Cities: Skylines - Parklife Pre-Order
  • Surviving Mars: Digital Deluxe Edition
  • Stellaris: Apocalypse
  • Stellaris: Humanoids Species Pack
  • Age of Wonders III
  • Surviving Mars
  • BATTLETECH
  • Crusader Kings Complete
  • Stellaris: Leviathans Story Pack
  • Stellaris: Digital Anniversary Edition
  • Stellaris
  • Crusader Kings II: Horse Lords
  • Stellaris: Megacorp
  • Cities: Skylines
  • Surviving Mars: First Colony Edition
  • Europa Universalis IV
  • BATTLETECH: Season pass
  • Stellaris: Lithoids
  • Stellaris: Federations
  • Stellaris: Necroids
  • Stellaris: Synthetic Dawn
  • Stellaris: Ancient Relics
  • Cities: Skylines Deluxe Edition
  • Magicka
  • 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: Legacy of Rome
a button that you can press in the launcher that compares the game's files with a copy stored on a server somewhere and notes any differences? that sounds like it could work

The launcher team is separate from the Stellaris dev team. Shareable modlists (that include load order, activation & indication of missing/stale mods) are still a much needed, but missing feature for that launcher.
 

curtegg

Corporal
18 Badges
Nov 8, 2018
41
1
  • Crusader Kings II: Monks and Mystics
  • Stellaris: Lithoids
  • Stellaris: Ancient Relics
  • Stellaris: Megacorp
  • Stellaris: Distant Stars
  • Stellaris: Apocalypse
  • Stellaris: Humanoids Species Pack
  • Stellaris - Path to Destruction bundle
  • Stellaris: Leviathans Story Pack
  • Stellaris: Digital Anniversary Edition
  • Stellaris
  • Cities: Skylines - After Dark
  • Crusader Kings II: Way of Life
  • Cities: Skylines
  • Crusader Kings II
  • Stellaris: Synthetic Dawn
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Charlemagne
What about the horrible mod load times before you even start a game? It has dramatically lengthen since 2.8.
 

Koopatin

First Lieutenant
94 Badges
Jan 10, 2016
277
514
  • Rome: Vae Victis
  • Leviathan: Warships
  • Magicka
  • Europa Universalis IV: Res Publica
  • Victoria: Revolutions
  • Cities in Motion 2
  • Sengoku
  • Sword of the Stars
  • Victoria 2
  • Victoria 2: A House Divided
  • Victoria 2: Heart of Darkness
  • Rome Gold
  • Warlock: Master of the Arcane
  • Cities: Skylines Deluxe Edition
  • Europa Universalis IV: Pre-order
  • Cities: Skylines - After Dark
  • Europa Universalis IV: Cossacks
  • Stellaris: Synthetic Dawn
  • Stellaris: Galaxy Edition
  • Europa Universalis IV: Third Rome
  • Crusader Kings II: Reapers Due
  • Hearts of Iron III
  • Crusader Kings II
  • 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
  • Darkest Hour
  • Dungeonland
  • Europa Universalis III: Chronicles
  • Heir to the Throne
  • 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
  • Divine Wind
  • Europa Universalis III
  • Europa Universalis IV: El Dorado
  • Supreme Ruler 2020
  • Crusader Kings II: Way of Life
  • Pillars of Eternity
  • Europa Universalis IV: Common Sense
  • Europa Universalis IV
  • The Showdown Effect
  • Cities: Skylines
  • Stellaris
  • Stellaris: Galaxy Edition
i thought about pops. would it be an option, at least from a performance side to have a maximum amount of "real" pops on a planet. lets say 50 and after that every new born pop would be a % modifier on planet production? pop 50+12 "fake" pops would be 50 plus 12% production or something like that.

and maybe habitats ould be a max of 4 for example or just a base production and % modifier etc.

that is just some brainstorming of course.. the slave market alone would make some problems with that or raiding for pops because that should not steal "fake" pops. and make them real... so more checks...

i just thought.. would that even help
 
  • 4
Reactions:

Pyzayt

Captain
14 Badges
Aug 5, 2019
348
219
  • Cities: Skylines
  • Stellaris
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Stellaris - Path to Destruction bundle
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Stellaris: Distant Stars
  • Stellaris: Megacorp
  • Stellaris: Ancient Relics
  • Stellaris: Lithoids
  • Stellaris: Federations
  • Stellaris: Necroids
  • Stellaris: Synthetic Dawn
i thought about pops. would it be an option, at least from a performance side to have a maximum amount of "real" pops on a planet. lets say 50 and after that every new born pop would be a % modifier on planet production? pop 50+12 "fake" pops would be 50 plus 12% production or something like that.

and maybe habitats ould be a max of 4 for example or just a base production and % modifier etc.

that is just some brainstorming of course.. the slave market alone would make some problems with that or raiding for pops because that should not steal "fake" pops. and make them real... so more checks...

i just thought.. would that even help

At that point, you might as well make all pops an abstract concept and just have it be an increasing variable that determines everything else through just maths and percentages. If you're going to make some pops "fake", you might as well make all of them "fake" and use a system that doesn't track individuals beyond "X pops, of Y species with Z modifier" all as simple sets of numbers.