Jump to content

[mod] [CK2] Herring's Stuff for CK2


Recommended Posts

Changelog:

  • Trait Icon Replacements - 1.07
    • Main download only update / no new graphics
    • Added support for Bosom Fantasy
    • Added support for DW: Toska Remix

Also added terms for being allowed re-use stuff from my mods ("Terms for re-use for own mod" section in the OP), it only affects people trying to paywall mods so it doesn't affect any of the mods that currently use the icons, but it's better to have these terms if it ever happens.

 

News:

Didn't have much time since last update so not much got done, I did make a new window layout though:

1993940919_ModProperties.png.4cdd7547a11aa08207fdd4dac111afaa.png

It's a window to edit the properties of a mod without having to edit the .mod file, it's currently not in any way integrated into the manager, but I wanted to show off some progress atleast. Will also have to think about how exactly I'm going to go about the version control, so it is subject to change like everything else about the manager.

 

I'm also currently thinking about moving all variables for the math library to the global scope as it would be better for event-chains if they didn't have that many variables attached to them. I will have to try if this is actually possible though, as it could lead to problems if multiple events call scripted effects at once.

Link to comment
16 hours ago, Herring said:

Changelog:

  • Trait Icon Replacements - 1.07
    • Main download only update / no new graphics
    • Added support for Bosom Fantasy
    • Added support for DW: Toska Remix

Also added terms for being allowed re-use stuff from my mods ("Terms for re-use for own mod" section in the OP), it only affects people trying to paywall mods so it doesn't affect any of the mods that currently use the icons, but it's better to have these terms if it ever happens.

 

News:

Didn't have much time since last update so not much got done, I did make a new window layout though:

1993940919_ModProperties.png.4cdd7547a11aa08207fdd4dac111afaa.png

It's a window to edit the properties of a mod without having to edit the .mod file, it's currently not in any way integrated into the manager, but I wanted to show off some progress atleast. Will also have to think about how exactly I'm going to go about the version control, so it is subject to change like everything else about the manager.

 

I'm also currently thinking about moving all variables for the math library to the global scope as it would be better for event-chains if they didn't have that many variables attached to them. I will have to try if this is actually possible though, as it could lead to problems if multiple events call scripted effects at once.

I've been thinking about a proper way to have functions that don't procude argument clashes. My bedt hack for now is having a fuction modelled as declaring some local vars (the function args) and invoking an scripted effect (the function call). This effects create a dummy character in an AI court, so that the dummy works as the 'function-local scope'. Then the local vars sre copied into noemal vars bound to the dummy characters, the computations are preformed on the dummy scope and finally, after the computation is done, the dummy character is dispossed of (killed)

 

Since each function call creates its own dummy-character, you can even do recursive functions this way.

 

The only problem with this is that all the functions must execute entirely in the same day, since the dummy chsracter could die on day transition without our control. (That, and probably that creating chsracters just for this may not be precisely the fastest thing).

 

Good luck with the mod manager interface! When you mean versioning, do you mean versioning of the app itself of or the mods?

 

 

Link to comment

@ngppgn

Problem with that, in my case, would be that the dummies only get disposed from memory/ the database on a save reload and since I'm currently more concerned about memory ( which is why I mentioned that I'm going to try to move from local to global ), it would probably just worsen the problem.

I really wish that Paradox would finally implement the clear_variable command properly, because somebody atleast has made a stub for it, as it is in executable next to other commands & conditions:

clear_variable.png.ff9382ea6c8c2d51e3871f09bdd7bbe6.png

Though thanks for mentioning that this does make recursion possible, I will keep that in mind.

 

The versioning is for mods, as I felt that versioning in CK2 is a bit messy.

For example, one of the things that I see some people doing is just putting the version inside the name argument for the .mod file, as it is the only thing displayed on the normal launcher, the problem with this is that this messes with the dependencies argument which, from what I know, only takes exact strings so dependencies = { "Mod v1.0" } isn't necessarily going make the game overwrite files from "Mod v.1.1", if it wasn't this way it would probably make the life people new to CK2 modding a bit easier.

As such what I wanted to do with the manager and it's mod properties window is adding new arguments to the .mod file, these would be:

  • version = <Floating point number>
    • Mod's version
  • min_deps_versions = { "<Floating point number>" "<Floating point number>" }
    • Mod's dependencies minimum versions

and to make it a bit more clear in which state development is probably:

  • state = "<Pre-Alpha|Alpha|Beta>"
    • Mod's development state
  • min_deps_states = { "<Pre-Alpha|Alpha|Beta>" }
    • Mod's dependencies minimum states
Link to comment
  • 3 months later...

Hey, it's been a while hasn't it? I wanted to wait until I actually have something new to show and so here we are.
Added new Mod/Resource


Trap Portrait Swaps
TPS.jpg.c2391458e2b7bc4989d1ba22566038c8.jpg

 

I never liked the way people do portraits for traps (as in either having a static image portrait or keeping the male portrait). Yet, in order to make proper looking swapped portraits, you have to duplicate and change a lot of stuff, as such I though I'd create a standalone patcher & patch to serve as a test while I'm creating the manager.
 

I have included a few premade patches for having both all DLCs and no DLCs for:

  • DW:R 1.68
  • DW:R 1.68 + Trap & Futa Genes 1.11
  • DW:R 1.68 + Nox's DPA 0.0.1.0.3α ( + Supplement)
  • DW:R 1.68 + Nox's DPA 0.0.1.0.3α ( + Supplement) + Trap & Futa Genes 1.11
  • HIP (All modules) 2018-06-21 + DW:R 1.68
  • HIP (All modules) 2018-06-21 + DW:R 1.68 + Trap & Futa Genes 1.11
  • CK2Plus 4.07.8 + DW:R 1.68
  • CK2Plus 4.07.8 + DW:R 1.68 + Trap & Futa Genes 1.11
  • Elder Kings 0.2.1 + DW:R 1.68
  • Elder Kings 0.2.1 + DW:R 1.68 + TFG 1.11
  • AGOT 1.7.1 + DW:R 1.68
  • AGOT 1.7.1 + DW:R 1.68 + Trap & Futa Genes 1.11

NOTE: I don't know how well in practice these work, I tried a few with starting up a game and looking if a few things loaded properly, testing each extensively would be way too time consuming. CK2Plus at least for me has errors, even when playing with only it loaded, even though it has the right checksum & even after checking the integrity with Steam, so I don't know if it really works. I'm also not going to make new premades, this is a one time only thing as it is way to time consuming to make these in bulk, see further down how you can make a patch yourself.

 

A few other notes:

  • Additional mods usually require a newly created patch of their own (either if they have new graphical cultures, do something with the trap trait or overwrite a file that is also overwritten by the patch), if you want to create a patch yourself look further down.
  • By "All DLCs" I mean all DLCs that include graphical cultures.
  • The patches don't do much on their own, the only thing that is actually included is to make someone a trap is a game rule for a debug mode which enables a decision to make characters into traps.
  • The patches also create trap portrait swaps for women, I don't know if this will create problems, but usually people only set the trap trait if someone's male, so it hopefully won't.
  • When creating a character don't change the culture to a trap culture, the patch only affects ethnicity, so if you want to play as one change the ethnicity.

 

Creating own patch:

Spoiler
  1. Download "Trap Portrait Swaps - Create own patch" and unzip it
  2. Copy the folders "common","events","decisions","interface" & "localisation" from the CK2 install folder to the "Game" folder
  3. Copy the "interface" folders from the DLCs to the "Game" folder, if you don't have any DLC skip this step
            An easy way if you have 7-zip installed: Select all .zip files -> Right click -> "Extract Here" -> copy the interface folder
  4. Copy the folders "common","events","decisions","interface" & "localisation" from the all wanted mods to the "Game" folder
            Notes:
                If a mod has a dependency the dependency mod has to be pasted first
                If a mod has a replace_path in it, remove the directory/-ies from the "Game" folder first and then paste it
  5. Either use the provided exe or use Python 3 to execute Patch Engine.py
  6. Wait until "Done. Press enter to exit", then press enter.
  7. Go into the Output folder and and open the .mod file, change the dependencies to all the mods you are using.
  8. Copy the folder and the .mod file into the mod directory
  9. Done

 

Stuff for modders:

Spoiler

If you want to check if a user has Trap Portrait Swaps activated:
I made it set a global flag called "TrapPortraitSwapsActive" and a global variable "global_TrapPortraitSwapsVersion" for it's version on startup.


Some more technical stuff about the patcher:

Spoiler

I have to apologize first for making not enough comments in the code & not organizing it further (and probably having overall pretty messy/bad code), especially the actual patch code. I just started to code without much thought about organization and as such the entire thing just ended up in the Main().
But it is just a test after all, keeping that maintainable shouldn't be that important.


To start let's begin by saying that if you're interested in using the patcher for your own patches, then I would say wait until I have the actual manager out, as I'm probably going to still change a lot about the actual patcher engine, for example the standalone patcher gives patches files, which I intend to change to just the definitions. Other things to consider would be for example an option to create multiple mods through a patch, the current patcher only supports one per patch.
If want to look at something that is (hopefully) not going to change much, look through the current classes in Utils.py. These give show how I intend to give warnings & errors (Notices) and how I structure Paradoxscript files (Statement,MergedStatement & Section) for python. As for parsing the Paradoxscript files look through Tree2 (Creates a tree like structure from Paradoxscript files) & MS2 (aka. MergeStatements2. Merges single statements into <Key,Operator,Value> like objects of the class MergedStatement)


Creating this also gave some insight into how even the game developers aren't infallible, one file in vanilla CK2 is for example never actually properly ended and misses multiple closing brackets, another just has a few semicolons after commands (I have to admit that to make MS2 not fail when it encounters this, I just made it ignore any statements that are just ';', I hope this doesn't bite me in the ass later) and there are a lot of occurrences in localisation of too many semicolons in a line.

 

Other news

Manager
Manager-Translations.thumb.png.6e2fad2b78097c17eccb9aa23f958fd6.png

(Everything's translated by Google Translate, so don't blame me for any errors)

 

Can I now claim I care more about supporting different languages than Paradox? Joking aside, this was just a test to see how easy it would be to implement different languages. QT actually makes it pretty easy to integrate the binary language files into the program.


Creating the binary language files though is another story, so I created another python script to create them from csv files so people wouldn't have to install QT's translator tool. The csv looks like this:
CSV.png.90e7ce9c1c7c135c9138787ea3888be6.png
First rows are the locals. Rows and columns with # at the start are ignored.

 

Math Library
Good news, CK2's scripted effects are executed completely before doing anything else and as such I can move most local_* variables into the global scope to further conserve memory. I still want to change a function a bit before releasing the new version though.

 

Link to comment
3 hours ago, Herring said:

Hey, it's been a while hasn't it? I wanted to wait until I actually have something new to show and so here we are.
Added new Mod/Resource


Trap Portrait Swaps
TPS.jpg.c2391458e2b7bc4989d1ba22566038c8.jpg

 

I never liked the way people do portraits for traps (as in either having a static image portrait or keeping the male portrait). Yet, in order to make proper looking swapped portraits, you have to duplicate and change a lot of stuff, as such I though I'd create a standalone patcher & patch to serve as a test while I'm creating the manager.
 

I have included a few premade patches for having both all DLCs and no DLCs for:

  • DW:R 1.68
  • DW:R 1.68 + Trap & Futa Genes 1.11
  • DW:R 1.68 + Nox's DPA 0.0.1.0.3α ( + Supplement)
  • DW:R 1.68 + Nox's DPA 0.0.1.0.3α ( + Supplement) + Trap & Futa Genes 1.11
  • HIP (All modules) 2018-06-21 + DW:R 1.68
  • HIP (All modules) 2018-06-21 + DW:R 1.68 + Trap & Futa Genes 1.11
  • CK2Plus 4.07.8 + DW:R 1.68
  • CK2Plus 4.07.8 + DW:R 1.68 + Trap & Futa Genes 1.11
  • Elder Kings 0.2.1 + DW:R 1.68
  • Elder Kings 0.2.1 + DW:R 1.68 + TFG 1.11
  • AGOT 1.7.1 + DW:R 1.68
  • AGOT 1.7.1 + DW:R 1.68 + Trap & Futa Genes 1.11

NOTE: I don't know how well in practice these work, I tried a few with starting up a game and looking if a few things loaded properly, testing each extensively would be way too time consuming. CK2Plus at least for me has errors, even when playing with only it loaded, even though it has the right checksum & even after checking the integrity with Steam, so I don't know if it really works. I'm also not going to make new premades, this is a one time only thing as it is way to time consuming to make these in bulk, see further down how you can make a patch yourself.

 

A few other notes:

  • Additional mods usually require a newly created patch of their own (either if they have new graphical cultures, do something with the trap trait or overwrite a file that is also overwritten by the patch), if you want to create a patch yourself look further down.
  • By "All DLCs" I mean all DLCs that include graphical cultures.
  • The patches don't do much on their own, the only thing that is actually included is to make someone a trap is a game rule for a debug mode which enables a decision to make characters into traps.
  • The patches also create trap portrait swaps for women, I don't know if this will create problems, but usually people only set the trap trait if someone's male, so it hopefully won't.
  • When creating a character don't change the culture to a trap culture, the patch only affects ethnicity, so if you want to play as one change the ethnicity.

 

Thank you for you work, It a big update.

Could you explain to me what is "HIP (All modules)"? I use all DLC, DWR with many submod.

 

Link to comment

@Charli

HIP as in the "Historical Immersion Project" mod with all of it's submods / modules. (It's probably not all submods, I was just too lazy to figure out which ones would be requires for a patch)
Since you use many DW:R submods, I'd suggest creating your own patch, see the section for that in my previous post.

Link to comment

What do you mean by changing local variables to the local scope? If you mean using global variables instead, that's a bad idea, since the game is multithreaded. You could have several instances of a scripted effect modifying a global vsriable at the same time, potentially resulting in unwanted scenarios. Local variables make this practically impossible.

Link to comment
19 hours ago, asdf760 said:

Awesome stuff here

Thanks.

3 hours ago, ngppgn said:

What do you mean by changing local variables to the local scope? If you mean using global variables instead, that's a bad idea, since the game is multithreaded. You could have several instances of a scripted effect modifying a global vsriable at the same time, potentially resulting in unwanted scenarios. Local variables make this practically impossible.

I did mean using global variables, what I forgot to mention was that I'm only going to make the temporary variables of the scripted effects global, parameter & return variables still are going to be local.
Global.jpg.5a2e5f25b0b82d00cf32f5bd6af222cd.jpg

Here I fired an event which scopes to all character in the realm and executes one of two root calculations, the result is then returned to me. (The number next to the equals sign is what was calculated and the number in the Parentheses are what is calculated on a normal calculator)
The calculation script effect has it's temporary variables in the global scope, as such I think I can assume that Paradox decided to run scripted effects single threaded for whatever reason, the only thing you have to be concerned with when using the global scope for the temporary variables, is that variables are probably not going to be unset and as such not equal to 0, which was a problem I stumbled upon accidentally.
You are right though, making the parameter & return variables global is a bad idea and result in them being overridden almost instantly.
If you want to try the event with the global variables yourself, fire MathDebug.0 (Note, this is not the version I'm currently working on):
CK2 Math Libaray - Global.zip

 


Also, here's something that I forgot to post when I posted the last update:
What I learned today in the last 4 months about CK2 modding:

The AI has a lot more options
One of the frustrating things about CK2's engine is that an event is limited to 4 options maximum, this only applies to the player though.
741660882_AIOptionTest.jpg.37ba5b29af4ea03f050df4439510a151.jpg
1 to 6 refer to the option the AI character chose.
I also tried it with 20 different options for the AI, it still works. If you want to test it for yourself:
Option Test.zip

Warning: It has quite a high (as in often) MTTH.

If you want a technical explanation as to why the game doesn't give the player more options (or atleast the reason why I think the limit exists):

Spoiler

The game has 8 hardcoded strings called EventOptionButton<NR> & EventOptionText<NR>, with <NR> being 1 to 4, that are used for attaching the options in the event GUI to the actual option.
As such we can't have more options, as there is nothing to bind the options to that could be displayed for the player, the options are probably still in the background with no access to them.
As for why they don't create more, I could only guess.
From the currently very little that I dabbled in GUI modding it seems to me that there isn't a way to make things have a dynamic height and width based on their content (I may be wrong on this though). So that could be another reason why they limit it.

 

36 frames aren't that great
I figured out why certain larger animated images scroll in the game, for whatever reason the game just can't handle images with a width larger than 2^14 / 16384 pixels.
For reference, a normal event image is 450px wide, 16384 / 450 = 36,4 , so you can only have 36 frames for animated images before they begin to scrolls.
I also tested it with frames smaller than 450px, it again works up until 16384px in total width, so it really isn't the amount of frames.
So they're pretty limited, as long as we don't get support for also stacking them vertically.

Link to comment

Changelog:

  • Trait Icon Replacements
    • New:
      • Futa & Trap trait icons
      • Genetic base for templates
    • Changed:
      • Added virgin icon to DW:Toska Remix replacement, since I forgot it last update
      • Changed gimp python script to have control of scaling & selection feathering

913605239_TrapFutatraitreplacement.png.2dbe4e27c11c24033c89f53a3381fe70.png


Sorry for this being a smaller update. I had those icons lying around for some time, thought I'd upload them now instead of having them lying around on my hard drive until the next bigger update, which could be quite some time away, as I mostly only do icons currently when I don't want to work on something else.

Link to comment
  • 3 weeks later...

@fmafan98
Trap & Futa Genes is installed just like every other CK2 mod, follow the steps below "In case of manual installation..." under the "Installation" section:
https://ck2.paradoxwikis.com/Mods#Installation

As for the trait icon replacement, pick the folder and .mod file for the mod(s) you want to replace the trait icons for and install them just like Trap & Futa Genes. Normally that is enough.
If some icons that it should replace aren't replaced, then make sure that the value in quotes of the "name" parameter in the .mod file of the mod you want to replace the trait icons for, is exactly the same as in the trait icons replacement .mod file's "dependencies" parameter's curly brackets.

 


NEWS:
Been somewhat burned out of CK2, so not much was done. I did find a way to make the NthPower function return somewhat accurate results with decimal numbers for n though:
Result.png.b46a482fe0ba5258f22dd342e449ae25.png
Result1 to Result11 are always 5^n, beginning witn = 2.5 in steps of -0.5
So:
Result1 = 5^2.5
Result2 = 5^2
Result3 = 5^1.5
...
Result10 = 5^-2
Result11 = 5^2.5
The result are probably as accurate as you can make them with CK2's restriction of 3 decimals, as the in-between steps for calculating them are also restricted to 3 decimals. Also thanks to @ngppgn again for mentioning that recursion is possible through character variables, as otherwise this probably wouldn't have been possible.

The reason why I'm not going release the new version yet is that somehow the same scripted effect that is used for the decimal part in the current NthPower scripted effect is somehow breaking when used in the NthRoot scripted effect and result in an endless loop which just causes the game to not respond anymore.

Link to comment
  • 4 weeks later...

Changelog:

  • Trap Portrait Swaps
    • Removed pre-created patches since they don't work with the newest version, you will now have to make a patch yourself, see the section for it in the OP
    • Added option to not make trap cultures spawn on randomized worlds, since it makes a person with a trap culture, as their actual culture and not just their ethnicity, treat a person with their equivalent normal culutre as if they were a foreigner
  • Trait Icon Replacements
    • Replaced Toska Remix with Dark World Extras
Link to comment
  • 4 months later...

+++Crosspost in both topics for better visibility+++

 

Concerning: Herring's "Trap Portrait Swaps" with "Dark World DZ" v0.0.4.2 (and at least one earlier)

Problem: "Patch Engine" patch creator closes without warning and without proper mod being created. In command line this happens on line "Getting portrait definitions" with AttributeErrors and similar shown above.

 

Fix: Open file DW DZ\interface\portraits\dz_static_portraits.gfx (with text editor) and remove "}" on line 238 (three lines above name = "dz_PORTRAIT_static_3")

Link to comment

Sadly, Trap Portrait Swap is currently checking for a trap trait that doesn't exist anymore in DWF, being replaced by "feminine" and "masculine".

The small addon attached here adds an invisible trap trait to both, so they can work together. It's a bit crude, but works (not for static portraits, of course).

Just make sure to create your own patch (including all desired mods except this one) and when asked if the trap trait is in another mod enter "true".

TPS_DWF_Compatibility.zip

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use