"Radical ethics" for single-issue factions and internal politics.

  • We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.
Right now they don't lol, all AI fields are set to a weight of 0 (never use). For now I'm just building this all out so it works, later I'll go back and add AI_weights (for chances to trigger a faction activity, like suppression or assassination) and AI_chance values (for choices in events)

AI logic is entirely built out of base chances and conditionals that make it picking one option over the other more or less likely (e.g. the AI will always try and pick something unless its an exterminator, then it will never pick it) So in my above event I could attach a chance to the AI picking an option being 100% (if it has enough influence otherwise abort) as the actual decision making is done a step "back" a the factional level where the AI decides what action it ought to take by random-weight picking from the selection of valid actions I've given it.

E.g. if the AI doesn't have police state it wont be able to pick "Police Raids", but if it does have it, that choice could have 2-3x the weight on it (so 2-3x the relative chance of getting chosen) vs say assassination - whilst at the same time assassination could have a higher chance of being chosen if they also have cutthroat politics (and then the game re-scales all factors to equate to 100% and picks according to the proportional chance)... if that all makes sense?

Or think of it like randomly selecting a sector on a pie chart, the fatter the sector, the more chance you have of landing on it, and doing the action associated therein (which may itself lead to another sector with more choices). That is literally all the AI is in Stellaris - a decision tree (tbf that's all it is in most applications too).
View attachment 658456View attachment 658457
Yeah.
I often helped testing Glavius' AI mod and helping answering questions of users (relaying them and getting relatively technical answers from Glavius). when he was active and was exposed to a lot of how the AI functions. That's why I ask about AI every chance I get.

In any case, this looks promising.
 
Yeah.
I often helped testing Glavius' AI mod and helping answering questions of users (relaying them and getting relatively technical answers from Glavius). when he was active and was exposed to a lot of how the AI functions. That's why I ask about AI every chance I get.

In any case, this looks promising.
Ah interesting. I'm not sure how Glavius worked but currently I am leaning towards not using ai personalities as modifier hooks (as AI personalities always feel a bit clunky whenever I do anything with them) -- rather I'm considering tying everything [faction attraction, event options, spawn chances & AI decisions] back to just ethics and specific civics or maybe some other empire condition (has tradition X, building Y etc)
  • This does mean extra civic mods would have dubious compatibility... but most of them are an unbalanced, albeit interesting, mess anyway lol.
 
  • 2Like
  • 1Haha
Reactions:
i hate it so much that the first thing i think about in stellaris is not "wow what a great idea (and it is)" but how much will that cripple tha AI and how bad will they handle that. :/
 
I've - at fking last - figured out how to spawn empire leaders which do not cost you anything and dont appear in the leader UI, i'm not 100% sure how i've done this though lol, but will figure it out. Plan to use this as the base for an "Nth" type of leader (like how envoy is its own thing) that essentially act as VIPs, or faces in events / just ruling factions - OR standing for election [but cant be a governor, general, admiral or envoy, consumes no upkeep costs].
Screenshot (4421).png
No leaders & in the background no envoy called Mil tal Yag
Screenshot (4422).png
Here we see, somehow, the slave faction is now run by the enigmatic "DEFAULT_FREEMAN" Mil tal Yag (i have an event triggering a custom spawn for a custom_class faction leader - might change this to pick the slave species rather than the primary one, but that could cause other issues with ruler rights that might cause CTDs - unless I make them unelectable)
Screenshot (4423).png
And he can stand for elections (top left candidate) my current ruler is top right, and the game always generates spare candidates if there arent enough - or its supposed to anyway.
1607142127648.png
Rags to riches - former slave becomes CEO

And if I then force another election (as a test), making someone else CEO, he stops being ruler and remains hidden from the leader lists but is now classed as a scientist (oddly).

This last bit isn't too important, I plan to write up an event that makes a Populist (that'll probably be the localised-name for this class - when i figure out where its localisation string is kept) "Retire from politics" after a single term, provided emancipation was achieved in office [need to look into mandates/agendas - populists should only get emancipation, and ideally a force-spawned ruler trait "Populist" that down-weights the AI selecting them for oligarchy/MCs (is this even possible? Need more reading) and riles up slaves or triggers a emancipation ultimatum - to really encourage you to not let emancipation factions win elections lol ].

Alongside this, it means I can now event-spawn and assassinate leaders as-needed. E.g. I could spawn in a "Conduit" class of machine leaders to be used for events related to a "proto-networked-intelligence uprising" faction (think legions role with the Geth in Mass effect), or a "Comrade" class leader for a Communalist faction. In a civil war these would split off and become the ruler of the new revolutionary empire.

Oh and been experimenting with Photoshop effects to more-or-less copy the faction icon art-style
1607142500596.png

Getting closer, but needs more work.

Edit: now with localisation
1607145704686.png
1607147170042.png
 
Last edited:
  • 7Like
Reactions:
Ive recently been playing around with an internal politics mod too, I wonder if ours could play off of each other in some way? I've been implementing a full election system for democracies, along with the requirement to form essentially coalition governments out of the factions running for election.


[...]

Obviously there is still a lot of work left to do yet, modding the UI can be a real pain.
Are you using Agendas at all in your mod?

I've spent the last 3 hours trying to get one to work, trying every loophole I can think of with them, and my god the sheer amount of spaghetti code that must exist behind the oligarchic/dictatorial election system is just bloody awful.

I'd planned to add agendas to populists to emancipate (then have them stand down if that gets passed) but it's not worth the headache lol. It seems the adgendas.txt file is based on old old stellaris practices, it doesn't support sequential files/enumeration, like how defines does, for example, You've got to overwrite the thing wholesale, and 90% of the time custom agendas wont spawn for me even if they should, like the game has some weird hidden internal index set up to fetch them, beyond the exposed weights. Not touched mandates (democratic one) but a quick skim of the wiki at least indicates they're a little more customisable.

It's also worth noting - for anyone whose modding elections - that these on_actions ONLY work for democratic elections - not for oligarchic/dictatorial ones:
Code:
# Called when an election starts
# scope: country
on_election_started = {
}

# Called when an election ends
# scope: country
on_election_ended = {
}
I spent way too long scratching my head over that crap wondering if i'd missed a bracket or a scope that the error log wasnt picking up, but nope it wont fire an error as it doesnt see oligarchic elections as... elections. Total. Spaghetti. Code.

Anyway got what i wanted to do working in the end via traits at the same time as the party leader is created (or re-made in some situations).

Emancipationist rulers (and down the line other rulers will get their own perks as appropriate) spawn with a special ruler perk, if elected slaves gain +300% PP (might increase this further to 400 or 500%, see stab effect below, 300% still isnt enough to incite empire-wide riots lol)
1607227431178.png


1607227607873.png
slave PP with a populist leader in power
1607227229315.png
slave pp with a populist leader in power AND a slave-processing centre on the world.
base_pop_pp*(stratum PP reduction = -75% for slaves)*(1+[300%pp_increase from my new trait-25% pp from slave processing centre])
1.0 *(1-0.75)* (1+[3.00-0.25]) = 0.9375


PP calculations are a hell of a drug. Even when slaves outnumber masters 2-1 and have 0% happiness AND have +300%(3x) PP, this still isn't enough to make a world dip into <50% stability [let alone the <40% for some events to fire) Planet stability is so absurdly balanced in stellaris, you have to be lobotomised to trigger a riot lol.

Now lets look at that worlds stability again but jack up the ruler perk from +300%(3x) to +500%(5x) slave PP.

33 slaves : 15 free masters (2.2:1 ratio, not bad could be better a good slave world might have 3+x slaves to masters).
+5x slave pp causes stability to drop from 57% to 41%
1607228371355.png
1607228224078.png
1607228204031.png


Maybe I should go for broke and just make it +1000% PP for slaves, seeing as this is going to be such a rare event. I essentially want it to be that if a populist comes to power (unhappy) slaves get very rowdy very fast, and within 6m you get an ultimatum (the ultimatum just needs to fire after N months of a leader of the emancipation party - or atleast a leader with that custom trait coming to power) to ban slavery (works for AI too) or risk a full-on uprising.
This would be one of the two main methods for an empire-wide uprising, the other being a slow burn over time if the faction gains traction.
Also need to give it a custom icon..

Edit:

What 10x slave PP looks like, same situation as above but it drops from 57% to 9% stability, rather than 41% lol (10x ... might be overkill, maybe 6 or 7x is best? More testing needed.)
1607228936029.png
1607228982436.png
1607229116828.png


It might be a little unrealistic to have a pro-emancipation lobby group representing slaves, but it might lead to a rare case where AIs elect one of these parties and the above occurs which leads to more interesting galactic scenarios, and that's what I'm all for.

1607229305628.png
(my incumbent ruler running as an independent after a government change and winning a majority lol)
(in theory it's possible to use events and flags attached to attraction modifiers and PP scalars to "rig" other empires elections ... though I wont be doing it for this mod, as that's a very different beast, also I have a feeling PDX will flesh out hooks in that area a lot with 2.9, so i'll stick to factions and skip espionage)

I'll look in to adding an empire event (X empire has given in to slave demands, Y empire has elected a [advanced faction leader]*, Z empire has fallen into civil war with N faction)

* certain AI elections will be important to keep in mind when I eventually do the Ultranationalist special faction, letting (militarist/spiritualist and xenophobic) empires fight off a xenophobic coup/secession... or give in to their demands and become fanatic purifiers lol.
 
Last edited:
  • 3Like
Reactions:
Small progress update
  • Rewrote most of my underlying setup after switiching to VS code & changed my approach to now supplement factions with event_chains.
  • have 6 factions working for Machines [the plan is to have the negative factions act as drivers for event chains - if purgees [all purging pops fight back] exist, spawn a chain and associated events based on "supporter" locations, such as spawning timed criminal "rioter" jobs, its a slightly cleaner way of targeting points in the galaxy than actively searching via event)
  • Havent touched hives but can probably have 2-3 (Purgees, Bio-assimilation/Bio-assimilation revolt, maybe slaves or something... ive not played hives in a long ass time tbh)
1613320330167.png

There is a technical limitation that prevents pops with no happiness (i.e. droids, nerve stapled pops, MI drones, Hive Drones and MI Cyborgs) from joining factions. I cannot find any way to get them to join a faction - if anyone knows i'd love to hear it. Unless a workaround is found, this will highly curtail the faction potential for Gestalts.

Pretender heir progress
1613320898147.png
- rolls to pass or fail. [intended to fire after your current imperial ruler dies]

Fail event:
1613322186832.png
event chain ends here

Pass event:
1613320950237.png
then secretly rolls upto FIVE pretender heirs (capped with empire size [#sectors] + rand weight)

Triggers pretender heir emergence + Event management chain in sit-log:
1613321118966.png
1613321064748.png
Heirs emerge every few months up to the pre-rolled cap (1-5 heirs roughly corresponding to #owned 1-5+ sectors)

And, of course, they'll hold a faction:
1613321864921.png

Looks like i've forgotten to rename "Populist" as "Pretender" for their special leader class.

The plan from here is to
  1. Set up sub-situation log screens e.g. "Pretender Alpha - Support Progress"
  2. Figure out an efficient way of assining POIs with random events
    • Roll 5-10 POIs (not considered how many is good, yet) on random colonies in the pretender's targeted sector (e.g. the Core sector +rural space if just 1 sector owned, or in the "Beta sector" if you have 2 sectors)
      • The above images are just from a quick test so the numbers are odd, but the plan is to seek for pops in the pretender faction, find their worlds [or starbases/mining/science stations as a fallback] and use those for POIs
      • A POI might be an agent of the pretender proselytising their own lord's worthiness, with you getting a few responses "Kill them, discredit" perhaps civic locked [a feudal lord can obligate them] etc
    • You have a counter that ticks up/down showing pretender's support (e.g. starts at 50, with 10 events, depending on your responses to each event it it will add to or reduce from pretender support.
    • If you reduce their support to zero you can freely arrest them [faction decision], ending their claims.
    • If it ticks up to 100 a civil war fires with that whole sector declaring independence under the pretender heir
      • [still looking in to this - might be able to set them up as vassals immediately, with a repurposed war to take over overlordship, and auto-recombine the states]
    • Killing/arresting all pretenders [via civil war this means taking their homeworld] will end the event chain.
  3. Faction decisions:
    • You can abdicate to a pretender but this costs 20k Unity + some empire instability - and if you have multiple pretenders this can only be done once. It could be useful if a pretender spawns in a sector with all your shipyards though..
    • Alternatively you can attempt to "Silence" the pretender [faction decision] -
      • if their support = 0 this will 100% dissapear them.
      • If support >0% there is a chance it'll fail and immediately trigger a civil war OR just fail and the assassin gets away (no repercussions).
      • [this runs on a cooldown]
    • There is also a discredit option to reduce their support via discrediting them [on a cooldown]
    • 1613322613978.png
      [dont mind the scope issues lol was testing how flexible that popout is]
  4. Not put much thought into the civil war itself focussing on earlier stages but
    1. special situation needed for 1 pretender / 1 sector (i.e. a early game ruler death) that handles things on a per-colony basis, min 2 colonies)
    2. Each sector is made a new empire with a special "Pretender State" origin, as a vassal of the ruler empire,
    3. if a civil war is triggered they get a special war vs the ruler that fires a special cleanup event after. White peacing makes them independent gives -500 opinion for rulers lives and 10 claims on eachothers space.
  5. Not sure yet how to handle the multi pretender wars, probably will make the other ones also raise independence (rnd weight based on current sector support thresholds) and have everyone fight eachother in a 6-way space bastard war - open to ideas.
 
Last edited:
  • 3Love
  • 1
  • 1
Reactions:
Screwing around with counters, currently thinking to
  • make the counters start at 50, with maybe 10 [depends how lazy I am]potential challenge events to change support.
    • each challenge event you tackle vs the pretender increases or decreases their support counter.
    • If you ignore an event and it times out [e.g. 6-12m], it rolls in their favour increasing their support.
    • The greek words below still need to be substituted for leader names [fairly sure its possible to set up a specific-leader scoped localisation, but not exactly sure how, yet]
  • When at 100% a civil war fires [OR if 10 events have passed, their current support level determines the forces they get - need to read into the machine CW event for this]
  • When at 0% you can press to arrest/silence them. Incrementing the "Pretenders eliminated counter" [1 in below pic, but can be as high as 5 - normally only relevant counters will show up, based on #pretenders]
  • When the Progress counter [0/1 below] hits max, either through killing them[taking pretender homeworlds in CW] or arresting them by avoiding war, get a "epilogue" event [need to look in to scripting text to reference flags for more interesting epilogue text].
1613356216372.png
1613356693166.png


For the challenge events i basically have 3 options
  1. spawn "loose" anomalies (messy)
  2. use an archaeology chain [somewhat similar to event_chains but need to read up on them]
  3. use special projects with multiple choices [may go with this, though requires more testing/playing with event hierarchies]
  4. 1613359533113.png
  5. Edit:
  6. 1613392354643.png
    finally figured out what's needed to make exclusive special project decisions

Something else I've thought about, though - You could actually use an event chain to track sector loyalty, or even leader loyalty (though it would be unwieldy to do for leaders with how the game is set up).
  • For sectors, iterating through a ton of counter-sets via conditions is easy [count#sectors, use event_chain with #X flagged counters] but the initial file creation i'd probably do with a macro.
  • each sector in your empire could be flagged (e.g. up to 128 sectors - a number so high that few would ever hit it) and correspond to a counter.
  • Each month that counter could go up or down based on the stability of worlds in that sector.
  • if it falls to 0 the counter triggers a sector secession crisis event.
  • This would likely be a complex monthly polled event tracking planet stability OR Avg happiness levels - probably not for those with weak CPUs lol [could be made player only to ease performance, but thats no fun].
 
Last edited:
  • 3Like
Reactions:
This is all very exciting. Alongside the next patch and dlc, I look forward to pick up this game again.

Do you have any idea of when this mod could see the light of day?
 
This is a very exciting project and I'd like to help if you're open to turning this into a multi-person project.

I've modded other games, and made one simple mod for stellaris so far. I'm a competent python programmer, so I'm sure I can pick up the modding here rather quickly. I can do flavor writing for the embedded events, help with testing, or otherwise help with the math or building out the more expansive sets of full-ethic-circle factions you have planned.
 
Prepared to hit the ground running once Nemesis drops? I assume you will be very busy once that happens.
This is all very exciting. Alongside the next patch and dlc, I look forward to pick up this game again.

Do you have any idea of when this mod could see the light of day?
Nemesis will definitely bring scripting changes with it, I definitely want to get something out ahead of nemesis, even if it's just the pretender chain (which tbf is probably one of the more complex factions) and one or two simple factions (E.g. the gestalt ones or a colonial lobby that all "colonist"-employed pops join, demanding distribution of goods, extra housing/amenities, giving you [timed] free immigration/stab events on colony-specialised worlds as a benefit).

Part of why I've been so slow with this was me taking a break for cyberpunk, the other part being my mod file structure was a total mess, now that I've organised myself its much faster to make progress - splitting each faction into its own namespace and file names
1613422278310.png
ignore the red, CWTools doesnt know that my custom leader classes exist lol.
and a fair amount of my background reading (to see what is the 'least buggy' way to implement factions) is done now that my gestalt tests are over, once the Pretender line is done i'll be able to copy-paste core events(functions) from there for - say a military coup if you lose a humiliation war, or a faction of Fanatic purifiers to rise up in your empire - possibly letting you [Or an AI!] become an FP mid-game, after a coup (bloodless or not). I move on to the original plan for special political parties. Things to think about later.

Though I'll want to take a week when it drops to just play the DLC, obviously, i'll also need some time to see what "internal" spying mechanics exist -
  • like, can I use their new UIs to "investigate" a leader of mine, to fire an event and see if they are plotting a military coup
    • [maybe treat them as a "foreign asset" in my own empire? will see how far I can twist/break what PDX have done lol]
    • and are there any mechanics to lock them in, so the player cant simply delete them -
  • one issue I have with the pretender chain is it'll probably break if you delete the sectors its referencing, so I go on the assumption a player wont cheese it and wants to actually try the event "properly"
    • there may be a way around this to save the "old" sector capital as a fall back [using a POI as a map marker] and give the pretender all Owned systems within 4 jumps. I'm not up to testing that part yet, though.
1613406107405.png
Seems the situation log is pretty extensible, you can fit any number of special project options in that you like. You cant stack event chains within event chains sadly, looks like it only goes 1 level deep (which would have made what I have in mind, far neater).

Things you can show in the sit log
  • Event chains (this is what mandates, precursors and most galactic crises use - its the "crown" icon in the above pic - the crown being my custom image ripped off a stock website and sprayed green lol - might remake that at some point, the aliasing from downscaling looks a bit shit)
  • Points of interest (the !) which can be on their own or nested under an event chain
  • Special projects (the planet and debris icons - can be customised) which can be on their own or nested under an event chain
    • They can also be synched to be mutually exclusive (as is the case with the yellow arrows between all 5)
    • You cant put counters within POIs or special projects from what I see.
  • Debris - not actually sure how to force spwan it, but seems to be mostly hardcoded, and irrelevant to my plans.
Spent most of today screwing with ancient relic digsites... but honestly... I don't like using them very much, they are shoehorned into fleet_events (granted I can get around this with a "middleman event" that then triggers country events but it's messy) and some of the artwork isnt easily moddable from what I can see, you cant change the digsite icon itself, it'd be weird having a digsite Icon on a planet when it's about a political debate.
  • It looks like the spy events in Nemesis will be using a "upgraded" archaeology system (god that needs a shorter name) so perhaps i'll revisit it in 2.9 with any extra functions they add.
So I think Special projects (zero day SPs that trigger event windows giving you choices) are probably the way to go for this event chain, for now atleast.
 
Last edited:
  • 1
  • 1Love
Reactions:
To help this along. A faction can have the same ethic but diffrent issues. The isolationist vs supremacist faction for example. So you might now have to make new ethics.
 
BUT HOLY CRAP I WANT THIS SO SO MUCH. IF I KNEW HOW TO MOD I WOULD HELP
 
@Pancakelord @Zibbly
Can you make both your mods compatable with eachother, with revolutions- ethics and civics?(A new version of ethics and civics classic that fixes bugs and stuff. And they have plans to add new civics and stuff) And potent rebelions? All of these mods would synergise really really well with eachother. If paradox wont give us an internal politic expansion we will make it ourselves. Also starnet ai compatibility and ui overhaul dynamic compatibility would be nice. Sorry if this is alot. but All of these mods would go really well together.
 
Last edited:
  • 1
  • 1
Reactions:
If this is compatible with all of that then sign me up 100%. I know it might be a bit too early to concider mod compadibility. But still. IT is best to work on it now rather then figure out later that it isnt compatable at all having to rework a bunch of things. If you can manage that we are 1 step closer to stellaris definitive edition.
 
  • 1
  • 1
Reactions:
I really like the business of this screen (and the horror you're facing pleasing/working with all those factions when you pull through with the boni and mali associated with respective factions and how you treat them).

I noticed that the two upper factions have a Space infront of their name, not aligning with the other Faction names. Is this due to you fiddling with the files/not adjusted? Just a minor thing.I like the modified UI here in the first screenshot, showing which Pops are moderate or of a fanatic Ethic (and seeing their pull). I also disagree with the Vanilla restriction that a Pop can only have one Ethic assigned, is this something you can modify? Also, I don't recall seeing this in vanilla, but I like that Pops can have way more than two attractions to a Faction in the second screenshot. That makes the political land scape more dynamic by Pops swinging in directions depending on what you're doing in your empire (Policies, Rights, etc).Not exactly sure what you mean (maybe because I am not a native English speaker). Do you mean it's not apparent what Ethics a Pop might be attracted to? If so, I agree. You have to select individual Pops to see what they are attracted to. I'd like a per-planet visual breakdown of which Pops want which ethics (AfAIK the Ethic symbols only tell you how many % on this planet is Ethic X or Y.

Awesome progress!
For the ui issues try integrating ui overhaul dynamic.
 
Allright here is my idea for a faction. The Communists. This faction will be popular with workers and specialists with low living standards(basic sustanance(accept with displacement purging), stratified economy, decent conditions if stability gets too low, and acedemic privlage(only workers not specialists). They will demand that your empire become egalitarian(or coopertive if you are playing with ethics and civics classic or one of its variants) and put all pops under shared burdens, chemical bliss or utopian abundance. Social welfare will work ssomewhat but they wont be as happy as with the other 3. And if stability gets too low they can still revolt. They would also be against slavery(unless your empire is xenophobic then they are just against if for your main species) But not to the extent of the anti slavery faction. And also they wouldn't care as much about the whole egalitarian thing if pops had better living standards. But again if stability got too low they could still revolt unless all conditions are ment. The revolt would spawn a fanatic egalitarian(Fanatic Coopertive if playing with ethics and civics classic), militarist empire with shared burdens and either Idealistic Foundation or beacon of liberty. And the revolt would also cause worker and specialist uprisings that would join them. Adn generally decresse worker and specialist output.
 
  • 1
Reactions:
An idea for a new civic that owuld play into this. A 2 party system civic. The affects of that i will leave up to you guys