Modder's Documentation

Python instructs the exe where to display what interface graphic how; it also tells the exe which widget that is tied to each interface constituent and what specific game object data it concerns (a specific building or unit or whatever, this is the widget-data that define what the code specifically has to work with when a particular widget is interacted with, the widget type tells the code what it should do with the widget-data it gets.).

After that the exe will handle all interaction with the UI element in question on a technical level (usually not gameplay related), and the python code will only wait for further instructions coming down from the dll or exe.
The UI elements initiated by python are really of no concern to the python code after it is drawn on the screen by the exe.

UI of the widget type WIDGET_GENERAL will, when interacted with make the exe instruct python to handle the interaction by calling the handleInput(argsList) function in CvScreensInterface.py directly.
Different types of UI elements will be handled different by the exe in this regard, so the exe may call the handleInput() in python when a button is hovered over by the mouse, but not when a table cell is hovered over, it may report if shift is held down when a button is clicked but not when a list entry is clicked, it may add the mouse position as an argument in the argList when one type of UI is clicked but not with another type and so on. It's a bit unpredictable and one always have to check what interaction types that make the exe initiate the handleInput function and what arguments it gets for each and every type of UI elements. There are a lot of UI types, lists, tables, multilists, panels, buttons, text, images, windows, tabs, graphs, checkboxes, etc.etc. and most of them needs to be assigned a specific Widget type. e.g. A table itself doesn't have a widget but each and every cell in the table has a widget assigned to it.

Sorry for going verbose here, I'm not really sure what info might be helpful for you.
 
Last edited:
No, it definitely helps, thanks! I found where the building widgets are added, so when I get some time, Ill try and debug and see what is taking so long to handle click events. It almost definitely isn't dll side though.
 
No, it definitely helps, thanks! I found where the building widgets are added, so when I get some time, Ill try and debug and see what is taking so long to handle click events. It almost definitely isn't dll side though.
I suspect UI elements of the type "MultiList" have really inneficient interaction coding in the exe that get's exponentially worse the more content there is in the "multiList".

I've seen the same thing with tables in vanilla civopedia, much of the improvment I made in the pedia was simply by imitating tables with listBox'es instead.
The same might be possible to do with the selection buttons, imitating a multiList by adding panels inside panels and manually placing each button within those panels.

┌——————————————————————————┐
│ ┌ ———————————————————————┐ ↕ │
│ │ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ │ ↕ │
│ │←—————————————————→│ ↕ │ Arrows represent scroll bars
│ └ ———————————————————————┘ ↕ │ Each ▓ represent a building or unit selection within city screen
│ ┌ ———————————————————————┐ ↕ │ Each row has a unique panel that is attached to a big master panel.
│ │ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ │ ↕ │ The buttons are attached to the row panels.
│ │←—————————————————→│ ↕ │ The row panels has horisontal scroll bars while the master panel has vertical scroll bar.
│ └ ———————————————————————┘ ↕ │ This allows you to scroll the building row independently of the unit row.
│ ┌ ———————————————————————┐ ↕ │
│ │ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ │ ↕ │
│ │←—————————————————→│ ↕ │
│ └ ———————————————————————┘ ↕ │
└——————————————————————————┘

This might provide faster processing within the exe for any interaction with those buttons.... Might.

I could drop the horizontal scroll bars and just add many more un-scrollable row panels instead.
 
Last edited:
Indeed you may be correct. The Build List screen also suffers from the same slowness that the city build panel does, which i assume uses the same multilist control. I was planning on redesigning the damn build panel at some point anyways, so we may as well rip out the whole thing and redesign it with better base controls.

I have a prototype in my head that involves grouping Unit/Building types natively in the panel, rather than requiring buttons to show/hide types. The unit list needs it desperately, as its impossible to find what you are looking for when there are so many units randomly scattered about.

Is your modmod on schedule to be merged into master any time soon? I'd like to build off of what your mod has already done.

Also to any project owners: I tried messaging @Koshling for access to svn but haven't heard anything yet. Anyone else able to add me? Ill add the project files and such for VS2017 at the very least.
 
If you are going to redo the City Screen we need to discuss some things about where we want to end up.

One small suggestion is that given the number of units and buildings we should probably change the purpose of the whole "build queue" and "available to build" parts of the screen. It could be replaced with
  1. a short list of what your advisors recommend starting with any buildings that provide a resource you don't currently have including Cultures that can be built in the city.
  2. a button to bring up a new big screen to manage the build queue.
Another suggestion is to only redraw those parts of the screen that need it rather than the whole screen. However that will require us to ensure that the differing bits know about each other.
 
Indeed you may be correct. The Build List screen also suffers from the same slowness that the city build panel does, which i assume uses the same multilist control. I was planning on redesigning the damn build panel at some point anyways, so we may as well rip out the whole thing and redesign it with better base controls.

I have a prototype in my head that involves grouping Unit/Building types natively in the panel, rather than requiring buttons to show/hide types. The unit list needs it desperately, as its impossible to find what you are looking for when there are so many units randomly scattered about.

Is your modmod on schedule to be merged into master any time soon? I'd like to build off of what your mod has already done.

Also to any project owners: I tried messaging @Koshling for access to svn but haven't heard anything yet. Anyone else able to add me? Ill add the project files and such for VS2017 at the very least.
PM me your sourceforge user name.
 
Hi!

Can someone tell me where the size of tech icon is set for the Tech Tree screen?
I want to change this look in AND2
upload_2018-7-31_12-50-46.png
into this look
upload_2018-7-31_12-51-46.png
 
Indeed you may be correct. The Build List screen also suffers from the same slowness that the city build panel does, which i assume uses the same multilist control. I was planning on redesigning the damn build panel at some point anyways, so we may as well rip out the whole thing and redesign it with better base controls.
Build list....
Do you mean the button furthest to the right in the same row of buttons as where the BUG option button is, under the treasury gold amount?
That screen is handled by BuildListScreen.py and does indeed employ a MultiListControlGFC for all the buttons within.
I have a prototype in my head that involves grouping Unit/Building types natively in the panel, rather than requiring buttons to show/hide types. The unit list needs it desperately, as its impossible to find what you are looking for when there are so many units randomly scattered about.
I've been considering something along that line too. You know how the demolish building button work with my modmod, how it opens up a new screen inside the city screen? I'm thinking we should have one button for buildings, another for units and a third one for projects heroes and wonders, which when clicked opens up a new screen inside the city screen. The buttons would be located where we currently have all the build options scattered already. Processes, the Build wealth, science, culture and espionage, doesn't need to be nested like the other build options. There would be a number on the buttons indicating how many builds are possible within each category. and if there are nothing to build within it it should be greyed out and unclickable.
Is your modmod on schedule to be merged into master any time soon? I'd like to build off of what your mod has already done.
Not really. You could, in the meantime, play around with the BuildListScreen.py, my modmod doesn't touch it.
 
I haven't checked the demolish building yet. I didn't really consider making an entirely new popup for build queue. I guess its possible and could be good, because the space is definitely needed.
 
Is there any simple way in Python to determine if a building has been replaced? I noticed recently that events that destroy buildings (e.g. the 'fire' events) can target buildings that have already been replaced by a newer building. This seems a little bit silly, since, from the player's perspective, these buildings no longer appear in the building list and contribute no effect to the city. In effect, if a replaced building gets destroyed, the player basically gets a free pass to ignore the event.

Obviously, it's possible to loop through all of the city's buildings to see if they replace the building we're checking, but this would seem to be rather non-performant at best. Basically, is there some sort of equivalent of isObsoleteBuilding, but for replaced buildings?
 
Is there any simple way in Python to determine if a building has been replaced? I noticed recently that events that destroy buildings (e.g. the 'fire' events) can target buildings that have already been replaced by a newer building. This seems a little bit silly, since, from the player's perspective, these buildings no longer appear in the building list and contribute no effect to the city. In effect, if a replaced building gets destroyed, the player basically gets a free pass to ignore the event.

Obviously, it's possible to loop through all of the city's buildings to see if they replace the building we're checking, but this would seem to be rather non-performant at best. Basically, is there some sort of equivalent of isObsoleteBuilding, but for replaced buildings?
Replacement buildings is not a a Civ IV concept. It has been made in a number of mods. You have found something that is missing in the C2C version:lol:
 
Replacement buildings is not a a Civ IV concept. It has been made in a number of mods. You have found something that is missing in the C2C version:lol:
Unique Buildings (thus Building Class replacements) are.
 
Unique Buildings (thus Building Class replacements) are.
But that is not what was being asked about. Building Class replacements are you can build A or B but not both.

Whereas replacement buildings are like Security Building 1 is replaced by Security Building 2. You can build 1 but when you build 2 the first is replaced and 1 can't be built if you build 2 first.
 
But that is not what was being asked about. Building Class replacements are you can build A or B but not both.

Whereas replacement buildings are like Security Building 1 is replaced by Security Building 2. You can build 1 but when you build 2 the first is replaced and 1 can't be built if you build 2 first.
I think he meant the UU mechanism and was using his own terminology for it. That's why I put it forward. If he meant as you said your comment should connect to what he was talking about.
 
I'd like to add a new art icon, but I dont see an fpk_layout file. Does anyone have? Or how should i rebuild the PAK file?
 
I'd like to add a new art icon, but I dont see an fpk_layout file. Does anyone have? Or how should i rebuild the PAK file?
If you add the icon into the correct folder in the assets/art folder that is all you need. Next time a release is done it can be moved into the fpk files. The art in the folders takes precedence over those in the fpk files.
 
Back
Top Bottom