Crusader Kings Dev Diary #21 - Usermodding

Crusader Kings Dev Diary #21 - Usermodding

  • 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
Showing developer posts only. Show all posts in this thread.

Johan

Studio Manager Paradox Tinto
Administrator
Super Moderator
Moderator
16 Badges
Dec 14, 1999
18.079
28.874
  • Diplomacy
  • Teleglitch: Die More Edition
  • War of the Roses
  • 500k Club
  • Crusader Kings II: Holy Knight (pre-order)
  • Europa Universalis III: Collection
  • Magicka: Wizard Wars Founder Wizard
  • Hearts of Iron IV Sign-up
  • Stellaris Sign-up
  • Imperator: Rome Sign Up
  • A Game of Dwarves
  • Lead and Gold
  • Magicka
  • Starvoid
Hello, and welcome to another development diary about Crusader Kings II.

This time there are two subjects I want to talk in detail about, both related to something popular in this community, ie usermodding.

New file-system for Mods.

We have implemented a system in the game, where there is no need for a mod-dir system, and where the game files are loaded in the same way as any applied user-modification.

The game will allow enable/disable of any mod and/or dlc you have in your folders when you start the game.

Advantages of new system.
  • transparent for us when developing so there should be much less problems in the future when someone forgets to add mod support to some files
  • can load several mods at once
  • supports archives


example file structure
Code:
mods/my_cool_mod.mod
mods/my_cool_mod.7z
New file format
Code:
name = "My Cool Mod"
archive = "mods/my_cool_mod.7z"
dependencies = "some_other_cool_mod"
override =" flags"
- Name is just a name given to the mod for display purposes.
- Archive specifies a zip file that contains the files for the mods.
you also have the option of using "path" instead of archive with a normal directory, but we recommend using the zip archive for released mods because its less clutter on the player's computer.
- dependencies is a list of mod names. This means that you can set up a dependency chain and support having multiple mods loaded even if they might affect the same files. You can also depend on official DLC here. If dependencies are missing the mod wont be loaded.
- override specifies directories that will not be extended like normal, if you use this any previous loaded mods containing a directory in that list will not have that part loaded.

Event Scripting

We have also severly enhanced the scripting capabilities for CK2.

First of all we have added lots of triggers and effects to the language, which give you some rather powerful capabilities. While the game only have province and character events as entry points, an effect or trigger can switch scope to titles, wars & combats as well.

We have also made a system that random events can be run from what we call "pulses", so that you get one event each "time-period", so that when we add events, it will give more variety without the spam.


Another cool option is the "hidden_tooltip" effect, which allows the event-writer to have some hidden effects.
Code:
	hidden_tooltip = { prestige = 100 }
You can now also make event-chains that lasts over time much easier than before, with the new concept of "spawn event in the future at days x-y from now".
Code:
	character_event = { id = hedgeknight.1  days = 2 random = 5 tooltip = "They will get this in 2 to 7 days" }
It is also possible to have some options in an event only be available when certain conditions are true.
Code:
	option = {
		trigger = { trait = cruel }
		name = "I can only do this if cruel"
		prestige = 10
	}
Also, an option can have multiple effects, effects that depend on whatever conditions are true.
Code:
	option = {
		name = "Effect depends on stuff"
		if = {
			limit = {
				trait = cruel
			}
			piety = 10		#we become more pious if we are cruel.
		}
		if = {
			limit = { liege = { opinion = { who = root value = 25 } }
			scaled_wealth = 0.05	#get 5% more money if our liege has at least 25 relation with us
		}
		prestige = 10		#always get 10 prestige
	}
There is new terminology for scope-switching, and you can nest as many scope-switches as you'd like.
  • prev = previous scope.
  • from = who sent this event to us.
  • root = who got the event.

Events that target a character can use targeting mechanisms like from, prev, root, and also stuff like liege, prevprev, fromfrom and prevprevprev!



We mentioned earlier that you do not have to find unique id's for your event series and can instead just use a descriptive tag as base for your event series.
Code:
namespace = hedgeknight
character_event = {
	id = hedgeknight.0
	desc = "hedgeknight.0.desc"

	...
	option = {
		name = "hedgeknight.0.a" #Refuse them Access
		random_courtier = {
			character_event = { id = hedgeknight.1  days = 2 random = 5 }
		}
	}
 

Johan

Studio Manager Paradox Tinto
Administrator
Super Moderator
Moderator
16 Badges
Dec 14, 1999
18.079
28.874
  • Diplomacy
  • Teleglitch: Die More Edition
  • War of the Roses
  • 500k Club
  • Crusader Kings II: Holy Knight (pre-order)
  • Europa Universalis III: Collection
  • Magicka: Wizard Wars Founder Wizard
  • Hearts of Iron IV Sign-up
  • Stellaris Sign-up
  • Imperator: Rome Sign Up
  • A Game of Dwarves
  • Lead and Gold
  • Magicka
  • Starvoid

Tegus

Deluxe programmer
3 Badges
Sep 28, 2009
626
1
  • Divine Wind
  • 500k Club
  • Crusader Kings II: Holy Knight (pre-order)
Query: Does the file format have to be ".7z" or will an old-fashioned ".zip" or even a ".rar" work?

For what I do for my own benefit, I assume from what's been said so far that there's no need to zip the file up at all - but does that mean I have to specify each individual file, or just a directory?
I think that we'll support .zip, .7z and plain old directory in the end.
 

SolSara

Supermoderator
Super Moderator
101 Badges
Dec 26, 2009
1.531
328
www.sarawendel.se
  • Victoria: Revolutions
  • Hearts of Iron III: Their Finest Hour
  • Heir to the Throne
  • Impire
  • King Arthur II
  • Knights of Pen and Paper +1 Edition
  • Leviathan: Warships
  • Magicka
  • Majesty 2
  • Majesty 2 Collection
  • March of the Eagles
  • Naval War: Arctic Circle
  • Rome: Vae Victis
  • Hearts of Iron III
  • Rome Gold
  • Semper Fi
  • Sengoku
  • Ship Simulator Extremes
  • Sword of the Stars
  • Sword of the Stars II
  • Victoria 2: Heart of Darkness
  • Starvoid
  • Teleglitch: Die More Edition
  • The Showdown Effect
  • Victoria 2
  • Victoria 2: A House Divided
  • Crusader Kings II: Sword of Islam
  • A Game of Dwarves
  • Arsenal of Democracy
  • Cities in Motion
  • Cities in Motion 2
  • Crusader Kings II
  • Warlock 2: The Exiled
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sunset Invasion
  • Darkest Hour
  • Dungeonland
  • Europa Universalis III
  • Divine Wind
  • Europa Universalis IV: Conquest of Paradise
  • Warlock: Master of the Arcane
  • War of the Vikings
  • For The Glory
  • For the Motherland
  • Gettysburg
  • Crusader Kings II: Rajas of India
I can confirm it is very fun using if = { limit = { } }, hidden_tooltip = { } and be able to trigger different event options depending on different things (traits, treasury, relations and so on...) :)
 

Johan

Studio Manager Paradox Tinto
Administrator
Super Moderator
Moderator
16 Badges
Dec 14, 1999
18.079
28.874
  • Diplomacy
  • Teleglitch: Die More Edition
  • War of the Roses
  • 500k Club
  • Crusader Kings II: Holy Knight (pre-order)
  • Europa Universalis III: Collection
  • Magicka: Wizard Wars Founder Wizard
  • Hearts of Iron IV Sign-up
  • Stellaris Sign-up
  • Imperator: Rome Sign Up
  • A Game of Dwarves
  • Lead and Gold
  • Magicka
  • Starvoid

Johan

Studio Manager Paradox Tinto
Administrator
Super Moderator
Moderator
16 Badges
Dec 14, 1999
18.079
28.874
  • Diplomacy
  • Teleglitch: Die More Edition
  • War of the Roses
  • 500k Club
  • Crusader Kings II: Holy Knight (pre-order)
  • Europa Universalis III: Collection
  • Magicka: Wizard Wars Founder Wizard
  • Hearts of Iron IV Sign-up
  • Stellaris Sign-up
  • Imperator: Rome Sign Up
  • A Game of Dwarves
  • Lead and Gold
  • Magicka
  • Starvoid
This is incredibly amazing. I particularly love the "if" clause, at this rate the Clausewitz event engine will end up being Turing-complete. So many possibilities... :D

A couple of questions to settle some potential problems in my future mod: will it be possible to give titles to characters by event (even if they couldn't normally create/usurp it because they don't fulfill the requeriments)? And will it be possible to make a character a vassal of another by event?
yes