1. We have added the ability to collapse/expand forum categories and widgets on forum home.
    Dismiss Notice
  2. All Civ avatars are brought back and available for selection in the Avatar Gallery! There are 945 avatars total.
    Dismiss Notice
  3. To make the site more secure, we have installed SSL certificates and enabled HTTPS for both the main site and forums.
    Dismiss Notice
  4. Civ6 is released! Order now! (Amazon US | Amazon UK | Amazon CA | Amazon DE | Amazon FR)
    Dismiss Notice
  5. Dismiss Notice
  6. Forum account upgrades are available for ad-free browsing.
    Dismiss Notice
  1. ruff_hi

    ruff_hi Live 4ever! Or die trying

    Joined:
    Oct 24, 2005
    Messages:
    8,816
    Location:
    an Aussie in Boston
    I had the following idea ...
    This is what I have so far - no where near ready but it shouldn't take that long to come together.



    Things that will change:
    • I want to have the default chart view show all 7 charts. I don't know if it will be 2 across and 4 deep or 3 across and 3 deep.
    • Each chart will have the title of the chart above it.
    • Click on the chart title and that chart gets blown up to full size
    • Click again, and you return to the 7 chart view
    • Legend will be in the current position when in 7 chart view
    • Legend will be in top left of chart when in 1 chart view (need to test this)

    Still very much a work in progress.
     
  2. EmperorFool

    EmperorFool Chieftain

    Joined:
    Mar 2, 2007
    Messages:
    9,633
    Location:
    Mountain View, California
    Sweet! How about this placement:

    Code:
    L X X
    L X X
    X X X
    
    Don't forget to hide the Espionage graph when the No Espionage option is enabled.

    Also, it looks like you might need to hide the axis labels (can you) when they're that small. :(
     
  3. ruff_hi

    ruff_hi Live 4ever! Or die trying

    Joined:
    Oct 24, 2005
    Messages:
    8,816
    Location:
    an Aussie in Boston
    Perfect. Glad I posted such an imcomplete screenshot. I'll be using your layout ... or maybe

    Code:
    x x x
    L x x
    L x x
    The python file in question was full of '....' instead of tabs so I will be replacing those first and committing a tab rich version before I commit my changes. Under instructions from my lawyers, I'll test it in-game first.
     
  4. ruff_hi

    ruff_hi Live 4ever! Or die trying

    Joined:
    Oct 24, 2005
    Messages:
    8,816
    Location:
    an Aussie in Boston
    update ...





    The little graph titles are active, click on one and it gets blown up to full screen size (pic 2). Click on the title again and you return to the 7 little graphs (pic 1).

    Things I still want to add:
    • move the titles around a pixel or two
    • put a panel behind the title so it stands out a bit more (similar to the legend panel)
    • expand the legend in the 7 graph version to take up the remaining spaces
    • allow player to remove / add leader lines
      • not sure if this is possible but going to try and make the legend names clickable - click on them will show / hide that leader on the graph
      • add a little '+' for shown / '-' for not shown after the leader name
      • put on '+' and '-' for show all / none
     
  5. Dresden

    Dresden Chieftain

    Joined:
    Jul 10, 2008
    Messages:
    1,081
    Good stuff ruff. :goodjob: If you can get the display of individual leaders to work, dead guys should be an option too. Although maybe that could be somewhat spoilery; CyPlayer.canDoEspionage() will definitely always return false on a dead guy so I don't know if we can tell whether you used to have enough EP against them... I'm also assuming CyTeam.isHasMet() works on dead guys to differentiate those you met before they died from those you didn't...
     
  6. ruff_hi

    ruff_hi Live 4ever! Or die trying

    Joined:
    Oct 24, 2005
    Messages:
    8,816
    Location:
    an Aussie in Boston
    update ...





    Notes:
    • Hannibal has been excluded. Little '-' after his name. Click on his name again and he comes back.
    • Click on a graph title when in 7 graph mode and it shows that item in big graph mode
    • click on the graph title when in big graph mode and it returns to little graph mode
    • click on one of the titles across the top when in big graph mode and it shows the big graph for that item

    Things I still want to add:
    • make legend big when all 7 charts displayed
    • test no espionage option
    • speed up load times
    • add 'select / deselect all' text to legend
     
  7. EmperorFool

    EmperorFool Chieftain

    Joined:
    Mar 2, 2007
    Messages:
    9,633
    Location:
    Mountain View, California
    Wicked cool, man. I'm glad you added all the graph titles across the top when in big-mode. :)

    I have one suggestion: from the screenshot it's very hard to see that Hannibal is deselected. I don't know how much control you have over the legend (is it a specific UI object in the engine or is it created using normal UI elements?), but if you have a lot could you put deselected leaders at the bottom after a horizontal line or gray them out?

    I'm not sure that moving them around in the legend is a great idea, but I'd like some easier way to see that they are not in the graph than that tiny "-".
     
  8. ·Imhotep·

    ·Imhotep· Legendary Builder

    Joined:
    Nov 16, 2005
    Messages:
    2,054
    Gender:
    Male
    Location:
    Munich, Germany
    W(hy)TF are you using a german interface :D ? other than that, great stuff as always...
     
  9. ruff_hi

    ruff_hi Live 4ever! Or die trying

    Joined:
    Oct 24, 2005
    Messages:
    8,816
    Location:
    an Aussie in Boston
    because I was testing the spacing on some labels and german typically has the longest words.

    Bug graphs now committed to SVN. Still some small layout issues and 1 XML key to be added but the python stuff should work. Also need to work on the load speed.
     
  10. The Doc

    The Doc Time Lord

    Joined:
    Feb 4, 2008
    Messages:
    344
    Location:
    between time and space
    Looks fantastic. :goodjob: This project is like a Civ4 think tank. :D
     
  11. ruff_hi

    ruff_hi Live 4ever! Or die trying

    Joined:
    Oct 24, 2005
    Messages:
    8,816
    Location:
    an Aussie in Boston
    The initial load of the graphs takes just over 3 seconds on my PC with a test game. I've used EF's timer utility to find that nearly all of the time is taken actually plotting the players lines.

    Code:
    08:34:52 Timer - InfoScreen [drawGraph - player plots, inner loop] took 13 ms
    08:34:52 Timer - InfoScreen [drawGraph - player plots, inner loop] took 14 ms
    08:34:52 Timer - InfoScreen [drawGraph - player plots, inner loop] took 24 ms
    08:34:52 Timer - InfoScreen [drawGraph - player plots, inner loop] took 37 ms
    08:34:52 Timer - InfoScreen [drawGraph - player plots, inner loop] took 44 ms
    08:34:52 Timer - InfoScreen [drawGraph - player plots, inner loop] took 54 ms
    08:34:52 Timer - InfoScreen [drawGraph - player plots, inner loop] took 62 ms
    08:34:52 Timer - InfoScreen [drawGraph - player plots, inner loop] took 74 ms
    08:34:52 Timer - InfoScreen [drawGraph - player plots, inner loop] took 78 ms
    08:34:52 Timer - InfoScreen [total - all players] took 431 ms
    That is just for 1 graph. No idea why each player takes more time but that action is consistent for each of the 7 graphs. Sometimes (3 times out of 56 attempts) it was quicker.

    The 'offending' bit of code is ...
    Code:
    def drawLine (self, screen, canvas, x0, y0, x1, y1, color):
    #	if abs(x0 - x1) <= 1 and abs(y0 - y1) <= 1: return
    	screen.addLineGFC(canvas, self.getNextLineName(), x0, y0 + 1, x1, y1 + 1, color)
    	screen.addLineGFC(canvas, self.getNextLineName(), x0 + 1, y0, x1 + 1, y1, color)
    	screen.addLineGFC(canvas, self.getNextLineName(), x0, y0, x1, y1, color)
    
    Yes - each one of those graph lines is actually 3 lines.
     
  12. ruff_hi

    ruff_hi Live 4ever! Or die trying

    Joined:
    Oct 24, 2005
    Messages:
    8,816
    Location:
    an Aussie in Boston
    Note that I have started to look at ways of improving the performance. If I uncomment that if blah: return statement, I get these sort of results ...

    Code:
    08:41:37 Timer - InfoScreen [drawGraph - player plots, inner loop] took 2 ms
    08:41:37 Timer - InfoScreen [drawGraph - player plots, inner loop] took 2 ms
    08:41:37 Timer - InfoScreen [drawGraph - player plots, inner loop] took 2 ms
    08:41:37 Timer - InfoScreen [drawGraph - player plots, inner loop] took 2 ms
    08:41:37 Timer - InfoScreen [drawGraph - player plots, inner loop] took 2 ms
    08:41:37 Timer - InfoScreen [drawGraph - player plots, inner loop] took 2 ms
    08:41:37 Timer - InfoScreen [drawGraph - player plots, inner loop] took 3 ms
    08:41:37 Timer - InfoScreen [drawGraph - player plots, inner loop] took 4 ms
    08:41:37 Timer - InfoScreen [drawGraph - player plots, inner loop] took 2 ms
    08:41:37 Timer - InfoScreen [total - all players] took 59 ms
    
    However, ...
     
  13. ruff_hi

    ruff_hi Live 4ever! Or die trying

    Joined:
    Oct 24, 2005
    Messages:
    8,816
    Location:
    an Aussie in Boston
    If I use the following code ...

    Code:
    def drawLine (self, screen, canvas, x0, y0, x1, y1, color):
    #	if abs(x0 - x1) <= 1 and abs(y0 - y1) <= 1: return
    #	screen.addLineGFC(canvas, self.getNextLineName(), x0, y0 + 1, x1, y1 + 1, color)
    #	screen.addLineGFC(canvas, self.getNextLineName(), x0 + 1, y0, x1 + 1, y1, color)
    	screen.addLineGFC(canvas, self.getNextLineName(), x0, y0, x1, y1, color)
    
    Code:
    08:46:35 Timer - InfoScreen [drawGraph - player plots, inner loop] took 5 ms
    08:46:35 Timer - InfoScreen [drawGraph - player plots, inner loop] took 6 ms
    08:46:35 Timer - InfoScreen [drawGraph - player plots, inner loop] took 7 ms
    08:46:35 Timer - InfoScreen [drawGraph - player plots, inner loop] took 5 ms
    08:46:35 Timer - InfoScreen [drawGraph - player plots, inner loop] took 5 ms
    08:46:35 Timer - InfoScreen [drawGraph - player plots, inner loop] took 12 ms
    08:46:35 Timer - InfoScreen [drawGraph - player plots, inner loop] took 8 ms
    08:46:35 Timer - InfoScreen [drawGraph - player plots, inner loop] took 9 ms
    08:46:35 Timer - InfoScreen [drawGraph - player plots, inner loop] took 12 ms
    08:46:35 Timer - InfoScreen [total - all players] took 103 ms
    ... and the graphs look like this ...
     
  14. ruff_hi

    ruff_hi Live 4ever! Or die trying

    Joined:
    Oct 24, 2005
    Messages:
    8,816
    Location:
    an Aussie in Boston
    So - options ...
    • leave it as and the loading of graphs just takes what it takes
    • put in the line to 'skip' if the start and end of the lines are close together - gives spotty graphs
    • reduce the thickness of the lines

    I am thinking that we will only do this for the 7-in-1 screen. The big graph will run through unchanged and take approximately 700ms (0.7 seconds) for each draw. Note that clicking around the various graph options or selecting / deselecting players forces a complete redraw. The delay is noticeable during the late game.
     
  15. ruff_hi

    ruff_hi Live 4ever! Or die trying

    Joined:
    Oct 24, 2005
    Messages:
    8,816
    Location:
    an Aussie in Boston
    Oh - just been thinking about those spotty graphs. Those occur because the actual line is made up of very small line segments and when you get a lot of little lines that don't go anyway (ie within 1 pixel of each other) no line is drawn and whole segments of missing little lines occur - thus causing the gaps.

    I can change that so that the starting position (x0, y0) is held constant until the end position (x1, y1) is at least 1 pixel away and then draw the line. This will result in no gaps and a smoother line. So, we can go with that option, resulting in smoother lines but there will be more line draws - hence more time.

    Edit: Did that and now get solid lines ...
    Code:
    09:05:53 Timer - InfoScreen [drawGraph - player plots, inner loop] took 3 ms
    09:05:53 Timer - InfoScreen [drawGraph - player plots, inner loop] took 2 ms
    09:05:53 Timer - InfoScreen [drawGraph - player plots, inner loop] took 2 ms
    09:05:53 Timer - InfoScreen [drawGraph - player plots, inner loop] took 3 ms
    09:05:53 Timer - InfoScreen [drawGraph - player plots, inner loop] took 3 ms
    09:05:53 Timer - InfoScreen [drawGraph - player plots, inner loop] took 4 ms
    09:05:53 Timer - InfoScreen [drawGraph - player plots, inner loop] took 3 ms
    09:05:53 Timer - InfoScreen [drawGraph - player plots, inner loop] took 3 ms
    09:05:53 Timer - InfoScreen [drawGraph - player plots, inner loop] took 3 ms
    09:05:53 Timer - InfoScreen [total - all players] took 53 ms
     
  16. ruff_hi

    ruff_hi Live 4ever! Or die trying

    Joined:
    Oct 24, 2005
    Messages:
    8,816
    Location:
    an Aussie in Boston
    Well - everyone is too late with their input, not that I gave you much time. I'm going to put in the smoothing code (skip stupid little lines that don't go anywhere) and run with that. It will apply to all charts, big, 7-in-1 and the default Civ4 versions too.
     
  17. EmperorFool

    EmperorFool Chieftain

    Joined:
    Mar 2, 2007
    Messages:
    9,633
    Location:
    Mountain View, California
    Well, you were too quick. The idea I was writing up to post is what you ended up doing.
     
  18. ruff_hi

    ruff_hi Live 4ever! Or die trying

    Joined:
    Oct 24, 2005
    Messages:
    8,816
    Location:
    an Aussie in Boston
    I've uploaded to SVN the final (to me) version. I'm not going to be playing with it (sans bug fixes) so feel free to hammer it and point out if you think I have screwed up somewhere.

    BTW: I changed the default behaviour a little bit - the graph screen now remembers how you left the screen and represents that instead of defaulting to the score. This is also true for when you turn off the BUG graphs - so a slight change to BtS Vanilla behaviour.
     
  19. EmperorFool

    EmperorFool Chieftain

    Joined:
    Mar 2, 2007
    Messages:
    9,633
    Location:
    Mountain View, California
    Holy crap! :goodjob:

    Random suggestions after playing with it for 2 minutes:

    • Remember all settings: add selected leaders and time frame selection.
    • Show all graph names across top in single-graph view. Best to avoid disappearing/moving elements in UI. Bold/yellow the one being viewed. Could drop title from corner of graph if done this way but not necessary.
    • Center the graph titles across top instead of left-align.
    • Selecting leaders results in drawing the lines in different orders, so lines shift in front/behind each other. Not a big deal, but I'm a perfectionist. Why is the draw order be changed?
    • Horizontally size legend so leader names fit inside the box. You can use CyInterface.determineWidth(string) for this.
    • Allow click on the graph itself (or just the background) to switch to single-graph view.
    I'm still floored. Great work!
     
  20. ruff_hi

    ruff_hi Live 4ever! Or die trying

    Joined:
    Oct 24, 2005
    Messages:
    8,816
    Location:
    an Aussie in Boston
    Thanks EF. Re your comments ...

    1. what? the graphs should remember how you left it
    2. good point - more consistent - F9 info screen was coded by someone different from other screens so the method of yellow is slightly different - but I can worth with their method
    3. nawww - I like top left - and less chance of actually covering a graph line that way
    4. that shouldn't happen - lines use leader colors - will look at it. The order is based on the player ID - just loops thru them and draws the lines in that order
    5. good point - will look at it
    6. IFAIK, panels aren't not clickable - I did try it.
     

Share This Page