Python Performance and Interface Overhaul (PPIO)

@Toffer90 I've done it for you, change CvCivicsScreen.py line 430:

From
Code:
item = BugUtil.colorText(item, "COLOR_DARK_GREY")
to
Code:
item = BugUtil.colorText(item, "COLOR_CYAN")
White isn't a good color because if blends with the modifiers below.

Attached the modified file.
Great initiative. ^^
Just put it on the SVN, this modmod hasn't modified CvCivicsScreen.py at all yet, and that color change is not good enough reason to add another file to the modmod.
 
@Toffer90 I've done it for you, change CvCivicsScreen.py line 430:

From
Code:
item = BugUtil.colorText(item, "COLOR_DARK_GREY")
to
Code:
item = BugUtil.colorText(item, "COLOR_CYAN")
White isn't a good color because if blends with the modifiers below.

Attached the modified file.
I could try Grey, it should be easy to read and still be different from modifiers.

I set it to Yellow.
Now it is both readable and is differentiable from modifiers.
Spoiler :

Civ4BeyondSword 2018-10-05 09-55-25-20.jpg


Change is now in SVN.
 
Last edited:
@Toffer90 I discovered how eras are colored in tech tree:
Colors are calculated on line 679 in Caveman2Cosmos\Assets\Python\Screens\CvTechChooser.py
iColor = Info.getEra() * 255 / gc.getNumEraInfos()
screen.setPanelColor(szTechRecord, iColor*5, (255 - iColor)/2, iColor)

If I wanted to have 1st era black
2nd - brown
3rd - red
4th - orange
5th - yellow
6th - green
7th - cyan - Modern era
8th - blue
9th - purple
10th - violet
11th - magenta
12th - pink
13th and later - white
Researched ones are yellow, so it could be changed to gray.
Then what I should change here?

Now colors are bit random.
Rainbow tech tree would be nicer - neighboring colors would be similar.
 
Last edited:
I think you missed my edits :p
One way to achieve that is to make a list of RGB colors and let the era index decide which element of the list that is used for color.

Era index = Info.getEra()
Era index range = ( 0, gc.getNumEraInfos() -1 )

List example: (python syntax: aList = [ [R0, G0, B0], [R1, G1, B1], [R2, G2, B2] ...etc.]
aList[1][2] == B1 ▬ aList[0][1] == G0 ▬ aList[2][0] == R2
The list must contain as many [R, G ,B] entries as there are era's in the game, you could make code that use the number gc.getNumEraInfos() to fill in missing era's to the list with a default color, just in case someone adds a new era without adding its color to that python list.

RGB list elements example:
000, 000, 000 ▬ Black
100, 050, 000 ▬ Brown
255, 000, 000 ▬ Red
255, 128, 000 ▬ Orange
255, 255, 000 ▬ Yellow
000, 255, 000 ▬ Green
000, 255, 255 ▬ Cyan
etc. (google "rgb color")

Code example:
iEra = Info.getEra()
screen.setPanelColor(szTechRecord, aList[iEra][0], aList[iEra][1], aList[iEra][2])
 
One way to achieve that is to make a list of RGB colors and let the era index decide which element of the list that is used for color.

Era index = Info.getEra()
Era index range = ( 0, gc.getNumEraInfos() -1 )

List example: (python syntax: aList = [ [R0, G0, B0], [R1, G1, B1], [R2, G2, B2] ...etc.]
aList[1][2] == B1 ▬ aList[0][1] == G0 ▬ aList[2][0] == R2
The list must contain as many [R, G ,B] entries as there are era's in the game, you could make code that use the number gc.getNumEraInfos() to fill in missing era's to the list with a default color, just in case someone adds a new era without adding its color to that python list.

RGB list elements example:
000, 000, 000 ▬ Black
100, 050, 000 ▬ Brown
255, 000, 000 ▬ Red
255, 128, 000 ▬ Orange
255, 255, 000 ▬ Yellow
000, 255, 000 ▬ Green
000, 255, 255 ▬ Cyan
etc. (google "rgb color")

Code example:
iEra = Info.getEra()
screen.setPanelColor(szTechRecord, aList[iEra][0], aList[iEra][1], aList[iEra][2])
Last entry could be default entry - Light Gray or something like that.

This website and this one shows color based on RGB values.

Here is code:
Code:
               aList =  [[0, 0, 0], [128, 64, 0], [200, 48, 0], [255, 128, 0], [200, 200, 0], [0, 200, 0], [0, 200, 200], [0, 128, 255], [0, 0, 200], [128, 0, 255], [200, 0, 200], [200, 128, 200], [200, 200, 200], [128, 128, 128]]
               iEra = Info.getEra()
               if iEra <= 13:
                   screen.setPanelColor(szTechRecord, aList[iEra][0], aList[iEra][1], aList[iEra][2])
               elif iEra > 13:
                   screen.setPanelColor(szTechRecord, 255, 255, 255)
               ##Prehistoric/Ancient/Classical - Black/Brown/Red
               ##Medieval/Renaissance/Industrial - Orange/Yellow/Green
               ##Modern/Information/Nanotech - Cyan/Blue/Indigo
               ##Transhuman/Galactic/Cosmic - Purple/Violet/Pink
               ##Transcendent/Future - White/Grey
               ##In case new eras gets added last entries will be white. Some colors have reduced saturation.
Some of colors were bit intense, so I had to darken them a bit.
 
Last edited:
Looks good.
I would use len(aList) instead of the number '13', it cost's some nano seconds more in processing but one doesn't have to update the number when adding in more colors to the list.
Code:
aList = [
    [0, 0, 0], [128, 64, 0], [191, 0, 0], [255, 128, 0], [191, 191, 0],
    [0, 191, 0], [0, 191, 191], [0, 128, 255], [0, 0, 191], [128, 0, 255],
    [191, 0, 191], [191, 128, 191], [191, 191, 191], [128, 128, 128]
]
iEra = Info.getEra()
if iEra < len(aList):
    screen.setPanelColor(szTechRecord, aList[iEra][0], aList[iEra][1], aList[iEra][2])
else:
    screen.setPanelColor(szTechRecord, 255, 255, 255)
I already committed it, but I can change this.

What do you think about colors?
 
What do you think about colors?
That it would be a bit depressing without them.
Colors are an abstract idea, a representation of a pattern. The atomic structure of the surface of an object determines the frequency of the light absorbed, emitted and reflected from it.
Colors are our way of sensing the pattern of the light around us.
 
That it would be a bit depressing without them.
Colors are an abstract idea, a representation of a pattern. The atomic structure of the surface of an object determines the frequency of the light absorbed, emitted and reflected from it.
Colors are our way of sensing the pattern of the light around us.
You are funny guy.
I meant about tech tree colors :p
 
And then you have the sad fact that humans can only see about <1% of the light spectrum.

Imagine all the colors we are missing out!

quality-of-a-light-source.jpg
 

Attachments

  • Prehistoric.jpg
    Prehistoric.jpg
    338.3 KB · Views: 145
  • Ancient.jpg
    Ancient.jpg
    370 KB · Views: 204
  • Classical.jpg
    Classical.jpg
    389 KB · Views: 143
  • Medieval.jpg
    Medieval.jpg
    355.7 KB · Views: 130
  • Renaissance.jpg
    Renaissance.jpg
    270.4 KB · Views: 120
  • Industrial.jpg
    Industrial.jpg
    482.2 KB · Views: 129
  • Modern.jpg
    Modern.jpg
    378.1 KB · Views: 146
  • Information.jpg
    Information.jpg
    313.1 KB · Views: 153
  • Nanotech.jpg
    Nanotech.jpg
    380.6 KB · Views: 162
  • Transhuman.jpg
    Transhuman.jpg
    383.4 KB · Views: 128
Last edited:
Part 2.
 

Attachments

  • Galactic.jpg
    Galactic.jpg
    190.5 KB · Views: 115
  • Cosmic.jpg
    Cosmic.jpg
    255.6 KB · Views: 117
  • Transcendent.jpg
    Transcendent.jpg
    280.7 KB · Views: 122
PPIO v0.5.9.6.5.2
SVN rev.10213
  • Tweaked the domestic advisor screen.
    • I had a setback shortly after last release, managed to delete 6 hours of work; I didn't feel much like modding for a while after.
    • 2 days ago I felt like modding again. ^^
  • Mostly technical changes but some visual and functionality tweaks as well.
 
Last edited:
PPIO v0.5.9.6.5.2
  • Tweaked the domestic advisor screen.
    • I had a setback shortly after last release, managed to delete 6 hours of work; I didn't feel much like modding for a while after.
    • 2 days ago I felt like modding again. ^^
  • Mostly technical changes but some visual and functionality tweaks as well.
Well Domestic Advisor doesn't work.
Code:
Traceback (most recent call last):

  File "CvScreensInterface", line 1086, in handleInput

  File "CvMainInterface", line 5434, in handleInput

  File "CvScreensInterface", line 139, in showDomesticAdvisor

  File "CvDomesticAdvisor", line 435, in interfaceScreen

NameError: global name 'xResxRes' is not defined
ERR: Python function handleInput failed, module CvScreensInterface
I cleaned up Python folder
 
Found the error and re-upladed the modmod.

The error was so minor it doesn't justify a new version number.

One spelling error that only affected those with x resolution smaller than 1700 pixels.
 
Last edited:
Now custom advisor is now properly fullscreen.
Also there is over 6000 building type entries :p
That is both regular/wonder buildings and pseudobuildings like property autobuildings and myths.
 
Isn't that the case without this modmod too?
Yes it is.

By the way is there horizontal scrollbar?
It could be useful to add resource display.
First one for natural resources (Plants, Animals and Other) and then sorted by tech X/Y grid.
Other one for manufactured resources, sorted by X/Y grid of unlocking tech.
 
Yes it is.

By the way is there horizontal scrollbar?
It could be useful to add resource display.
First one for natural resources (Plants, Animals and Other) and then sorted by tech X/Y grid.
Other one for manufactured resources, sorted by X/Y grid of unlocking tech.
The complex UI element called "Table" that is created and handled within the exe does not support a horizontal scroll-bar, there is not much that can be customized about it within python really.

I am playing with the idea of creating a python class to be used to easily create tables that are made up of many small and simple UI elements without having to write lots of code every time such a table is needed.
It would allow much of the table functionality to be held within python, but it's a big project so it will take time to make.
The build queue is a simple example of a table handled mostly within python.
 
Last edited:
Top Bottom