Python Performance and Interface Overhaul (PPIO)

v0.5.9.0.7
  • Moved "All Eras" sub-category to the top of all pedia sub-category lists that contain that particular sub-category. ^^
  • Performance tweaks.
  • Fixed city screen UI that was visible outside of city screen when exiting a city that had a completely empty list open.
I'd almost prefer to set this to a limit of one defined tech. IMO, if it takes more than one tech to define a set of prereqs for a building or unit then perhaps we need a new tech to define the combination of those other techs itself.
I concur, one tech prereq should be sufficient for buildings and units.
@Toffer90 is it possible to separate special buildings by era, just like normal buildings?
It's possible, but it would require a tedious amount of code rewrite. I would have to make all the special building sub-categories into main-categories so that each of them could get the era sub-categories.
I don't like the idea of having so many main-categories for buildings. It is improbable that I will entertain the idea further.
 
Last edited:
With your poll :- the current system gives money for demolishing buildings. It gives settlers and workers if you abandon the city none of the buildings are sold. This is not an option in the poll as far as I can see.

What Zappara and I wanted to do with the function was
  1. allow player to sell buildings (because at the time the AI could) for money (or possible hammers). The main problem here is that the "cost" and "actual cost" reported to Python by the dll may have no connection to the real cost of that building in the city as city conditions are not considered when providing those values. I had the same problem with the Demand Mod I tried to implement. The effects were there but they were based on local conditions and so did not show up in the values of the result of building. eg you may have a -7 unhappyness because you don't have a Market and a pop of 24, but nothing in the interface will tell you that building the Market will get the :) boost.

  2. if no buildings had been sold in that city this turn then "Abandon the city" is available and creates 1 Settler per 3 pop (refugees or immigrants) and 1 worker for each of any remainder. With the possible extension of some special units to represent any local traditions set up by settling Great People in the city.
RE: SpecialBuildings BtS not Special Buildings (C2C)

Turns out this is not really useful. It is a way of setting the PrereqTech and ObsoleteTech for all the buildings with the same SpecialBuildings tag. This would allow them to be moved between techs but little else.

It does not put a "summary" building in place of the individual buildings anywhere. Thus the lists would still occur at Education etc. if the Myth and Story buildings were switched to this.
 
Last edited:
It does not put a "summary" building in place of the individual buildings anywhere. Thus the lists would still occur at Education etc. if the Myth and Story buildings were switched to this.
Ah... but it could. I don't think we're barking up the wrong tree. Either way some tags will require some reworking to fix these lists and this sort of approach would be better than putting a limit and capping it off with ... or etc...

I would need to know which tags we're trying to resolve for is the main thing.
 
But I definitely think units CAN and it would help us to simplify some processing and tag applications and I'm really curious if anyone can think of examples as to units that wouldn't be well served by such a hard rule of only one prereq tech.

Not that I have a good example from the top of my head, but I think this might run into problems up from the Modern Era, when stuff like battleships require nautical techs, Electronic (or Software) techs, Weapon Techs, maybe even logistic Techs... Often we have new classes of ships by changes in one of these (like Railguns or Sonar) while the others stay the same. Unless these techs are prereqs of each other or you don't want to make a new tech for each of these units (which IMO is very overkill), you probably need at least 2 or 3 techs as "AND" req.
 
v0.5.9.0.7
  • Moved "All Eras" sub-category to the top of all pedia sub-category lists that contain that particular sub-category. ^^
  • Performance tweaks.
  • Fixed city screen UI that was visible outside of city screen when exiting a city that had a completely empty list open.
I concur, one tech prereq should be sufficient for buildings and units.
It's possible, but it would require a tedious amount of code rewrite. I would have to make all the special building sub-categories into main-categories so that each of them could get the era sub-categories.
I don't like the idea of having so many main-categories for buildings. It is improbable that I will entertain the idea further.
Maybe just make single category containing National/World/Group/Projects Wonders, that would contain all these buildings just like normal buildings category contains normal ones?

Edit: After you moved "All Eras" categories something broke within tech subcategories:
https://imgur.com/a/ugygN
 
Last edited:
Not that I have a good example from the top of my head, but I think this might run into problems up from the Modern Era, when stuff like battleships require nautical techs, Electronic (or Software) techs, Weapon Techs, maybe even logistic Techs... Often we have new classes of ships by changes in one of these (like Railguns or Sonar) while the others stay the same. Unless these techs are prereqs of each other or you don't want to make a new tech for each of these units (which IMO is very overkill), you probably need at least 2 or 3 techs as "AND" req.
In the long run this could be done with equipments, I think (at this point refitting a unit should cost a bit - perhaps it should require a player's input). But it might be a pain to show this properly to the player.
 
Not that I have a good example from the top of my head, but I think this might run into problems up from the Modern Era, when stuff like battleships require nautical techs, Electronic (or Software) techs, Weapon Techs, maybe even logistic Techs... Often we have new classes of ships by changes in one of these (like Railguns or Sonar) while the others stay the same. Unless these techs are prereqs of each other or you don't want to make a new tech for each of these units (which IMO is very overkill), you probably need at least 2 or 3 techs as "AND" req.
You make a good point. Anyhow, perhaps I can't dispense with multiple tech prereqs for units, but we should at least really look at all the units that HAVE multiple prereqs ans see if it starts making sense to get an additional tech to enable them instead. The Swordsmanship example was a perfect model for that kind of transition in thinking.

tmv: You make good points for the equipment. I completely concur on that.
 
Does that mean you want to have swardsmanship I, II and III as techs? What about Obsidian Swordsmen, will they require this tech? Will those techs be semi-skippable, meaning you can leave out a bunch of military techs if you want to have a peaceful game?

Also, how hard would it be to add a "show unimproved terrains in your territories" button? Or at least a modified "toggle resources" button when you are zoomed out on the map to not just show only certain resources (like food, strategic...) but also "show unimproved resources on your territory"?
 
Does that mean you want to have swardsmanship I, II and III as techs? What about Obsidian Swordsmen, will they require this tech? Will those techs be semi-skippable, meaning you can leave out a bunch of military techs if you want to have a peaceful game?
This is not really a discussion for this thread so I will move it to theC2C Discussions thread
 
v0.5.9.0.8 - Hotfix
  • Fixed the era offset in pedia era sub categories, that I caused when moving the "all eras" to the top of the list.
Edit: ▬▬▬▬▬
v0.5.9.0.9

  • Performance update.
Edit: ▬▬▬▬▬
v0.5.9.0.9.1

  • Performance update.
Edit: ▬▬▬▬▬
With your poll :- the current system gives money for demolishing buildings. It gives settlers and workers if you abandon the city none of the buildings are sold. This is not an option in the poll as far as I can see.
Why would it be, it would only force player to sell all their buildings one by one if they were ever going to use the abandon city feature.
The poll is only about the gold aspect, abandon city gives settlers, workers, merchants and possibly one judge for all the options in the poll.
 
Last edited:
Bump, so it's not forgotten. ^^
It wasn't forgotten so much as you never answered the question. Assuming, then, that you do need it, I'm compiling a DLL with

.def("isHasUnitCombat", &CyUnit::isHasUnitCombat, "bool (int /*UnitCombatTypes*/ eUnitCombat)")

for you now.

That would be the one that you want to call if it's on a unit in the game. If you're needing it on base underlying unit TYPE info, that's another story. Thus I'm also reporting:

.def("hasUnitCombat", &CvUnitInfo::hasUnitCombat, "bool (UnitCombatTypes eUnitCombat)")

Which is what units begin with.

I've run into a few snags so it'll be done tomorrow.
 
Last edited:
It wasn't forgotten so much as you never answered the question.
I answered "Yes please." in post nr. 449. ^^
Assuming, then, that you do need it, I'm compiling a DLL with

.def("isHasUnitCombat", &CyUnit::isHasUnitCombat, "bool (int /*UnitCombatTypes*/ eUnitCombat)")

for you now.

That would be the one that you want to call if it's on a unit in the game. If you're needing it on base underlying unit TYPE info, that's another story. Thus I'm also reporting:

.def("hasUnitCombat", &CvUnitInfo::hasUnitCombat, "bool (UnitCombatTypes eUnitCombat)")

Which is what units begin with.

I've run into a few snags so it'll be done tomorrow.
Cool.
 
I answered "Yes please." in post nr. 449. ^^
Looking back at that post... I must have missed it entirely. And no... I'm not currently up for fiddling with the data storage on that tag. A person could make a career out of those kind of adjustments in this code and get nothing else done. There are more significant project needs at the moment and my attention to the project is waning a little in light of greater demands on my time from work and other projects... nothing to suggest I'm backing out, just having to be more selective for a bit here.
 
nothing to suggest I'm backing out, just having to be more selective for a bit here.
Completely understandable, it isn't important anyway, I adjusted the python bit to take the hard limit into account. One thing that would be nice was if the dll would detect if python asks for an array (tech prereq array that is) value that is outside the array size and return (-1 / None) instead of a random number that incidentaly was stored in memory where that array would expand to if it were longer.
Again, not important, just mentioning it.
 
Completely understandable, it isn't important anyway, I adjusted the python bit to take the hard limit into account. One thing that would be nice was if the dll would detect if python asks for an array (tech prereq array that is) value that is outside the array size and return (-1 / None) instead of a random number that incidentaly was stored in memory where that array would expand to if it were longer.
Again, not important, just mentioning it.
This is an issue in the dll as well. It's really supposed to crash to let you know you've done it wrong to begin with. Otherwise you'd really never know you have the bug. You have a good alternative but this is generally why this sort of approach isn't usually taken at those kinds of call points.
 
Re-enabled war prizes
I'd always hoped if we were going to leave this in, that we would do it based on the capture system. Or something new...
 
I'd always hoped if we were going to leave this in, that we would do it based on the capture system. Or something new...
Well, for now... There's a lot that is done in python that should ideally be handled by xml tags. I'll look into the war prize code tommorrow and evaluate what can and can't be replicated through the capture system.
 
Not sure if it is possible but a custom filter for your build options list where you can e.g. type "siege weapons workshop" (or part of that name) would save a lot of playtime, especially in the 2nd half of the game when building lists become lengthy and searching through it consumes more and more time.

I know you can sort by name but that's still not very fast.
 
Back
Top Bottom