Vovan's UnitUpgrades Mod... UPGRADED with promotions and better layout

Progor

Chieftain
Joined
May 9, 2006
Messages
20
Vovan's UnitUpgrade mod was originally designed to automatically look at all the units in the game, and draw out a map of how they upgrade. It worked pretty well on Vanilla Civ4, but as other mods have tried it (it is included with Sevopedia), it's deficiencies are beginning to show.

It's first major problem was that it had no means of placing the unit icons intelligently on the screen, so upgrade paths got very convoluted quickly. This upgrade fixes that problem with an implementation of a graph layout algorithm. While finding the absolute best looking layout might take several minutes, especially with the bigger mods, this algorithm does a pretty good job in about a second.

Second, the Vovan used the same arrows as the Tech tree. Those work great for the tech tree, but were pretty jumbled for unit upgrades. This mod uses new angled arrow graphics that I developed specifically for it. These arrows show much more clearly the path from a unit to its upgrade, and since the layout algorithm tries to keep upgrades close to the unit(s) they upgrade from, the chart as a whole is a lot more readable.

Finally, while Vovan talked about extending it for promotions as well, he never got around to it. But I've added the code to show the upgrade path of promotions as well.

Please note, that this is primarily a modders mod. If you want to play Vanilla Civ with this as the only mod you have, UnitUpgrades.zip is for you. Just unzip it into your mods folder, select it from advanced->load a mod, and go for it.

If you're running the Sevopedia, I have begun to update a version of the Sevopedia with my own and a few other updates, notably fitchn's index and Gaurav's air unit fix (Thanks guys!). You will find it attached below, to simplify integration into your own mod or personal modcomp.

If you're a modder looking to integrate this into your mod, you will find several variables to help you customize the mod for your units in:
\Assets\Python\UnitUpgrades\UnitUpgradesGraph.py
The comments will help you with what the variables mean, or you can post here with questions.

Finally, the screenshots you've been waiting for.





Version History:
0.1 - Initial release
0.2 - Fixed a bug in integrating with other mods: if the other mod removed an entire unit class from a particular civilization, it would choke. Thanks Caesium.
0.3 - Removed an old dependency on the DiGraph class that was causing some to have load failures. Thanks Fitchn and Caesium.

This is considered a beta version since I have only tested it with a few mods (including Fall from Heaven). It seems to work well, but only time will prove it worthy of a 1.0 release. Please report any bugs you find in this thread.
 

Attachments

  • UnitUpgrades 0.3.zip
    17.4 KB · Views: 491
  • sevopedia.zip
    64.9 KB · Views: 621
Youc ould maybe help me. As I integrated this into Sevopedia, while starting the Upgrade Chart while playing the game, I get the following error message:
Traceback (most recent call last):

File "CvScreensInterface", line 196, in pediaMain

File "CvPediaMain", line 588, in pediaJump

File "CvPediaMain", line 341, in showScreen

File "CvPediaMain", line 525, in placeUpgrades

File "UnitUpgradesGraph", line 166, in getGraph

File "UnitUpgradesGraph", line 121, in getUnitName

AttributeError: 'NoneType' object has no attribute 'getDescription'
ERR: Python function pediaMain failed, module CvScreensInterface
 
Are you running any other mods? Is your sevopedia in CustomAssets or in a mod folder by itself? That's saying that somehow, there's not a unit in the range where there's a unit... rather confusing...

At first I thought, Doh! I never actually went into a game to test it... but it's working fine even in a game at least with just Vanilla Civ.

I'll be out for most of the day after the next 30 minutes, but I'll try to check this thread this afternoon sometime if you don't reply by then.
 
I combined just a few mods to a new one and sevo mod is a part of it. If you want to, i'd load the latest version to the web and send you the link, for that you can look through my Unit Declarations.
 
Good work!!
I'll donwload it when you get to a more stable version.
 
Groovy.

I'll patch this into Sevomod tonight. I'm going on vacation this weekend so I hope to upload and post a new version before I go and this will be a great finishing touch. Great work!
 
Caesium said:
I combined just a few mods to a new one and sevo mod is a part of it. If you want to, i'd load the latest version to the web and send you the link, for that you can look through my Unit Declarations.

Yeah, zip it up and PM me a link to it, and I'll install it and see if I can find the bug, whether it is in your stuff or mine.
 
Caesium, your error is fixed in version 0.2. Just grab the UnitUpgradesGraph.py out of the Assets/Python/UnitUpgrades folder and replace yours, and you should be good to go.

I hadn't considered the case where a mod removed an entire unit class from a civilization, like some of the tanks in your mod. It was just a two line fix to test for that case though, but that's what betas are for :D
 
Sure! So far, I've got everything working except getting links to update the left category column from either the upgrade chart or fitchn's index. Sevo, if you read this, do you know what might cause that? I'm guessing self.iCategory needs to be updated, but I'm not sure what function gets most immediately fired by a button push.
 
Progor said:
Sure! So far, I've got everything working except getting links to update the left category column from either the upgrade chart or fitchn's index. Sevo, if you read this, do you know what might cause that? I'm guessing self.iCategory needs to be updated, but I'm not sure what function gets most immediately fired by a button push.

This has been a problem since day one. I changed the way the base 'pedia functions--in the vanilla pedia the "main" selection column is not present and doesn't need to be updated, but in mine it obviously is visible but still isn't updated. I tried a few times to rememdy that by changing self.iCategory and whatnot, but it never seemed to work. I haven't looked at it for a long time, but that's the core of the problem.
 
It took a little bit of reworking to pass around all the right values for the category list and subcategory list, but I got that little bug smoothed out. iCategory is no more... in its place, placeLinks takes the category ID, and displayTopic takes the subcategory ID as a parameter. Each function along the chain that ends up at these functions also passes the values along.

I've also gotten my update to Vovan's Unit Upgrade Chart and my Promotion Chart merged into this version.

Finally, I've gotten fitchn's Civilopedia Index integrated. I made a subcategory list with A through Z in it so you can quickly click to the right letter. This has the nice side effect of speeding up Index access and not having to wait five seconds for it to draw the whole panel offscreen before displaying it.

Sevo, feel free to integrate any or all of this into the official version if you wish.

Finally, the obligatory screenshot is attached, along with the fully updated Sevopedia mod.

Edit: Attachment updated to handle foreign languages and not display letters with no entries. Re-download sevopedia.zip and install over the previous version.

Edit: The zip has been moved to the original post, to make it easier to keep up with updates.
 

Attachments

  • SevopediaPlus.JPG
    SevopediaPlus.JPG
    148.5 KB · Views: 518
It works fine, but, could you also implementother languages? What I mean is, that, here in Germany, there exist also the "Ä", "Ö" and "Ü", or for the french, there is an "É" or something else, at the beginning of a word.
And would there be a possibility, that, if there are no entries, eg for "X", that the"X" won't appear in the list.
 
Caesium said:
It works fine, but, could you also implementother languages? What I mean is, that, here in Germany, there exist also the "Ä", "Ö" and "Ü", or for the french, there is an "É" or something else, at the beginning of a word.
And would there be a possibility, that, if there are no entries, eg for "X", that the"X" won't appear in the list.

Sure thing. The post has been updated with a new attachment. Now it gets everything in the index, sorts it, then displays the list based on the first letter it finds in each entry. That should work for any language, and it automagically skips over letters with no entries. Let me know how it works with your German version.
 
Progor said:
*snip*
Finally, I've gotten fitchn's Civilopedia Index integrated. I made a subcategory list with A through Z in it so you can quickly click to the right letter. This has the nice side effect of speeding up Index access and not having to wait five seconds for it to draw the whole panel offscreen before displaying it.
*snip

Simply beautiful! I'm honored to have my simple mod incorporated into what is fast becoming the Civilopedia standard!

When I created the Civilopedia Index, I had planned on adding numerous other enhancements to it (including more optimized code), but I've spent most of my time working on my current project. Maybe sometime I'll get around to it, but until then, this one is definitely going in CivMore!

Keep up the good work Progor...! ...and Sevo! ...and Voran! ...!
 
fitchn said:
Simply beautiful! I'm honored to have my simple mod incorporated into what is fast becoming the Civilopedia standard!

When I created the Civilopedia Index, I had planned on adding numerous other enhancements to it (including more optimized code), but I've spent most of my time working on my current project. Maybe sometime I'll get around to it, but until then, this one is definitely going in CivMore!

Keep up the good work Progor...! ...and Sevo! ...and Voran! ...!


Awesome. The 'pedia was my first big project and something I felt was sorely needed. Once it was done I felt like I had maybe 90% of what I had envisioned, and if it had a few bugs I could live with them. But they bothered me...

So definitely kudos & cheers, Progor! Vovan's upgrade charts, and now your promotions chart and fixes, and Fitchn's index--this puppy is tuned up. This should be a standard!

We should call it the "ProSeVoFitchapedia", or perhaps the "SeVoFitchPropedia"...or something...:crazyeye:
 
Sevo said:
*snip*
We should call it the "ProSeVoFitchapedia", or perhaps the "SeVoFitchPropedia"...or something...:crazyeye:
:lol:

I downloaded the file and unzipped it to my MODS directory, but the Civilopedia (or ProSeVoFitchapedia, or... :crazyeye:) won't load! I'm not getting any errors, I just get nothing when I click on the Civilopedia menu option. Does this mod need the original Sevopedia to work, or am I missing something else? I am running 1.61 with nothing in my customAssets directory...
 
Top Bottom