• Civilization 7 has been announced. For more info please check the forum here .

Unit Promotion Planning Screen

jrandrew

Warlord
Joined
Nov 2, 2007
Messages
130
Location
L.A.
Hi All --

I love FfH, I love Fall Further, and now I love Wildmana (as FF has gone into hibernation.)

However, one problem I have is that the whole system of promotions and upgrades has gotten so complex that it's rather hard for me to start planning in the early game how to plan to best promote and upgrade a unit to something in the late game.

I usually play a few games as one civ, get a decent grasp on them, then get a bit bored and go looking for something else. By the time I return to the same civ again to try, they've changed a bunch again and I have to figure out what promotion chains are the most valuable.

For example, you have to mess around for a while to figure out that a good promotion strategy for the Austrin is Warrior -> Highlander (for free Guerilla I) to Tracker (for free Woodsman I and Sentry I) and onwards.

I would like to have one screen where I can see the possible promotion paths laid out for one unit, and all their benefits, requirements, etc.

For example:

1. What can they upgrade into at various points to get free promotions?
2. What religions might be required for particular conversions, upgrades, or promotions?
2a. What technologies are required for the upgrade, etc.
3. What other promotions would be available with new technologies and how far off are those technologies?
4. What spells are available at what promotions (a must for mages, so many promotions have been added I still haven't figured it out.)

It would be even better if I could use this screen when I am preparing to level-up a unit so I don't have to just guess or click one of 15 available promotions just for the heck of it because there are so many the decision is too tough.

I know that there is a promotion chain screen in the Civilopedia now, but I'd like to see something like that enhanced with a particular unit in mind that I want to upgrade.

There was a "Unit History" screen in some other modmods that gave a bunch of info about a particular unit, you could access it by clicking a small button near the Armageddon Counter. Perhaps this screen could be modified.

I'm certainly willing to lead development on this although I haven't worked much with anything besides XML (at least in FfH and Wildmana although I do a fair amount of programming for other things.) Any pointers, ideas, and examples would be appreciated!
 
Screens in Civ4 are written in python. The Techscreen probably is a good example what you want, just instead of listing Techs you list the Unitclasses the currently selected unit can upgrade to.
Assets/python/screens/CvTechChooser.py

There are quite a few other screens as examples.

I would start by editing the python of a screen to show the Unit Promotion planning, once that is done rename the python file and create a new screen and link to that python file.
 
As a small first step I was able to get the "Promotion Tree" screen really properly working in the Civilopedia. It wasn't showing a lot of promotions and relationships properly before. Turns out that is because it was written for base Civ, which doesn't have the possibility for a 3rd or 4th "or" promotion link, and an "and" promotion link.

Fixing it already makes a lot of promotions and links clearer for me!

I had to do two things to get this working:

1. Modify the "getGraphEdges(self, graph)" python function at line 569 of the "Assets\Python\Contrib\UnitUpgradesGraph.py" python file. Here is what the new function looks like:

Spoiler :

Code:
	def getGraphEdges(self, graph):
		iChanneling1 = gc.getInfoTypeForString('PROMOTION_CHANNELING1')
		iChanneling2 = gc.getInfoTypeForString('PROMOTION_CHANNELING2')
		iChanneling3 = gc.getInfoTypeForString('PROMOTION_CHANNELING3')
		for unitA in graph.iterkeys():
			unitB = gc.getPromotionInfo(unitA).getPrereqOrPromotion1()
			if (unitB > -1):
				self.addUpgradePath(graph, unitB, unitA)
			unitC = gc.getPromotionInfo(unitA).getPrereqOrPromotion2()
			if (unitC > -1):
				self.addUpgradePath(graph, unitC, unitA)
			unitD = gc.getPromotionInfo(unitA).getPrereqPromotion()
			if (unitD > -1):
				self.addUpgradePath(graph, unitD, unitA)
			# Added additional ifs and ors by jandrews 5/27/2010
			unitE = gc.getPromotionInfo(unitA).getPromotionPrereqOr3()
			if (unitE > -1):
				self.addUpgradePath(graph, unitE, unitA)
			unitF = gc.getPromotionInfo(unitA).getPromotionPrereqOr4()
			if (unitF > -1):
				self.addUpgradePath(graph, unitF, unitA)
			unitG = gc.getPromotionInfo(unitA).getPromotionPrereqAnd()
			if (unitG > -1):			
				self.addUpgradePath(graph, unitG, unitA)


2. The "Command III" and "Command IV" promotions are a bit odd, they have "Channeling III" both listed as required prerequisites, but "Command II" already has "Channeling III" as a prerequisite as well. This creates odd loops and a python exception when Civ is trying to create the promotion tree. I had to delete the "Channeling III" prereq requirement for both "Command III" and "Command IV" to get the code above to work. "Command II" already requires "Channelling III" anyway, so I don't see the big deal about removing it from the others.
 

Attachments

  • Civ4ScreenShot0004.JPG
    Civ4ScreenShot0004.JPG
    156.8 KB · Views: 133
  • Civ4ScreenShot0005.JPG
    Civ4ScreenShot0005.JPG
    177.7 KB · Views: 125
Making progress here, see a new screenshot attached of the Unit upgrade chart. It shows all units available to a civ, and even/also displays Unique Units for a Civ double-sized so that it is easier to see what is special about that Civ.

It also displays the various requirements for each unit, such as required resources, required religion, and so on (although the spacing is not quite right for some of these when it is a Unique Unit, but I will fix this.
 

Attachments

  • Civ4ScreenShot0007.JPG
    Civ4ScreenShot0007.JPG
    189.4 KB · Views: 105
looks good. Might want to also show the free promotions that you get if you upgrade to a unit.

Nice work on the Promotion tree btw :goodjob:
 
More progress, going to post an alpha of this very soon. Most of the trouble I am hitting now is more in the GUI-related stuff (getting the menus and rollovers to work the way I want.)

See another screenshot attached. Things are a bit prettier now, also, the upgrade chart displays how far away in terms of beakers you are from getting a particular unit. If you are in the middle of a game, the number of beakers is dynamically adjusted to subtract any progress you have made currently.

I was displaying the religion, resources, and other items required to get the unit, but I think it made the chart really cluttered and hard to understand, so I got rid of them.
 

Attachments

  • Civ4ScreenShot0008.JPG
    Civ4ScreenShot0008.JPG
    214.8 KB · Views: 106
Top Bottom