Combat Unit Rebalancing (CUR) - need help

subtledoctor

Warlord
Joined
Feb 6, 2014
Messages
106
Edit: it seems to be working now! New, functional files should be attached below if anyone is interested in trying it out. I'm playing my first game with it and it seems fine/fun. What is NOT changed are text descriptions. I don't know how to do that, and the mod is basically functional so I'm just going ahead and playing with it.

Reading through some threads around here, I came to ponder the two most annoying aspects of Civ5 combat units: early archery vs. siege imbalance, and the crazy Pikeman-Lancer upgrade line. I decided I could cobble something together that would address those issues.

First: all archery units get a penalty to city attack. Also, due to the bug where the cover promotion doesn't protect ranged units against city bombardment, siege units' ranged strength is bumped by 50%, and the City Siege bonus drops to +100%. Siege units now do exactly the same damage to cities, but take less damage from city bombardment.

Second: the Pike Question. With this mod spears, pikes, muskets, rifles, and infantry are simply baseline troops, and that is now the basic infantry upgrade path. Longswords upgrade to Musketmen and join the upgrade path there. But that creates a Lancer Question. Putting them on the horse upgrade path seems silly and boring, because they appear only a single tech before Cavalry.

Instead, Lancers become medieval light cavalry, Str 18 and appearing at Civil Service. Pikes are the basic soldiers, while Longswords and Lancers are special troops with bonuses from strategic resources. All horse units get a 25% attack bonus to simulate the disruptive nature of a cavalry charge. This sets up a nice rock-paper-scissors dynamic among spears/horses/swords.

Knights are elevated to heavy cavalry. They carry the best qualities of Longswords and Lancers, reflected in a very high strength. But they require both iron and horses, and move slightly slower than horsemen (3 move), and must dismount to fully engage the enemy (no move after attack). They can massacre anything in the medieval era, and they stand toe-to-toe against musketmen through the Renaissance.

Gunpowder changes everything, naturally - Muskets can stand against Knights, and then gatling guns become the ultimate anti-mounted unit. In the modern era, Anti-Tank Guns become a ranged unit so they can actually damage (i.e. reach) Tanks; and they upgrade to Bazookas, which are 2-range with an anti-armor promotion. Machine guns are eliminated.

Other changes: I doubled iron and horse requirements for early units, to make them more special and rare. The forge and stable now give extra resources, like the recycling center with aluminu). UUs generally keep the lower requirements, to make sure they are available to influence things. What else… I also changed the prerequisites for some promotions that I thought are too far down the line (who ever wants to take Shock III? I want to start specializing my army sooner).

Anyway, here's the problem: I tossed my .xml file into WHoward's "my changes" mod wrapper, started a game, checked the CUR mod only and… it doesn't seem to be working. I enabled logging but can't really make heads or tails of them. I don't want to ask people to bug-test for me… but if the above sounds like an interesting mod, and you can take a look at my files and see if anything jumps out at you, I would greatly appreciate it.
 

Attachments

You've renamed the MyXmlChanges.xml file to CUR.xml but not changed the associated <Actions> entry (in red below)

Code:
  <Actions>
    <OnModActivated>
      <UpdateDatabase>[COLOR="Red"][B]XML/MyXmlChanges.xml[/B][/COLOR]</UpdateDatabase>
      <UpdateDatabase>SQL/MySqlChanges.sql</UpdateDatabase>
      <UpdateDatabase>XML/MyUiTextStrings.xml</UpdateDatabase>
    </OnModActivated>
  </Actions>
 
Hmm, fixed that, and also ticked the "0" to a "1" a few lines above it, but still no joy. Sigh. I guess I'll have to do some real debugging, enable the mod in discrete chunks and see which one is problematic. Why doesn't programming just work??
 
0 should NOT need changing to a 1 - as database update files should NOT be imported into the VFS.

Enable logging and check the database.log file - now the xml is being used to update the database there are probably errors being reported
 
I can't seem to get logging to work, but I'm doing okay debugging it. It seems to be choking when I try to remove promotions. E.g. this doesn't work:
Code:
<Unit_FreePromotions>
	<Update>
		<Where UnitType="UNIT_KNIGHT" />
		<Delete PromotionType="PROMOTION_CAN_MOVE_AFTER_ATTACKING" /> 
	</Update>
</Unit_FreePromotions>
And it causes everything after it to not work. Am I doing that wrong? How do you remove promotions from a unit?
 
Not quite. It's actually much easier than that.

Note: I still use this XML/SQL Cheat Sheet all the time.

Code:
<Unit_FreePromotions>
[TAB]<Delete UnitType="UNIT_KNIGHT" PromotionType="PROMOTION_CAN_MOVE_AFTER_ATTACKING" />
</Unit_FreePromotions>
 
interesting, i came to kinda same ideas
double resource requirements i mean (great idea with forge/stable giving res!)
i have tweaked tech tree tough, to make things develop in more historical way. so there are a number of techs between the lancer and cav.

another thing, i have put limits on some unit classes, e.g. hoplite - you cant have more than 4 in your empire (as bronze requires rare metals), as well as chariots (which are strong units in my mod) as they are elite forces and chariots require rare wood and skilled artisans. so you have a number of cool units and other should be crappy ones - warriors, horsemen etc, if you want to have a big army.

ranged units were nerfed (5,8,12 str for archer,c-bow,x-bow), siege too but given cover and city bombardment radius decreased to 1 while its hitpoints increased so it should be bombarded for quite longer to take. now it makes sense to build other units not just archers.
 
Yes, chariots probably need a buff here - they're so pathetic, and get passed over so quickly, that I basically ignored them - except to drop them to range=1, along with all other horse archers. And archery units probably need a bit of a nerf, or else need to become more expensive... something.

I like the idea of mixed armies, with only small numbers of specialized units. That's what I try to do esource requirements, but I'm not sure it works; with, say, one 2-iron and one 6-iron in my territory, I could build 4 swordsmen, which is about as many as I would probably build anyway. Maybe triple the requirements...?

There's still a problem with Longswords being useless - it's so easy to beeline Gunpowder from Steel! Maybe move muskets back, to Metallurgy (now pretty empty without Lancers). And buff them as well - maybe with an attack bonus bringing them closer to Rifles on offense; which would give Rifles a de facto defense bonus - which, is basically what rifling really did.

Meh, the real problem is how short the tech tree is, as you pointed out. And I play on Epic speed, with a 30%-slower-tech mod! I can't imagine how quickly units must become obsolete playing on standard speed.
 
iron isnt always available.. sometimes you have 2 iron or even no iron.. double cost is ok imho. maybe other types should be given iron req too (crossbows, knights). and if you have no iron there should be a meh transition unit between warrior and musket, e.g. halberdier. is it possible to fork upgrade path in civ5?

see my tech tree:
 

Attachments

  • tree.jpg
    tree.jpg
    323.3 KB · Views: 77
there are upgrade paths:
warrior-sword-longsword-musket-rifle-wwi inf-inf
spear-pike-musket-...
horseman-knight-lancer-cavalry-wwi tank-tank-...
archer-bowman-crossbow-dragoon-gatling-mg-bazooka
chariot-crossbow-dragoon-gatling-mg-bazooka
catapult-trebuchet-bombard-cannon-rifled cannon-artillery
galley-galeass-frigate-gunboat-battleship-...
trireme-caravel-privateer-ironclad-destroyer

ps there should be chemistry-imperialism tie ofc too, and dynamite should lead to rep parts not assembly line
 
Edit: it seems to be working now! New, functional files should be attached below if anyone is interested in trying it out. I'm playing my first game with it and it seems fine/fun. What is NOT changed are text descriptions. I don't know how to do that, and the mod is basically functional so I'm just going ahead and playing with it.[/S]

Which text tags are you wanting to alter? Show one unit you'd like to change and what you'd like the help or civilopedia description text to say. Some text commands in the game are easy to dig out and get to, others not so much. May take a couple hours to get back with an example of how to make that change, especially since I've been having internet connection troubles lately, but I've done a lot of that stuff for buildings, etc.
 
To alter text strings, with Longswordsman as an example, first I go into the CIV5Units.xml using notepad, and do a "Find" for "Longswordsman". When I hit "<Type>UNIT_LONGSWORDSMAN</Type>" if see the following commands are part of the definition of the Longswordsman:

Code:
<Description>TXT_KEY_UNIT_LONGSWORDSMAN</Description>
<Civilopedia>TXT_KEY_CIVILOPEDIA_UNITS_MEDIEVAL_LONGSWORDSMAN_TEXT</Civilopedia>
<Strategy>TXT_KEY_UNIT_LONGSWORDSMAN_STRATEGY</Strategy>
<Help>TXT_KEY_UNIT_HELP_LONGSWORDSMAN</Help>

I normally wouldn't advise changing the <Description> unless you specifically want to call the usual Longswordman something else, but I've shown how you could change the in-game name the unit has to "Glocksman"

I can make up my own text to go into the game in place of the text that Firaxis used, like this:

Code:
<GameData>
	<Language_en_US>
		<!-- change to the <Help> texts -->
		<Update>
			<Set Text="It's a wonderful Longswordsman ! Costs one (1) [ICON_RES_IRON] Iron"/>
			<Where Tag="TXT_KEY_UNIT_HELP_LONGSWORDSMAN"/>
		</Update>
		<!-- change to the <Strategy> texts -->
		<Update>
			<Set Text="Build them as soon as you can because they're awesome and each one only requires 1 [ICON_RES_IRON] Iron!"/>
			<Where Tag="TXT_KEY_UNIT_LONGSWORDSMAN_STRATEGY"/>
		</Update>
		<!-- change to the <Civilopedia> texts -->
		<Update>
			<Set Text="Longswordsman were powerful units in their day !"/>
			<Where Tag="TXT_KEY_UNIT_HELP_LONGSWORDSMAN"/>
		</Update>
		<!-- change to the <Description> texts -->
		<Update>
			<Set Text="Glocksman"/>
			<Where Tag="TXT_KEY_UNIT_LONGSWORDSMAN"/>
		</Update>
	</Language_en_US>
</GameData>

None of this changes the references for which TXT_KEY_ tag the game uses for a unit, it just changes the text that is used by the game for inserting into <Help> for that unit, as an example.

Assuming you have BNW:

  1. The bad part is you will have to look in CIV5Units.xml, CIV5Units_Expansion2.xml, and CIV5Units_Inherited_Expansion2.xml to find the existing TXT_KEY_ tag names for each unit you want to alter the text.
  2. These three files are in C:\Program Files (x86)\Steam\SteamApps\common\Sid Meier's Civilization V\assets\DLC\Expansion2\Gameplay\XML\Units
  3. For DLC you'll have to start at C:\Program Files (x86)\Steam\SteamApps\common\Sid Meier's Civilization V\assets\DLC\Expansion2\DLC and then navigate down to find any unit that was added by DLC.
  4. Firaxis wasn't real consistent for how they did things so you may also have to look in C:\Program Files (x86)\Steam\SteamApps\common\Sid Meier's Civilization V\assets\DLC\Expansion\Gameplay\XML for the G&K versions of the units.

You can also find the actual in-game text Firaxis used here (for BNW):

C:\Program Files (x86)\Steam\SteamApps\common\Sid Meier's Civilization V\assets\DLC\Expansion2\Gameplay\XML\Text\en_US and look in the files for the TXT_KEY reference you need. The only problem is that Firaxis was really really inconsistent where they put things, so for some units you might have to look both at the G&K Text Folder and the Vanilla Text folder in order to find the existing text Firaxis used.

For the Longswordsman I would copy the TXT-KEY reference TXT_KEY_CIVILOPEDIA_UNITS_MEDIEVAL_LONGSWORDSMAN_TEXT to the clipboard, open a file in the Text Folder, and then do a "Find" command by pasting TXT_KEY_CIVILOPEDIA_UNITS_MEDIEVAL_LONGSWORDSMAN_TEXT into the pop-up box that opens when you do EDIT > FIND.

PS:

I use notepad when I do this sort of thing. If you use Wordpad, your command to do a "Find" will be a little different, as I recall.

The Firaxis-supplied text stuff is going to be in <Row> commands as opposed to <Update> commands.

There may be a reference or tutorial showing which tags for <Help>, <Description>, <Civilopedia>, and <Strategy> are used by which unit, but if so I haven't stumbled upon it yet. I think there is also a reference / tutorial for which commands (like [ICON_RES_IRON]) will make which Icon show as part of a text string. I thought I saw one, but I don't remember if it just shows how the icons look in-game, or if it also shows the command needed to add that Icon into a string of text.
 
Assuming you have BNW:

  1. The bad part is you will have to look in CIV5Units.xml, CIV5Units_Expansion2.xml, and CIV5Units_Inherited_Expansion2.xml to find the existing TXT_KEY_ tag names for each unit you want to alter the text.
  2. These three files are in C:\Program Files (x86)\Steam\SteamApps\common\Sid Meier's Civilization V\assets\DLC\Expansion2\Gameplay\XML\Units
  3. For DLC you'll have to start ...
Oh yeah it's terrible trying to find all of the UUs. Not only does each DLC have it's own directory in the Civ5 game folder, but they have other, duplicate directories within the expansion folders. There are dozens of subfolders and XML files you need to go through to find all of this stuff. Firaxis' file structure is very, very messy. (Or maybe it's Aspyr, I'm playing on a Mac.)

I use notepad when I do this sort of thing. If you use Wordpad,
I use Textwrangler for stuff like this - it's the ne plus ultra of text editors on OS X. (Except for BBEdit, which is Textwrangler's for-pay big brother, and only used by programmers.)

I actually tried to update the Lancer's 'strategy' text. But it stopped the mod from working. I think I commented it out, it should still be in the CUR.xml file attached above if you want to take a look.

I think all that really needs to happen before I would consider releasing this as a completed mod is 1) the various text entries for the Lancer need to be updated to show that it is a medieval, not a Renaissance, unit; and the entries for the Stable and Forge need a mention that they provide extra copies of the resources; and I'd like to switch the pictures of the Lancer and Knight, so the Lancer shows the guy with a square gray helmet pointing a lance, and the Knight shows the guy with the shining breastplate carrying aloft a blue banner.
 
I think all that really needs to happen before I would consider releasing this as a completed mod is 1) the various text entries for the Lancer need to be updated to show that it is a medieval, not a Renaissance, unit; and the entries for the Stable and Forge need a mention that they provide extra copies of the resources; and I'd like to switch the pictures of the Lancer and Knight, so the Lancer shows the guy with a square gray helmet pointing a lance, and the Knight shows the guy with the shining breastplate carrying aloft a blue banner.

If you changed the era for the unit that might be the problem. Units all seem to have an era component to the <Civilopedia> entry. It could be one of those deals where there's a hard-code to only want to place units into the Industrial era of the Civilopedia if they have TXT_KEY_CIV5_INDUSTRIAL_ as the leading element of the <Civilopedia> command, like <Civilopedia>TXT_KEY_CIV5_INDUSTRIAL_CARRIER_TEXT</Civilopedia> command. So if you changed its prereq tech to make it fit into the Modern era the game might not like that "string" for the <Civilopedia> command.

I didn't download your mod zip yet but I will to see if anything occurs to me.

I once had a mod refuse to load when I was trying to add a strategy entry to a Firaxis world wonder. I was trying to use "TXT_KEY_BUILDING_" but the game would only accept "TXT_KEY_WONDER_" as the start of the TXT_KEY character string. And it only demands that format for the Firaxis supplied wonders. New wonders you are adding can use a starting string element like I was used to using.
 
Your problem is right here, I think

Code:
	<Language_en_US>
		[COLOR="Red"]<Text>[/COLOR]
			<Update>
				<Where Tag="TXT_KEY_UNIT_LANCER_STRATEGY"/>
				<Set Text="The Lancer is the Medieval horse unit. It's fast and powerful, with a bonus when attacking other units."/>
			</Update>
		[COLOR="red"]</Text>[/COLOR]
	</Language_en_US>

No need of <Text> </Text> to act as a wrap-around of the <Update> command. <Text> must always be contained within the <Update>...</Update> or <Row>...</Row> commands.

try

Code:
	<Language_en_US>
			<Update>
				<Where Tag="TXT_KEY_UNIT_LANCER_STRATEGY"/>
				<Set Text="The Lancer is the Medieval horse unit. It's fast and powerful, with a bonus when attacking other units."/>
			</Update>
	</Language_en_US>

I saw your error pretty quick, but then I got to looking at your code to see what-all you are doing.

What you're doing with unit re-arrangments for class, tech, era, and O! I couldn't really begin to parse it. Dang! I would have backed off and retreated from that long long long ago. Kudos to you for figuring out how to re-work all that and get it to work!

I think I'll quietly slink off into a corner and stay with something simples, like buildings
 
Eh, it hasn't been very difficult. The problem is, you change one thing, you have to change a bunch of other crap near it to keep things balanced. But most of it is very minor. I learned a lot simply by examining other successful mods&#8230; tweaking unit characteristics, tweaking promotions, tweaking resource requirements - once I learned how to do each of those things, compiling them together was pretty simple. In fact it made debugging easy, since I could enable one section of the mod at a time (by just commenting out everything else) and see which parts cause it to fail.

[Edited to add:] Btw the code above doesn't work. When I used that method for altering text (even putting aside the eras thing) the mod ceased functioning.

Should text changes be in a different .xml file?
 
i'd recommend SQL format to change things and XML to add new.
SQL is imho less verbose and easier to comprehend
update Language_en_US set Text="..." where Tag="...";
and, you can easily do pretty smart things with it:
update Unit_ClassUpgrades set UnitClassType="UNITCLASS_LINE_INFANTRY"
where UnitType in (select Type from Units where Class="UNITCLASS_MUSKETMAN");
- this changes all the musketman units (standard plus all the UUs) that they upgrade to line infantry
 
Back
Top Bottom