• 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.
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 }
		}
	}
 
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?
 
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.
 
Out of curiosity, RedRooster81 posted this thread in July. Has this list been taken into account? Or, more relevant, are the things on this list implemented?

In any case, an impressive improvement in modding. :)
 
This is a fantastic piece of work. The many capabilities it offers in such a "small" but rich change makes it a comendable job by Paradox workers.
 
These changes sound amazing. It's like you guys looked at the past Paradox games, and finally designed a complete system for events! Instead of the powerful but sometimes patchworky, arbitrary and unsystematic event systems of EU3, CK1 or Vic2.

If the game is really so well thought, out I'm sure it will sell wonderfully and spawn a modding community that lasts for a very, very long time :)
 
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...) :)
 
Sounds great, I was hoping for some of these modding possibilities in Paradox games for years. :)
Definately looking forward to this game.

Is there a chance some of them will be included in your older Clauswitz games, as well?
 
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?
 
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
 
Have you measured the performance of having the content loaded from a compressed archive? I imagine it would be a faster since there is less disk access. Are all of the game's content archived or just the mods?
 
Have you measured the performance of having the content loaded from a compressed archive? I imagine it would be a faster since there is less disk access. Are all of the game's content archived or just the mods?

It is all loaded at start up, so that doesn't really matter that much. It requires less disk access, but also more processing to unpack. I imagine that the difference is very small. I think that processing the data into memory structures that are usable by the engine (building the world and setting up the database) is much slower than the actual loading and unpacking of the data into memory, at least that is what I have experienced in the startup screens.
 
Thats pretty darn sweet. I can think of a ton of times mod modularity woulda been very nice in previous games. Hell I probably have hundreds of megs of duplicate mod files that could be organized so much better this way.
 
It is also possible to have some options in an event only be available when certain conditions are true.
This is wonderful. No need to make multiple versions of the same event!

Can one set variables? Can one multiply or divide them?
 
I have no doubt the game loads as fast as I have seen from some of the preview videos, however I'd still be interested in the technical side of things. I know I did get some speedup in CK1 when I turned on file system compression on the save game folder. Paradox games use a lot of big text files that compress really well. And you can use better compression algorithms than NTFS compression to get even better performance.