A New Domestic Advisor (sort of)

Requies

Prince
Joined
Nov 15, 2005
Messages
381
Ok, here's a new beta version of the "Special" Domestic Advisor I created.

Please download and bang on... errr, try it out and let me know if you run into any problems. (There shouldn't be any, but I added quite a bit of code, so I'm not sure if I got everything all nice and neat.)

NOTE: I have some questions in the third post of this thread, so after you're done "trying it out" if you could respond to the questions, that'd be really helpful.

Enjoy!

Special Domestic Advisor's additions:
________________________

Additional Features of Special Domestic Advisor
24. Added in Culture and GP thresholds onto the base screen
25. Added in a SECOND screen to allow more data to be viewed including...
26. Added Religion back in
27. Added in Specialists and the ability to CHANGE specialists from the Domestic Advisor screen and the ability to see the RESULTS from those changes.
28. Added in documentation for the changes in CvScreensInterface so that it is easier to figure out the differences for modding.
29. Re-wrote a LOT of code so that changing it becomes MUCH easier (yes, even more than the New Domestic Advisor).

New Domestic Advisor's readme:
____________________

This idea came about after seeing homegrown's re-write of the Domestic Advisor. There were some additional ideas which surfaced on the thread he started which unfortunately weren't completely implemented or were not incorporated into the original "Better Domestic Advisor." So, I decided to re-write the code integrating all the feasible suggestions and making some additional changes. As such, it is not meant to be a replacement to Homegrown's work, but rather an additional option.

Credits: Homegrown - for the original idea of the Better Domestic Advisor and the basis of a lot of the code changes (including combining Happiness/Unhappiness, Health/Unhealth, Food/Food Used, adding City Maintenance, and Garrison Strength, for full list see below)
terrasol - for the changes to the color of the text to indicate problem values and for changes which fix the non-English language problems and additional small changes
Arkeide - for the base code to jumping to a city on the list.

Features
________

Columns and symbol meaning (also column order from left to right). Note: symbolsand words might be different depending on any mods you might have installed or your language.
Founded = Date Founded
Name = Name
Add Buildings = Landmarks
POP = Population
Arm Flexing = Garrison
Happy Face = Net Happiness (Happy faces - Unhappy faces)
Red Cross = Net Health (Health - Unhealth)
Red Bread Slice = Turns Until City Growth
Bread Slice = Net Food (Food - Food Used)
Hammer = Net Production (including any bonuses)
Red Gold Piece = Maintenance Cost
Arrow Triangle = Trade (from all trade routes)
Commerce = Commerce (Total Commerce gained in city)
Gold = Total Gold
Beaker = Total Research
Musical Note = Culture gained per turn
TOT = Total Culture
Figurehead = Great Person points gained per turn
TOT = Great Person points accumulated toward next Great Person
Producing = (How many turns until production is done) What the city is producing

Exit = Allows you to exit the Domestic Advisor
View = Allows you to view a selected city from the Domestic Advisor screen with a caveat (see Known Problem #2
Redraw = Allows you to get the table back to the "original" state

Homegrown's original features (reimplemented similarly)
1. Removed the Capital Star from the Date
2. Add a City Garrison column
3. Combine Happy/Unhappy/Angry into "Net Happiness"
4. Combine Food produced/eaten into "Food Turns until Growth"
5. Combine Healthy/Unhealthy into "Net Healthiness"
6. Add City Maintenance Cost
7. Add Turns til Production Complete
8. Institute Landmarks

Landmarks are to visually represent which cities contain special buildings or special situations. Examples are Versaille/Forbidden Palace, National Wonders, Power Plants, Revolt, Occupation.

Landmarks are represented as following:
Gold Star = Palace
Silver Star = Versailles/Forbidden Palace
Bullet Point = One National Wonder
Lightning Bolt = Power Available
Fist = Occupation
Rebel = Revolt

Additional Features (including work by terrasol and Arkeide):
9. Added coloring of text to problem values (e.g., starvation, unhealthy city, angry citizens, etc.).
10. Added code to allow jumping to the city screen of a city on the list according to where it is on the ORIGINAL list.
11. Removed Homegrown's religion column as it duplicates the Religion Advisor.
12. Added a Net Food Column in addition to the Turns Until Food Growth
13. Actually calculated how many turns until the city will lose a person to starvation and added it to the Turns Until Food Growth column if the Net Food is negative.
14. Added a Trade Column which lists the total trade a city takes in
15. Separated out the Commerce and Gold columns (and changed the icons to reflect this) so that you can tell how much of each you're actually making.
16. Removed Net Gold as it didn't really indicate how much a city was contributing.
17. Combined the Producing and # of rounds until production is complete into one column (and instead of having it at the end like in patch 1.09, added the # of rounds to the front so that you won't miss how many turns you have left).
18. Fixed problems with the Production column not showing the complete amount of production.
19. Re-wrote a lot of the code so that it is easily integratable with other mods.
20. Stretched out the Advisor so that there's a little more space for information.
21. Added in code so that updates work (somewhat) when changing production items while in the Domestic Advisor.
22. Re-wrote code so that it is easier to change in case of future new ideas or better access to data in cIV.
23. Documented a LOT of the class so that it is easier for others to change.


Installation
____________

New Domestic Advisor should NOT be installed in your main Civ IV location, as it will overwrite one necessary file.
Instead, it should be installed at: "My Documents\My Games\Civilization 4\.
Prior to installation make sure you have upgraded to patch 1.09 as the compatibility changed when Civ IV upgraded (some functions were renamed).
To install: Just unzip the zip file with the target being the above indicated directory (may be different for different languages).
Installation will create two new files (CvNewDomesticAdvisor.py in subdirectory CustomAssets\python\screen and DomPyHelpers.py in subdirectory CustomAssets\python) and will create a new copy of CvScreensInterface.py in CustomAssets\python\entrypoints. To uninstall, all that is needed is to move, remove, or rename the CvScreensInterface.py from the My Documents\My Games\Civilization 4\ directory AND ANY SUBDIRECTORIES OF IT.
Please note that you MAY have to clear your cache once or twice before the uninstallation will be complete. To do this, hold down the SHIFT button right after you launch Civ IV (i.e., double click the icon).
To combine this mod to another mod, just add the new files CvNewDomesticAdvisor.py and DomPyHelpers.py to the aforementioned My Documents directory (or your mod directory) and change the following lines from CvScreensInterface.py if you have changed it:

Old:
import CvDomesticAdvisor
New:
import CvNewDomesticAdvisor

Old:
domesticAdvisor = CvDomesticAdvisor.CvDomesticAdvisor()
New:
domesticAdvisor = CvNewDomesticAdvisor.CvNewDomesticAdvisor()

Known Problems
______________

1. If you choose another production item for a city to make while in the Domestic Advisor, and then you attempt to sort by Net Food, Growth, or Production, the sorting will be alphanumerically rather than by Number (i.e., "123" will be before "98" when sorting ascending). This occurs because 1) Sorting is ubiquitous to the Python modder and 2) the interface doesn't allow the Python modder access to data being displayed. As such, you need to use a key to change the correct fields. However, the only way to update using a key is through CyGInterfaceScreen's setTableTextKey method. There is NO equivalent for Ints. Therefore the sorting is by text.

Workaround: Basically, if you want to sort using those columns, exit the Domestic Advisor and come back in again. Sorting will work fine, then.

2. Because of the limitations specified in KP #1 above, after you sort your cities by any criteria except Date Founded ascending, you will NOT be able to correct jump to a City Screen from the Domestic Advisor.

Workaround: To jump to the City Screen. Click on the Redraw word in the lower part of the Domestic Advisor. This should set the table back to the order that the Python code can know about. After that, select the city you want to jump to and click on View, you should be able to jump to the correct city screen.

History
_______

v1.0
- first release (combined Homegrown's, terrasol's, Arkeide's and my own changes into a first release)

ED: Added attachment :blush:

ED2: Oops, noticed a problem with the installation directories the files should be in :blush:. Fixed.
 
Heck, might as well reserve this one, too.

So, some questions. Once you guys have fiddled around with the new Advisor:

1) Do you guys think I should add the Religions stuff back in? I'm thinking of redoing the Religious Advisor, so take that into account when answering.

2) What about the Net Gold column? Should I add it back in? Frankly, it just didn't seem worthwhile since you really don't care individually how each city is doing vs. the OVERALL picture, IMO. And if you really want to figure it out, it shouldn't be hard to subtract the maintenance from the gold taken in.

3) Any additional improvement suggestions? I thought about being able to resize it, but I just don't know if the engine will allow that. I'll take a look into it, but anything else?

4) Ok, I've figure out how to add a couple of more icon characters in. Would people prefer the Red Bread or Wheat Symbol for growth? Or some other resource one?

Req
 
Sounds cool. Downloading now. Thanks, friend.
 
I liked homegrowns mod, and this one is even better!
I do have a few suggestions:
- The title of the "Add Buildings" column doesn't really fit IMO, though I haven't any suggestions of my own...
- I don't like how the garrison column will be red when having few units, it's not like it's gonna lose pop or anything, perhaps only making it red when there are no units? Would you at least show me where to change it in the python files?
- The gold column should stay, just like the beakers column you don't exactly need to know how many each city is producing unless you want to construct some buildings. Of course, since you have commerce and science it's not really hard to now how much gold it's making.
- The red bread icon is rather confusing for what it represents, perhaps making another TOT column next to the food one?

Just my 2 cents.
 
rendermad said:
I liked homegrowns mod, and this one is even better!
I do have a few suggestions:

Cool. Thanks for the suggestions. Now to respond.

rendermad said:
- The title of the "Add Buildings" column doesn't really fit IMO, though I haven't any suggestions of my own...

Part of this was because I didn't want to add too much additional code while keeping it mainly different language friendly. Because I used terrasol's idea of reusing text that was already in Civ, it had the header of Add Building (Additional Building). But thinking on it, it might actually be wrong in a foreign language :lol:. Oops, hmmm, well, maybe I'll change it back to homegrown's Landmarks header. But that means changing a whole another file and making it more incompatible with other mods....

rendermad said:
- I don't like how the garrison column will be red when having few units, it's not like it's gonna lose pop or anything, perhaps only making it red when there are no units? Would you at least show me where to change it in the python files?

Hmmm, that makes sense. I was using the default one that terrasol was using, but Garrison < 1 makes sense. To change it, all you need to change is GARRISONPROBVALUE in CvNewDomesticAdvisor.py from 3 to 1. (BTW, this is an example of the optimization I made so that changes could be made easier. Neat, huh? :) ) I just might make it myself since this is a DOMESTIC Advisor.

rendermad said:
- The gold column should stay, just like the beakers column you don't exactly need to know how many each city is producing unless you want to construct some buildings. Of course, since you have commerce and science it's not really hard to now how much gold it's making.

Heh, I guess I wasn't very clear about what I was talking about. In homegrown's version, he had a "Net Gold column which was Gold produced - Maintenance Cost." I took it out because I needed more room to stuff my own ideas in (including dividing out Commerce and Gold and including Trade) and I thought that it wasn't really that useful. So, my question was in relation to that Net Gold column, NOT the Gold produced Column. I agree that the Gold Produced column should be kept mainly because there ARE other things which make the calculation from Commerce to Gold a headache (among others, shrines, multiplier buildings like Banks, Markets, Wall Street, Specialists, etc.)

rendermad said:
- The red bread icon is rather confusing for what it represents, perhaps making another TOT column next to the food one?
Just my 2 cents.

Again, I did this to try to add as little additional stuff as possible so that this could be easily added to another mod without being a pain. I thought that since nobody used the red bread icon, that it would be ok to use as "Turns until Growth." If other people complain, though, I might change it to something else. However, TOT wouldn't be correct for that or the Net Food Column, so I don't see what a good alternative would be (there are rather limited icon characters).

Req
 
Requies said:
Part of this was because I didn't want to add too much additional code while keeping it mainly different language friendly. Because I used terrasol's idea of reusing text that was already in Civ, it had the header of Add Building (Additional Building). But thinking on it, it might actually be wrong in a foreign language :lol:. Oops, hmmm, well, maybe I'll change it back to homegrown's Landmarks header. But that means changing a whole another file and making it more incompatible with other mods....

Perhaps you can add your own XML file with a <TEXT> entry. I'm not 100% sure it works though.

Requies said:
Hmmm, that makes sense. I was using the default one that terrasol was using, but Garrison < 1 makes sense. To change it, all you need to change is GARRISONPROBVALUE in CvNewDomesticAdvisor.py from 3 to 1. (BTW, this is an example of the optimization I made so that changes could be made easier. Neat, huh? :) ) I just might make it myself since this is a DOMESTIC Advisor.
Thanks for the info, glad you liked my suggestion.

Requies said:
Heh, I guess I wasn't very clear about what I was talking about. In homegrown's version, he had a "Net Gold column which was Gold produced - Maintenance Cost." I took it out because I needed more room to stuff my own ideas in (including dividing out Commerce and Gold and including Trade) and I thought that it wasn't really that useful. So, my question was in relation to that Net Gold column, NOT the Gold produced Column. I agree that the Gold Produced column should be kept mainly because there ARE other things which make the calculation from Commerce to Gold a headache (among others, shrines, multiplier buildings like Banks, Markets, Wall Street, Specialists, etc.)

OK, sorry about the misunderstanding.

Requies said:
Again, I did this to try to add as little additional stuff as possible so that this could be easily added to another mod without being a pain. I thought that since nobody used the red bread icon, that it would be ok to use as "Turns until Growth." If other people complain, though, I might change it to something else. However, TOT wouldn't be correct for that or the Net Food Column, so I don't see what a good alternative would be (there are rather limited icon characters).
Req

Perhaps you can include this in the food column between brackets, just like it's done in the production column and in the map view.
 
rendermad said:
Perhaps you can add your own XML file with a <TEXT> entry. I'm not 100% sure it works though.


Thanks for the info, glad you liked my suggestion.



OK, sorry about the misunderstanding.



Perhaps you can include this in the food column between brackets, just like it's done in the production column and in the map view.

Not sure about the XML file. If there was a way to do it, then, yes I'd probably break it out.

Also, about putting it in brackets, the problem with that is that you give up sorting for the net food AND the turns to growth column. I'm not sure it's worth giving up the sorting ability for learning another icon :crazyeye:

Req
 
=DOCTOR= said:
After installing this as instructed I get a note upon loading which says "Failed to load python module CvEventInterface"

Any ideas what this means?

Oh yeah, are you running under english or a foreign language version?

Oh yes, and you NEED to have updated to 1.09. I'll write that in the readme to.

Req
 
I like the new additions, I did some of my own as well. I would like to have the religion section put back in. I think it's nice to have all the info in one easy place.

Any chance you could add this back in for me? Thanks!! :)
 
AstroCat said:
I like the new additions, I did some of my own as well. I would like to have the religion section put back in. I think it's nice to have all the info in one easy place.

Any chance you could add this back in for me? Thanks!! :)

I could do it if enough people think it's a good idea.

Then, the next question would be what information would you take out instead of the Religions?

Req
 
Requies said:
I could do it if enough people think it's a good idea.

Then, the next question would be what information would you take out instead of the Religions?

Req


of course religion should be in its part of the game

are all advisors changed or only the f1 screen?
 
rendermad said:
I liked homegrowns mod, and this one is even better!
I do have a few suggestions:
- The title of the "Add Buildings" column doesn't really fit IMO, though I haven't any suggestions of my own...
- I don't like how the garrison column will be red when having few units, it's not like it's gonna lose pop or anything, perhaps only making it red when there are no units? Would you at least show me where to change it in the python files?
- The gold column should stay, just like the beakers column you don't exactly need to know how many each city is producing unless you want to construct some buildings. Of course, since you have commerce and science it's not really hard to now how much gold it's making.
- The red bread icon is rather confusing for what it represents, perhaps making another TOT column next to the food one?

Just my 2 cents.

Ok, just figure out how to add more icon characters to the screen. Just wondering, would the wheat icon for growth be any better? I also have access to all the other resource and the religions icons.

Req
 
Requies said:
I could do it if enough people think it's a good idea.

Then, the next question would be what information would you take out instead of the Religions?

Req

My suggestion for this is that if you need to take some info away, might as well remove the "founded" part.
I personally don't give a damn when my city was founded, but if I can see all the details of my cities in one screen (including the religions), I'm more than happy :D

From the pics you have now, I might soon even dl this mod because I think the original advisors aren't what I'd like to have...

Anyway, keep up the good work! With the modding, CIV 4 might actually become a great game :goodjob:
 
Sorry, my fault earlier. I copied something across incorrectly. Excellent mod to the domestic advisor, very useful indeed. I have a few suggestions:

1. I don't think you need the time to growth indicator (red bread), or at least I've haven't found this useful so far.

2. Date founded is also probably surplus to requirements. However, I'd only remove this if the space is a necessity for something else.

3. It would be great to have Religion back in this list. I appreciate this info can be determined from the other advisor, but I know I would find it useful to have it under the domestic advisor too.

4. Is it possible to get the Great Leader and Culture points totals to be detailed with necessary total for the next "level"? I.e. instead of just a total, e.g. 100, one would have a total and the amount needed to reach the next level, e.g. 100/200. Failing that maybe having the number of turns to reach next level based on the current amount being generated. This way we could actually work out when a city is going to make a GL or expand its cultural boundaries.

Regards
 
I haven't tried this mod yet but I have homegrown's. Does yours have a mouseover description of the columns?

If not that would be the first thing that I'd alter. It just makes it more user-friendly..
 
I disagee with =DOCTOR= on his #1. I like a quick reference to when cities are about to grow. There are many times when this is helpful:
1. You want to switch a city to a worker as soon as it grows to pop2.
2. You want to check if a city is about to grow unhappy/unhealthy and turn off growth.
I guess that's it.

My #2 reminds me that it'd be great if you could see on the domestic advisor what each city's governor was doing. I'm imagining a governor column with an icon for each option turned on (manage produciton, manage citizens, emphasize food, production, commerce, beakers, great people, turn off growth). For me this would be helpful because one of the main things I use the domadvisor for is managing growth w/rt happiness/healthiness. If I have a lot of cities on "no growth" because they are at max happiness and then get a new happy resource hooked up, it can be a pain to have to click on each city to see which are on "no growth" and which aren't. Make sense?
 
Top Bottom