Python Performance and Interface Overhaul (PPIO)

Now raw yields are working properly.

There are few issues with text overflow and two techs that civilipedia can't show them properly.
https://imgur.com/a/7SeqJ <-screenshots of issues are in this link.
These errors happened while viewing 2 techs on wiki:
Spoiler :

Traceback (most recent call last):

File "CvScreensInterface", line 343, in pediaJumpToTech

File "PediaMain", line 618, in pediaJump

File "SevoPediaTech", line 219, in interfaceScreen

AttributeError: 'NoneType' object has no attribute 'getButton'
ERR: Python function pediaJumpToTech failed, module CvScreensInterface
Traceback (most recent call last):

File "CvScreensInterface", line 343, in pediaJumpToTech

File "PediaMain", line 618, in pediaJump

File "SevoPediaTech", line 219, in interfaceScreen

AttributeError: 'NoneType' object has no attribute 'getButton'
ERR: Python function pediaJumpToTech failed, module CvScreensInterface
 
Now raw yields are working properly.

There are few issues with text overflow and two techs that civilipedia can't show them properly.
Not easy to change that from python, it is all done in the dll currently, I'll look into transferring what's possible in due time.
These errors happened while viewing 2 techs on wiki:
The dll use a limit on how many OR prereqs a tech can have; the limit is defined in GlobalDefines.xml under NUM_OR_TECH_PREREQS.
If you increase the value there, those two tech will probably display just fine.
I could use the limit in python as well (and hide that there is a deeper problem) but then all the OR prereqs wouldn't show up in the tech pedia page.
This is an issue that should be fixed in the dll imho (no reason to have a hard limit), or at least the global define should be increased on the SVN...or the amount of or prereqs the tech have should be reduced.

Edit: I'll take a deeper look tomorrow to figure out if there is an issue on the python side for those two techs pedia pages. Those techs have 6 OR prereqs, and that is the number used in the global define, however the dll might use that define in a funky way.
My theory is that when python asks for the sixth ORprereq it gets a garbled number back like 82648164537154, basically whatever it finds in a memory bit that is not actually in use. That is obviously not the ID number of any techs in the game while python assumes it is because the dll said it was.

Edit: The python is designed so that it will keep asking for the next orprereq until it gets a value of -1. So maybe it is when python ask for the 7th orprereqs that it gets a random number because there is no 7th value in the orprereq array... The array has a fixed size of 6 with default values pof -1 before it is filled woth tech ID numbers... Zzz zzz
 
Last edited:
There is a bug with the "capture city pop up". It is stopping some of the other python events from happening correctly. I have noticed it with the number of settlers and workers you get and with the various shields not giving the correct city ruins type.

The dll use a limit on how many OR prereqs a tech can have; the limit is defined in GlobalDefines.xml under NUM_OR_TECH_PREREQS.
If you increase the value there, those two tech will probably display just fine.
I could use the limit in python as well (and hide that there is a deeper problem) but then all the OR prereqs wouldn't show up in the tech pedia page.
This is an issue that should be fixed in the dll imho (no reason to have a hard limit), or at least the global define should be increased on the SVN...or the amount of or prereqs the tech have should be reduced.
This limit was based on the idea of saving memory. The "correct" fix would examine how many are needed before creating the memory array. Although switching to a different style of storage, vectors or linked lists would probably get over the need for a limit anyway.
 
Yeah, there is a hasCombatType in CvUnit.cpp
But that isn't exposed to python at all, it's not mentioned in CyUnitInterface1.cpp, CyUnit.h, or CyUnit.cpp.

Looks like you made hasSubCombatType redundant, and replaced by hasCombatType, somewhere along the line because it isn't used by C2C at all.
Sounds about right. Are you saying you need it exposed to python?
 
How easy would it be to add a "show only buildings that create a resource you don't already have" button as building filter?
Also is it possible that in the tech tree, instead of listing all the different stories (i.e.) at Education, you just see a generic "Stories -1 :science:" ect?
 
How easy would it be to add a "show only buildings that create a resource you don't already have" button as building filter?
It is something that we want but it needs someone to work on filters which is half in the dll and half in python
Also is it possible that in the tech tree, instead of listing all the different stories (i.e.) at Education, you just see a generic "Stories -1 :science:" ect?
I did not think of "special buildings" which does exactly what I want. It is now on my list as it makes things easier to code. IE the same as is done with monestary buildings.
 
It is something that we want but it needs someone to work on filters which is half in the dll and half in python
Pretty sure its on the list but is at least next cycle.

I was wondering if specialbuildings could do that for you.
 
Sounds about right. Are you saying you need it exposed to python?
Yes, please. It is sometimes handy for python to know the sub combat types of a unit.
There is a bug with the "capture city pop up". It is stopping some of the other python events from happening correctly. I have noticed it with the number of settlers and workers you get and with the various shields not giving the correct city ruins type.
This issue also happens without this modmod, right; or is it a unique problem with the modmod?
This limit was based on the idea of saving memory. The "correct" fix would examine how many are needed before creating the memory array. Although switching to a different style of storage, vectors or linked lists would probably get over the need for a limit anyway.
Wonder if TB is up for changing the arrays to have a length that is equal to the amount of prereqs the specific tech has... Or changing the storage type completely...
Not very important though, I can change the python to take into account that no tech have more Or prereqs than the value of the NUM_OR_TECH_PREREQS global define.
 
Last edited:
Does a tech even need to have that many OR prereqs? I mean, these are a nice feature but lets face it, most techs in our tree should have OR prereqs instead of AND; you don't really need a certain tech to research another one, eventhough it happened to be that way in our history...
 
How easy would it be to add a "show only buildings that create a resource you don't already have" button as building filter?
It's actually a bit of work to add more filters, it is both dll and python code. Maybe I and TB will look into it during the next version cycle.
Does a tech even need to have that many OR prereqs? I mean, these are a nice feature but lets face it, most techs in our tree should have OR prereqs instead of AND; you don't really need a certain tech to research another one, eventhough it happened to be that way in our history...
Well that 's a different question entirely, though it doesn't change anything as the AND prereqs have the same hard limit in a global define called NUM_AND_TECH_PREREQS.
So changing them from ORs to ANDs just create an issue with too many ANDs instead.

While on the topic there is also a hard limit on how many tech prereqs a building or unit can have.
NUM_BUILDING_AND_TECH_PREREQS
NUM_UNIT_AND_TECH_PREREQS
They're currently set to 4.

What I'm saying is that we should get rid of the hard limit and let the xml modder who design the game object be free to choose how many tech prereqs a tech, unit or building should have.

v0.5.9.0.6
  • Pedia now respects the hard limit on tech "tech prereqs".
  • Added a list entry count to all the category lists.
 
Last edited:
This limit was based on the idea of saving memory. The "correct" fix would examine how many are needed before creating the memory array. Although switching to a different style of storage, vectors or linked lists would probably get over the need for a limit anyway.
I ran into this problem when I was doing the latest gateway techs. I'm not sure we could switch to a different style of storage or not because it may report pretty directly to the exe on that. I was able to work with it as a limitation. Didn't bother me to remove a few OR prereqs.

While on the topic there is also a hard limit on how many tech prereqs a building or unit can have.
NUM_BUILDING_AND_TECH_PREREQS
NUM_UNIT_AND_TECH_PREREQS
They're currently set to 4.
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.
 
Now we can see how many techs/buildings/units/other stuff we have with ease :D
 
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.
Would this not destroy the ability to choose a tech path to research and instead make the whole tech tree straight line linear?
 
Would this not destroy the ability to choose a tech path to research and instead make the whole tech tree straight line linear?
I'm not talking about the techprereqs for techs, just for buildings and units.
 
A good example of what I think Tbd is suggesting might be a tech called Swordsmanship which is required for all sword units but the different Swordsmen require different resources and access to that resource is defined by other techs. This way the techniques/technologies become much clearer.
 
  • Like
Reactions: tmv
A good example of what I think Tbd is suggesting might be a tech called Swordsmanship which is required for all sword units but the different Swordsmen require different resources and access to that resource is defined by other techs. This way the techniques/technologies become much clearer.
And this might be a good preparation for "equipment".
 
A good example of what I think Tbd is suggesting might be a tech called Swordsmanship which is required for all sword units but the different Swordsmen require different resources and access to that resource is defined by other techs. This way the techniques/technologies become much clearer.
Wow... that's a PERFECT example! The sword units requirements are really irritating that they are a combination of two almost unrelated subjects rather than having their own identified tech. Now that you say it, I think we really need it! It's been bugging me for a while. There are more examples but this one is really glaring. (Machinery and Civil Service... REALLY not good.)

I'm inclined to make this a high priority task but if someone else wants to jump on it quickly here before we enter a freeze then that would be great.

Also, we could really cut down on our memory usage if we just made units and buildings only require one tech. Think of how many expensive tags could be eliminated! But to go further than this one example would be a project for another version cycle. Too involved to squeeze in now.

EDIT:
Whisperr observes this would cramp her style with buildings, particularly wonders. It makes sense the reasoning so perhaps buildings can't get away with this. 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.
 
Last edited:
With the pedia, in all cases where you have splits into categories the "All" should be the first one in the list. The two main reasons for this are that this is in line with vanilla and will confuse people new to the pedia the least. Secondly for those using lower resolution it becomes obvious that there are indeed categories and that you can scroll the list. When I first saw one I saw all the different groupings except the "All" as it was not on the screen and my immediate thought was "How the heck was I supposed to know what category the building was in?".
 
Back
Top Bottom