Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conflict Resolution for CK3 #271

Open
Woedenaz opened this issue Jul 9, 2021 · 28 comments
Open

Conflict Resolution for CK3 #271

Woedenaz opened this issue Jul 9, 2021 · 28 comments
Labels
feature New feature or request help wanted Help wanted on the issue
Milestone

Comments

@Woedenaz
Copy link

Woedenaz commented Jul 9, 2021

Conflicting files is a HUGE issue when modding Crusader Kings 3. Many, many mods interact and conflict with each other by editing the same common files. As it is right now, the only way to really deal with this is to manipulate the load order and/or use difference comparison tools manually to find out what parts of each mod to keep.

This is particularly common for UI-based mods and results in a lot of broken UI elements when trying to merge even with careful usage of load orders.

It would be very nice if the conflict resolution currently implemented only for Stellaris could be used on Crusader Kings 3 as well. I'm not entirely sure if this has been requested or touched on before but it would make modding significantly less headache inducing.

As of right now, I'm just using VSCode to open the two files and using the comparison feature to manually create merged files. I then put these merged files into a personal mod folder to be loaded last (so a compatibility patch, essentially.)

I would quite literally throw money at someone to make it so this can be done in a simpler, less labor-intensive manner.

@Woedenaz Woedenaz added the feature New feature or request label Jul 9, 2021
@bcssov
Copy link
Owner

bcssov commented Jul 9, 2021

Just to put out a disclaimer: I am not familiar with any PDX games aside Stellaris.

Now, Conflict Solver has never been requested so far for any other game. I've tried expanding on Conflict Solver support by testing the waters of HOI4 community, I failed to find any interest. Some of my friends who play EU4 and HOI4 told me that there's not much to gain by adding a conflict solver for these games as most people play a bunch of overhaul mods...

I don't own CK3 but a friend does so I could borrow his game to run some unit tests to see if there is any need to touch up on the paradox script parser that is used in Irony, so that's not an issue. The issue is however that I'd need something like this: https://stellaris.paradoxwikis.com/Modding#Overwriting_Specific_Elements
Which I could use to define a set of rules for Irony to know when you resolve conflicts to either use a zzz or !!! prefix in filenames in order to create an override. If there's such a resource then it's relatively straightforward if not; then it's kind of a problem. If wrong naming pattern for element overrides is used this would mean that the override would not take any effect in game.
For stellaris there's the resource I mentioned and there are several modders who report additional stuff to me, so this is constantly expanded.

I'm willing to do it but I'll need the info I mentioned.

@Woedenaz
Copy link
Author

My guess for why it hasn't been requested much, or at all, is likely due to how (relatively) new the game is. I know, personally, I'd find it immensely helpful.

Unfortunately, I am not sure I'm quite knowledgeable enough to find or offer you the information you need. I could possibly ask in the CK3 Modding Co-Op discord but you may have more luck doing so. It's very possible the resources you need exist and I'm just not aware of them!

@bcssov
Copy link
Owner

bcssov commented Jul 10, 2021

I just scoured the modding wiki a bit. Doesn't seem like the information I need is available.

@Woedenaz
Copy link
Author

I am far from the expert on this, but I'd venture to say that list for Stellaris is, at least, very close to how CK3 functions as well.

I posted this request on the CK3 Modding Co-Op and hopefully someone with more experience than myself can give you the information you need. I appreciate your quick responses!

@bcssov
Copy link
Owner

bcssov commented Jul 11, 2021

Stellaris and CK3 don't have the same structure for common folder. I suppose event overriding works in the same way, interfaces and localizations. Stellaris has about dozen folders in common directory which are FIOS. On top of that there are several folders which are treated in a specialized manner due to duplicate items.

By this I mean that certain items when duplicated and overwritten in different filenames actually causes the game to go berserk. For example stuff like buildings in Stellaris, if you don't override them in the same file (as in using same filename) they vanish from the game (I believe this is how it manifests in the game). In order to fix that Irony uses a hack to create zero byte file overwrites and then dumps all buildings in separate files in its own patch to circumvent this particular issue. I'm guessing down the line CK3 will have similar problems if this ever gets implemented.

@bcssov bcssov added this to the vNext milestone Jul 12, 2021
@Stryder24
Copy link

Stryder24 commented Aug 10, 2021

Conflict detection and resolution for CK3 would be a terrific addition to this tool!

@bcssov bcssov added the help wanted Help wanted on the issue label Aug 17, 2021
@bcssov
Copy link
Owner

bcssov commented Aug 17, 2021

There's no documentation available for me to implement this feature.

@Woedenaz
Copy link
Author

I was mulling this over and I had an idea for a possible soft substitute for this!

I know real conflict resolution is likely not going to happen unless a list like the Stellaris was created. However, what would be very helpful in the interim is something that indicates on merging which file came from which mod. Like a comment inserted at the top of each file or something actually in Irony that indicates where each file came from.

It's not perfect but it'd help a fair bit in figuring out when specific files are being overwritten, at least, and save some time with having to sift through mod files. Would this be possible?

@bcssov
Copy link
Owner

bcssov commented Oct 29, 2021

You're basically wanting a readonly mode for conflict solver if I'm understanding correctly? Since I don't own CK3. How do mod conflicts look like in that game? Do people overwrite specific elements or whole files?

By specific element I mean that let's say you've got in events folder a large file which has a many events like let's say:
event.1
event.2
event.3
event.4
event.5

Then do mods overwrite this whole file which contains all of these events 1-5. Or do they create a separate file which contains only event.2 for example to overwrite?

It's kinda sad to see that only Stellaris community takes the time to document such important modding information.

I'm not sure if you've seen what actually Irony's conflict solver for stellaris does? Irony is able to break down the example file like I mentioned event 1-5 into individual elements and then create single overwrites only without altering a whole file.

I did however in v1.19 RC implement a new type of override which actually merges many different elements into a single file (this could be useful for CK3). Though I'd still need data on how CK3 operates at least. The trick here is that Irony writes zero byte files thus invalidating other mods and then forcing the game to use it's own override.

@Woedenaz
Copy link
Author

Woedenaz commented Nov 2, 2021

From what I've seen, for events at least, Modders will overwrite the entire file if they're modifying already existing events. They'll make new files/folders if they're making new Events, though.

Unfortunately, I'm really not the person that could or should be telling you, though. I'm very, very amateur at modding and I'm not even close to the expert in this. I can really only speak from what I've seen digging around other, more experienced Modders' files.

Like, for instance, the Way of the Kings mod, made by Tobbzn who is one of the more experienced modders that I'm aware of, seems to completely overwrite existing event files while also making his own events. However, everything in /common seems to be fairly free game in terms of being able to modify existing items in files without needing to copy the entire file wholesale.

Honestly, though, I could be completely wrong so please don't take my word for it. I agree that I wish a similar resource existed for CK3 as well! Perhaps it's because the modding community is still relatively new? But I'm not sure.

@bcssov
Copy link
Owner

bcssov commented Nov 3, 2021

This mod seems like a total overhaul mod so it's not a good criteria to judge the modding practices for me. Seems like insight from a CK3 modder is needed here.

I can't say what's the reason for the lack of documentation, it is true however that Stellaris is the only one that seems to have this sort of documentation.

@Woedenaz
Copy link
Author

Woedenaz commented Nov 4, 2021

How would one go about making that sort of documentation? Is it just a trial and error sort of thing?

@Woedenaz
Copy link
Author

Woedenaz commented Nov 4, 2021

I asked in the CK3 Discord's Mod Help channel, linking the Stellaris "Overriding Specific Elements" page, and Stik replied with this:

as far as I know:

  • any and all primary database objects in the common\ folder can be replaced without overwriting the whole file
    (by "primary", I mean the 1st bracket level, if that makes sense)

  • last mod loaded overwrites previous versions of the same object, no matter the name of the file it's in

  • Defines allow for the replacement of a single define without overwriting the whole primary block they're in, but they're the exception

  • on_actions work a bit differently

  • using the effect and trigger block of an existing on_action will overwrite the existing effect and trigger blocks (from vanilla or another mod higher up the load order)
  • you can append on_actions and events by using the relevant block of an existing on_action
  • events do not allow for single event replacement, you should always replace whole events file, respecting path and filename, otherwise you might get random crashes on game start. The Duplicate event error should not be taken lightly.

  • in GUI, replacing a single template or type throws an error on game start, but so far it seems to work without problems

Tobbzn also added:

History also doesn't allow top level replacements, it needs to override the entire file.


Hopefully this helps a bit!

@bcssov
Copy link
Owner

bcssov commented Nov 4, 2021

How would one go about making that sort of documentation? Is it just a trial and error sort of thing?

Trial and error, in stellaris it was documented over the years by various contributors who worked on their mods and they updated the documentation based on their findings.

any and all primary database objects in the common\ folder can be replaced without overwriting the whole file
(by "primary", I mean the 1st bracket level, if that makes sense)

Yeah, I get that. Same as with stellaris but common folders behave erratically. Some require prefix aaa_\zzz_ to force the game to use yours (FIOS\LIOS I mentioned).

last mod loaded overwrites previous versions of the same object, no matter the name of the file it's in

Interesting.

Defines allow for the replacement of a single define without overwriting the whole primary block they're in, but they're the exception

Same in stellaris.

on_actions work a bit differently
using the effect and trigger block of an existing on_action will overwrite the existing effect and trigger blocks (from vanilla or another mod higher up the load order)

on_actions in stellaris require you to overwrite whole file (filename matching similar to how events behave in CK3 I guess). I'm not sure I understand the meaning of this to be honest.

you can append on_actions and events by using the relevant block of an existing on_action
events do not allow for single event replacement, you should always replace whole events file, respecting path and filename, otherwise you might get random crashes on game start. The Duplicate event error should not be taken lightly.

Duplicate event errors happen in stellaris but they can be ignored. So I'm guessing events are file based conflicts then.

in GUI, replacing a single template or type throws an error on game start, but so far it seems to work without problems

I'm guessing it works same as in Stellaris, but when you use this system does the filename matter if you override a single element? In stellaris it needs to be LIOS (zzz_ suffix)

@chatoustikmou
Copy link

any and all primary database objects in the common\ folder can be replaced without overwriting the whole file
(by "primary", I mean the 1st bracket level, if that makes sense)

Yeah, I get that. Same as with stellaris but common folders behave erratically. Some require prefix aaa_\zzz_ to force the game to use yours (FIOS\LIOS I mentioned).

I think the erratic behaviour has been solved in CK3, by making the load order the only predictor of what will be loaded, but I'll make some tests to make sure of it. It's also possible not all folders behave the same, but so far, I haven't seen any case where filename impacted load order.

on_actions work a bit differently
using the effect and trigger block of an existing on_action will overwrite the existing effect and trigger blocks (from vanilla or another mod higher up the load order)

on_actions in stellaris require you to overwrite whole file (filename matching similar to how events behave in CK3 I guess). I'm not sure I understand the meaning of this to be honest.

Let's say we have the following vanilla on_action:

on_death = {
   trigger = { is_ai = yes }
   effect = { primary_heir = { add_gold = 100 }
   events = { some_event.0001 }
   on_actions = { vanilla_on_action }
}

when an AI character dies, their primary heir gets 100 gold
some_event.0001 is fired, and vanilla_on_action is executed

If in my mod I use this :

on_death = {
   trigger = { is_ai = no }
   effect = { every_child = { add_prestige = 100 }}
   events = { custom_event.0001 }
   on_actions = { custom_on_action }
}

the vanilla trigger and effects block are overwritten :
nothing happens when an AI character dies, instead when a player character dies, all their children get 100 prestige

but you can append elements to the events and on_actions blocks, so both some_event.0001 and custom_event.0001 are fired, and both vanilla_on_action and custom_on_action are executed.

So except if you do want to override the vanilla on_actions, the proper way to use them is to append a custom_on_action, and use triggers and effects in this custom_on_action only, not in the vanilla on_action you're appending to.

on_death = {
   events = { custom_event.0001 }
   on_actions = { custom_on_action }
}
custom_on_action = {
   trigger = { is_ai = no }
   effect = { every_child = { add_prestige = 100 }}
}

With this, when a character dies, if it's an AI character the primary_heir will get 100 gold (from the vanilla on_death on_action), and if it's a player character, every child will get 100 prestige (from the custom_on_action appended to on_death via the on_actions block).

Hope that makes sense =)

in GUI, replacing a single template or type throws an error on game start, but so far it seems to work without problems

I'm guessing it works same as in Stellaris, but when you use this system does the filename matter if you override a single element? In stellaris it needs to be LIOS (zzz_ suffix)

I'll run some tests, because I have no idea =)

@bcssov
Copy link
Owner

bcssov commented Nov 5, 2021

I think the erratic behaviour has been solved in CK3, by making the load order the only predictor of what will be loaded, but I'll make some tests to make sure of it. It's also possible not all folders behave the same, but so far, I haven't seen any case where filename impacted load order.

If true it makes my life a lot easier. The app could dump any part of the code with any filename and just ensure that it's own patch mod (as I call it) is loaded last -- which it already does.

Let's say we have the following vanilla on_action:

It's a bit clearer but what I might be missing is some context. It does not seem as though the on_action are similar to how they work in stellaris. In stellaris (this is snippet from a vanilla file):

on_game_start = {
	events = {
		game_start.1 # Spawn special/hidden countries
		# dozen events
	}
}

on_game_start_country = {
	events = {
		game_start.33 # populate system with stations
		# dozen events
	}
}

# No scope, like on_game_start
on_monthly_pulse = {
	events = {
		unrest.162
		# dozen events
	}
}

The filename of this file is 00_on_actions.txt. And I can add as many of these as I want like for example in another mod (with filename my_mod_on_actions.txt):

on_game_start = {
	events = {
		my_mod_event.1
		# dozen events
	}
}

And it will be called on game start action regardless of how many there are. The only way for me to overwrite anything from vanilla or another mod is to actually use the filename overwrite. Basically in my mod make a new file called 00_on_actions.txt and this will overwrite what I want from vanilla.

I hope you can see where my confusion comes from.

So am I correct in assuming that on_actions structure is different? Irony should be able to handle the scenario problem is just me fully understanding this part.

I'll run some tests, because I have no idea =)

I'd assume they work the same or in similar fashion. An example of a stellaris GUI file would be:

guiTypes = {
	containerWindowType = {
		name = "achievement_window"
		position = { x=-550 y=-155 }	
		size = { width=512 height=128 }
		orientation = LOWER_RIGHT
		
		background = {
			name = "background"
			quadTextureSprite = "GFX_tile_outliner_bg"
		}
		
		instantTextBoxType = {
			name = "achievement_title"
			font = "malgun_goth_24"
			text = "Achievement unlocked!"
			position = { x = 10 y = 0 }
			maxWidth = 450
			maxHeight = 20
			fixedSize = yes
			orientation = "UPPER_LEFT"
			format = left
		}

		buttonType = {
			name = "achievement_closebutton"
			quadTextureSprite = "GFX_close"
			position = { x = -41 y = 13 }
			Orientation = "UPPER_RIGHT"
			shortCut = "ESCAPE"
			pdx_tooltip = "CLOSE_TITLE"
			clicksound = "back_click"
		}
		
		iconType = {
			name = "achievement_icon"
			position = { x = 18 y = 34 }
			spriteType = "GFX_planet_background_frame_blocker"
		}
		
		instantTextBoxType = {
			name = "achievement_header"
			font = "cg_16b"
			position = { x = 128 y = 36 }
			text = "The Industrial Re-Revolution"
			format = left
		}
		
		instantTextBoxType = {
			name = "achievement_text"
			font = "cg_16b"
			position = { x = 128 y = 58 }
			text = "Earn a mineral income each month above 1000"
			format = left
		}

		# Invisible button over the main area of the view so that we can click on anything to activate more info
		containerWindowType = {
			name = "mainwindow_overlay"
			position = { x=0 y=0 }    
			size = { width=460 height=128 }

			background = {
				name = "mainwindow_overlay_bg"
				quadTextureSprite = "gfx_transparency_button"
				#alwaysTransparent = yes
			}
       	}
	}
		
	containerWindowType = {
		name = "achievements_view"
		position = { x=0 y=0 }	
		size = { width=100% height=100% }
	}
}

So if I wanted to create a partial override I could just dump in a separate file:

	containerWindowType = {
		name = "achievements_view"
		position = { x=0 y=0 }	
		size = { width=50% height=100% }
	}

And be done with it.

Next part localization I guess. Does CK3 have localisation\replace folder and does it declare localisations with a priority id. An example:

l_english:
 key:0 "Localisation text"

These are all annoying questions but Irony tries to cover all aspects of duplicate detections from GFX, Localisation and scripts. For Stellaris it also detects base game stuff so not just mods.

@bcssov
Copy link
Owner

bcssov commented Nov 5, 2021

Just an example of what my conflict solver looks like in my stellaris game.

If I turn on game duplicate detection
2021-11-05_16-19-46

How many folders it conflicts with
2021-11-05_16-23-59

GFX detection
2021-11-05_16-25-23

Localization detection
2021-11-05_16-25-55

Underneath CWTools is used to validate every script from various mods.

@chatoustikmou
Copy link

It's a bit clearer but what I might be missing is some context. It does not seem as though the on_action are similar to how they work in stellaris. In stellaris (this is snippet from a vanilla file):

And it will be called on game start action regardless of how many there are. The only way for me to overwrite anything from vanilla or another mod is to actually use the filename overwrite. Basically in my mod make a new file called 00_on_actions.txt and this will overwrite what I want from vanilla.

I hope you can see where my confusion comes from.

So am I correct in assuming that on_actions structure is different? Irony should be able to handle the scenario problem is just me fully understanding this part.

It works the same in CK3.
The only difference might be that in CK3, on_actions can have their own trigger and effects block? Not sure if Stellaris allows for those, but your examples suggest that maybe Stellaris on_actions can only fire events, which will execute effects, whereas CK3 on_actions can execute effects directly, without using an event?

I'd assume they work the same or in similar fashion. An example of a stellaris GUI file would be:

Seems to be the same, yes

Next part localization I guess. Does CK3 have localisation\replace folder and does it declare localisations with a priority id. An example:

l_english:
 key:0 "Localisation text"

Yes, there's a localization\replace folder as well (though I think technically speaking, it is possible to replace loc keys without putting them in that specific folder, but I'll have to check).

But if by priority ID you mean the number 0 in your example, that's not a priority ID, but a versioning number for internal use by PDX which has no impact whatsoever on modding, at least not in CK3 (confirmed multiple times with PDX devs).

These are all annoying questions but Irony tries to cover all aspects of duplicate detections from GFX, Localisation and scripts. For Stellaris it also detects base game stuff so not just mods.

Not annoying at all, anything I can do to help =)

@bcssov
Copy link
Owner

bcssov commented Nov 5, 2021

It works the same in CK3.
The only difference might be that in CK3, on_actions can have their own trigger and effects block? Not sure if Stellaris allows for those, but your examples suggest that maybe Stellaris on_actions can only fire events, which will execute effects, whereas CK3 on_actions can execute effects directly, without using an event?

Yeah you only define events last time I checked (I didn't play stellaris for a really long time so I'm not up to speed with it). Last the guys added was to allow modders to fire custom on actions -- which previously was unavailable. But you define triggers in stellaris events actually. An example of vanilla event trigger:

	trigger = {
		host_has_dlc = "Ancient Relics Story Pack"
		owner = { is_ai = no }
		solar_system = { has_star_flag = precursor_zroni_1 }
		solar_system = { NOT = { is_same_value = root.owner.capital_scope.solar_system } }
		NOT = { has_global_flag = zroni_started }
		FROM = {
			has_anomaly = no
			NOT = { exists = archaeological_site }
			habitable_planet = yes
		}
		owner = {
			NOR = {
				has_country_flag = baol_intro
				has_country_flag = vultaum_intro
				has_country_flag = yuht_intro
				has_country_flag = first_league_intro
				has_country_flag = irassian_intro
				has_country_flag = cybrex_intro
				has_country_flag = zroni_intro
			}
		}
	}

So basically I had a friend send me this on_death action from CK3 vanilla which looks like this:

on_death = {
	effect = {
		play_music_cue = "mx_cue_death"

		add_character_flag = { flag = about_to_die_but_not_dead_yet_flag } # Used in perk calc

		if = {
			limit = {
				is_ai = no
				exists = player_heir
			}
			player_heir = {
				add_character_flag = {
					flag = tutorial_reactive_advice_succession
				}
			}
		}
		if = {
			limit = {
				exists = global_var:mongol_empire_was_broken_up
				exists = global_var:handed_out_mongolia_in_mongol_succession # If Mongolia wasn't properly granted, something has gone wrong, and the primary_heir should receive the Mongol Empire as expected
				any_held_title = {
					this = title:e_mongol_empire
				}
			}
			destroy_title = title:e_mongol_empire
		}

		invalidate_claimant_factions_on_death_effect = yes
	}
	events = {
		death_management.0096	# Updates marriage opinions of other spouses if relevant.
		death_management.0097	# Sets a flag if the dead one was someone you loved (to make suicide available)
		death_management.0098 	# Removes rejected_from_marriage_bed_modifier if spouse dies
		death_management.0099 	# If spouse is pregnant, save as variable
		death_management.0001 	# Finds characters which would care about death for notifications etc.
		intrigue_dread.4012		# Interrupts this event chain for the imprisoner when their prisoner dies.
		stewardship_duty.1065 	# Removes the patron buff from their employer when this character dies.
		stewardship_duty.1067 	# When you die removes your clients fron your court.
		great_holy_war.0024		# Replace recipient for ongoing GHW.
		great_holy_war.0028 	# Beneficiary died, reset and replace.
		great_holy_war.0080 	# ghw_sponsor died, replace.
		great_holy_war.0083		# ghw fallback beneficiary dies.
		religious_decision.0301 # ancestor died and needs to be buried.
		religious_decision.0311 # Dynasty member has died and you can raise a runestone
		game_rule.2				# Exclave Independence
		martial_authority.2057	# Right-Hand Person Dies 
		martial_authority.2055  # Right-handed Person (person with right-hand) Died
		fp1_yearly.0052			# FP1: Rumoured Draugr
		fp1_yearly.1061			# FP1: Ship Burial
		fp1_other_decisions.0062	# FP1: someone intending to HumSac you has died
		fp1_other_decisions.0063	# FP1: designated HumSac has died
		fp1_other_decisions.0064	# FP1: remove counties offended by HumSac modifier
	}
}

What confused me what your example a bit, I understood that regardless of the filename I used if on_death is present it would overwrite vanilla.

Now it sounds like it doesn't matter as long as the filenames don't match though.

on_death = {
   events = { custom_event.0001 }
   on_actions = { custom_on_action }
}

Also in this on_action I see a familiar events array which calls multiple events same as in stellaris. And the only way to overwrite this is to call my on action file death.txt as this file.

Yes, there's a localization\replace folder as well (though I think technically speaking, it is possible to replace loc keys without putting them in that specific folder, but I'll have to check).
But if by priority ID you mean the number 0 in your example, that's not a priority ID, but a versioning number for internal use by PDX which has no impact whatsoever on modding, at least not in CK3 (confirmed multiple times with PDX devs).

To be honest I had to check my notes on the logic I wrote, trust me this taking into account is a really taxing job. You can theoretically overwrite stuff by using filename or some other trick but the method is unreliable (without using replace folder). It is in Irony that I use this priority (or version) to indicate to people that the author probably intended a certain localisation item to be used. You cannot reliably overwrite stuff when you have 2 duplicate items and game does not seem to follow any pattern that can be discernible in case of Stellaris at least. Judging by your answer same applies to CK3.

@YenLegion
Copy link

Even if there was a way mark if a mod has the same files as any other mods would be very useful. I'm always doing searches when I get a new mod to see if there are any conflicting files.

@Nilserich
Copy link

Is this feature actually still a thing. It's been a while since the last comments.

Without being able to help out much, this would actually be really significant for CK3.

Now, Conflict Solver has never been requested so far for any other game. I've tried expanding on Conflict Solver support by testing the waters of HOI4 community, I failed to find any interest. Some of my friends who play EU4 and HOI4 told me that there's not much to gain by adding a conflict solver for these games as most people play a bunch of overhaul mods...

While this is actually so in CK2, EU4, HOI4, the modding mindset and scope of CK3, is now very much Stellaris inspired.

The issue is however that I'd need something like this: https://stellaris.paradoxwikis.com/Modding#Overwriting_Specific_Elements

Thoughts on how to get this "project" kickstarted?

@bcssov
Copy link
Owner

bcssov commented Jul 23, 2022

Stellaris has 6 years of experience documented etc CK3 still has none to my knowledge. I still don't own the game so I'm looking for help from someone who owns it. I was asked a couple months back about my experiences of adding this to HOI4 (analyze mode only). These were my thoughts on discord:

Well the approach to HOI4 did not take lot of coding just a lot of re-running of unit tests and seeing the results and adjusting parser mapping. HOI4 had instances where objects were defined on 2nd or 3rd level which required tweaking to extract this piece of information properly and wrap it all up to tie into the existing logic.

Ex. of where it differs from Stellaris:

political_decisions = {
    definition = {
    }
    definition2 = {
    }    
}

There was no need to adjust any service layer logic significantly aside from adding support to "replace" folder for gfx handling. HOI4 appears to have "replace" folder support for gfx types much like localization "replace" folder has for Stellaris. Maybe even Stellaris supports it, I'm not sure. Of course after each exception is added per folder I add a unit test to verify that it will trigger a proper parser.

The unit tests that are run are of 2 types. First a simple one which tells me what types of extensions there are, its how I learned that HOI4 uses actual lua for defines. This hurt as I had to extend the logic to support lua syntax in the defines parser.

And the 2nd one where I ran the unit test which gives this kind of output:

-------------------
Undefined
-------------------
gfx\fonts\arimo\LICENSE.txt
interface\credits_l_simp_chinese.txt
...

-------------------
Invalid
-------------------
localisation\simp_chinese\federations_anniversary_l_simp_chinese.yml
...

-------------------
Single Objects
-------------------
common\ai_espionage\operations\00_base_policies.txt
...

-------------------
Objects
-------------------
common\ambient_objects\ambient_objects_test.txt: test_object_1
common\ambient_objects\ambient_objects_test.txt: test_object_2
...

And then go through each folder or file to see what kind of adjustments are needed on the detected object(s).

The undefined category tells me that the parsers returned nothing as in empty file, this warrants investigation to see whether the file is actually empty or parser failed somewhere.

The invalid category tells me that the parser attempted to parse the file but failed, this also needs investigation to see where the parser failed. As in new kind of syntax that parser needs to be extended to support or empty file. In this instance the localization file is empty with language declaration only.

Single objects category could be a false positive, this tells me that only a single object type was detected in this category. This warrants further investigation, it is how I discovered that HOI4 has unique definitions like these:

political_decisions = {
    definition = {
    }
    definition2 = {
    }    
}

Objects should probably say duplicate objects. This means Irony detected duplicate object definitions, these can be actual false positives to manual intervention and override in game parsers. Really depends on the scenarios.

As you can see this is only the first step. HOI4 still doesn't have conflict resolution capability and I doubt it will in the near future.

@Nilserich
Copy link

Ahh, I see. You can't expect that to be implemented in the near future.

I like to use the Conflict Solver and have worked with it quite a bit. I would love to help there. But to be honest, my knowledge is clearly limited. What I know (not only modding, but programming itself) is very rudimentary and learned autodidactically.

@bcssov
Copy link
Owner

bcssov commented Jul 26, 2022

Help wanted label is attached to this ticket (and has been for a while). I am losing hope though since it's been a while like this.

@wtchappell
Copy link

What would the process be to manually figure this out by just trying things?

I understand it's a huge amount of things to check, and probably isn't much fun. But if we made a checklist with every common folder in it and the questions we need answered about each we could slowly start chipping away at the problem.

@bcssov
Copy link
Owner

bcssov commented Jul 28, 2022

What would the process be to manually figure this out by just trying things?

If you mean detecting how folders are loaded in the game probably by trial and error. You document how the game behaves. Ex.
You got an element in game in common\some folder\file.txt
Sample logic

element = {
code
}
element2 = {
code
}

Then you try to override an element. You pick one element out and put in say
common\some folder\!!!_file.txt

element = {
modified code
}

And document whether your override took effect (load the game test changes).

This is how it's been done through crowd sourcing in Stellaris. Lot of modders contributed to the wiki. For a lone person to do this is very daunting task.

Please do note that I've been told here that maybe the game doesn't even take this into account (FIOS\LIOS like in Stellaris\HOI4) and instead it actually used Load Order. But since I don't own the game I've never been able to confirm.

BUT before anything is done one first we need to make Irony understand how to detect duplication in CK3. So before doing what I just described this applies before anything: #271 (comment)

Naturally this means one must setup Irony in VS then perform the steps described in that message.

In case anyone is interested and wants some more help they can visit the Irony discord and hit me up there. I'll try to respond as soon as I can.

@bukowa
Copy link

bukowa commented May 29, 2024

I also found this https://github.com/nickbabcock/jomini
Maybe there should be some way for the people to allow writing their own rules in a scripting manner?

@bcssov
Copy link
Owner

bcssov commented May 29, 2024

Um, what?

  1. Jomini is written in a separate technology than Irony
  2. Irony already has its own parer which is specialized for the kind of behavior it is supposed to do

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request help wanted Help wanted on the issue
Projects
None yet
Development

No branches or pull requests

8 participants