Page MenuHomeWildfire Games

Use D2915 to cleanup champion templates
AbandonedPublic

Authored by wraitii on Aug 4 2020, 2:24 PM.

Details

Reviewers
None
Summary

This is an example of D2915 improvements.
We can now define Champion templates directly in terms of the underlying citizen soldier templates.
With a little more work on D2915, I could easily remove the "damage" nodes too, making the champion templates almost redundant.

This makes it much easier to update templates.

(this is an example with cavalry only).

Test Plan

Bask in the glory of this diff.

Event Timeline

Vulcan added a comment.Aug 4 2020, 2:24 PM

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/2866/display/redirect

Vulcan added a comment.Aug 4 2020, 2:25 PM

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/2328/display/redirect

wraitii added inline comments.Aug 4 2020, 2:25 PM
binaries/data/mods/public/simulation/templates/template_unit_infantry.xml
1

(artefact from D2915 itself, ignore this)

Vulcan added a comment.Aug 4 2020, 2:27 PM

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/macos-differential/1229/display/redirect

wraitii requested review of this revision.Aug 4 2020, 2:27 PM
Nescio added a subscriber: Nescio.Aug 4 2020, 3:02 PM

Rather than simplify things, this patch makes templates really much harder to understand.

We can now define Champion templates directly in terms of the underlying citizen soldier templates.

This is already possible right now without this patch.
One could move generic templates, e.g. template_unit_champion_cavalry_archer.xmltemplate_unit_cavalry_ranged_archer_champion.xml.
Or, alternatively, see how advanced or elite soldiers are done. Just let specific champion templates have citizen templates as their parent, insert <ResourceGatherer disable=""/>, give them a Champion class (or rank), and create a unit_champion.json technology along the lines of:

{
	"autoResearch": true,
	"tooltip": "Champions +100% resource costs, training time, health, and attack damage.",
	"modifications": [
		{ "value": "Attack/Capture/Capture", "multiply": 2 },
		{ "value": "Attack/Melee/Damage/Hack", "multiply": 2, "affects": "Melee" },
		{ "value": "Attack/Melee/Damage/Pierce", "multiply": 2, "affects": "Melee" },
		{ "value": "Attack/Melee/Damage/Crush", "multiply": 2, "affects": "Melee" },
		{ "value": "Attack/Ranged/Damage/Hack", "multiply": 2, "affects": "Ranged" },
		{ "value": "Attack/Ranged/Damage/Pierce", "multiply": 2, "affects": "Ranged" },
		{ "value": "Attack/Ranged/Damage/Crush", "multiply": 2, "affects": "Ranged" },
		{ "value": "Cost/BuildTime", "multiply": 2 },
		{ "value": "Cost/Resources/food", "multiply": 2 },
		{ "value": "Cost/Resources/wood", "multiply": 2 },
		{ "value": "Cost/Resources/stone", "multiply": 2 },
		{ "value": "Cost/Resources/metal", "multiply": 2 },
		{ "value": "Health/Max", "multiply": 2 },
		{ "value": "Loot/food", "multiply": 2 },
		{ "value": "Loot/wood", "multiply": 2 },
		{ "value": "Loot/stone", "multiply": 2 },.
		{ "value": "Loot/metal", "multiply": 2 },
		{ "value": "Loot/xp", "multiply": 2 }
	],
	"affects": ["Champion"]
}

The reason there are separate template_unit_champion_* templates is presumably because that allows changing champions independently from their citizen counterparts, and also from each other, offering far more flexibility. (As well as being easier to understand, since values are just defined in single templates or their parents, not in other files.)

This is already possible right now without this patch.
One could move generic templates, e.g. template_unit_champion_cavalry_archer.xmltemplate_unit_cavalry_ranged_archer_champion.xml.

That seems objectively superior to our current organisation to me.

Or, alternatively, see how advanced or elite soldiers are done. Just let specific champion templates have citizen templates as their parent, insert <ResourceGatherer disable=""/>, give them a Champion class (or rank), and create a unit_champion.json technology along the lines of:

This is both very inflexible, and has a performance impact -> not an option.

The reason there are separate template_unit_champion_* templates is presumably because that allows changing champions independently from their citizen counterparts, and also from each other, offering far more flexibility.

Yet champion templates are basically rewrites of the citizen versions right now, so that first sentence seems obviously mistaken.

Nescio added a comment.Aug 4 2020, 3:45 PM

That seems objectively superior to our current organisation to me.

While I'm not especially fond of the current template organization, I can understand why it's done the way it is.

This is both very inflexible, and has a performance impact -> not an option.

That's how it's done for advanced and elite units already, therefore it clearly is an option. (It's also the approach I've taken in my 0abc mod.)

Yet champion templates are basically rewrites of the citizen versions right now, so that first sentence seems obviously mistaken.

They're increasingly becoming so, yes, but that's because of the number of patches working towards standardization that have been committed in the past months. Last year champion types still had different speeds, attacks, costs, etc. compared to their citizen counterparts; basically the only think they shared were some sounds and a few classes.
(The reason I've proposed standardization patches is because I sincerely believe it's important to get a clean, consistent, and fairly balanced state first, in order to make it much easier to differentiate unit types, technologies, and civilization bonuses afterwards.)

Anyway, my main concern with the approach taken in this patch is that it makes templates much harder to understand. I'm not talking about just you and me, but also about others who might want to contribute in the future or modify the game. Some people already have difficulty understanding the parent line in xml files, having multiple parents would certainly not make things easier.

wraitii abandoned this revision.Apr 7 2021, 4:03 PM