1. We have added the ability to collapse/expand forum categories and widgets on forum home.
    Dismiss Notice
  2. Photobucket has changed its policy concerning hotlinking images and now requires an account with a $399.00 annual fee to allow hotlink. More information is available at: this link.
    Dismiss Notice
  3. All Civ avatars are brought back and available for selection in the Avatar Gallery! There are 945 avatars total.
    Dismiss Notice
  4. To make the site more secure, we have installed SSL certificates and enabled HTTPS for both the main site and forums.
    Dismiss Notice
  5. Civ6 is released! Order now! (Amazon US | Amazon UK | Amazon CA | Amazon DE | Amazon FR)
    Dismiss Notice
  6. Dismiss Notice
  7. Forum account upgrades are available for ad-free browsing.
    Dismiss Notice

New Civilopedia Section: Routes

Discussion in 'Rise of Mankind: A New Dawn' started by Vokarya, Jun 2, 2017.

  1. Vokarya

    Vokarya Chieftain

    Joined:
    Mar 25, 2011
    Messages:
    5,466
    I have decided to take a crack at creating a Civilopedia section for Routes. This was the first stage: about a half-hour's worth of work. I cloned the Improvement page to make the Routes page. It is at least capable of generating a list of the route types and their icons.

    Civ4ScreenShot0078.JPG

    As you can see, it's not very good yet. The right-side panel doesn't work at all and the left-side popups need work as well. I'm not asking for help just yet. But I will if I run into a block.
    Civ4ScreenShot0079.JPG
     
  2. Fozman

    Fozman Chieftain

    Joined:
    Apr 12, 2017
    Messages:
    128
    Gender:
    Male
    Good to see this, Vokarya. This was one of the concepts I had trouble finding information on when I started using this mod. Another concept I had a problem with was the Cultural Victory condition. I think you set me straight on both of these. If you have a moment while you're editing the Civilopedia, RAND Concepts could probably use a quick blurb about the additional cities required to achieve Cultural Victory compared to BtS.
     
  3. IPEX-731BA5DD06

    IPEX-731BA5DD06 Chieftain

    Joined:
    Dec 15, 2005
    Messages:
    2,475
    Location:
    Melbourne, Victoria, Australia
    F8 Screen will show what you need
     
  4. Fozman

    Fozman Chieftain

    Joined:
    Apr 12, 2017
    Messages:
    128
    Gender:
    Male
    Hmm... checked with Mastery off and sure enough, there it is. Time to stop playing with that option on. Thanks.

    Still think a small blurb in the 'Pedia is warranted, though.
     
  5. Vokarya

    Vokarya Chieftain

    Joined:
    Mar 25, 2011
    Messages:
    5,466
    So far, I've come across two different anomalies in this process.

    First, I was trying to list the costs for routes, and I discovered that nowhere in the Civilopedia is the build costs for improvements listed. I think this should be fixed.

    Second, when I actually go into the game, the Routes listing cuts off after the Cart Path. I'm not sure why this is. It feels like I need to update another file, but I don't know which file or files. So far, I have added SevoPediaRoute.py, and updated SevoPediaIndex.py, SevoPediaMain,py, and SevoScreenEnums.py, which was enough to get the screenshots above, and then I updated CvScreensInterface.py to get the icons to show. That got me to here:

    Civ4ScreenShot0107.JPG

    Then I've reduced the size of that icon panel so I can fit the cost on it, the way the cost is shown on the Tech Civilopedia pages. Now I have to figure out the Python syntax for the cost of an improvement; the cost is actually part of the Build action, not the improvement itself.
     
  6. 45°38'N-13°47'E

    45°38'N-13°47'E Chieftain

    Joined:
    Jun 7, 2008
    Messages:
    5,591
    Location:
    Just wonder...
    Why should you stop using Mastery, except for the fact that you prefer a cultural victory? It's perfectly explained: when you use Cultural victory you can see how many legendary cities you need in F8 screen. When Mastery is on, every other victory is switched off and you get 20 points for every legendary city, no matter how many of them you get. And this is explained in the Mastery entry of civilopedia.
     
  7. Fozman

    Fozman Chieftain

    Joined:
    Apr 12, 2017
    Messages:
    128
    Gender:
    Male
    Yes, it's quite clear to me now. It was not when I started playing. Mastery is on as default, yes? The Cultural Victory requirement does not show up with Mastery on. That was what led to my previous confusion on the topic.
     
  8. platyping

    platyping Sleeping Dragon

    Joined:
    Oct 22, 2010
    Messages:
    4,626
    Location:
    Emerald Dreams
    Code:
        def placeStats(self):
            screen = self.top.getScreen()
            panelName = self.top.getNextWidgetName()
            screen.addListBoxGFC(panelName, "", self.X_STATS_PANE, self.Y_STATS_PANE, self.W_STATS_PANE, self.H_STATS_PANE, TableStyles.TABLE_STYLE_EMPTY)
            screen.enableSelect(panelName, False)
            RouteInfo = gc.getRouteInfo(self.iRoute)       
            sText = CyTranslator().getText("TXT_KEY_DEMO_SCREEN_VALUE_TEXT",()) + ": " + str(RouteInfo.getValue())
            screen.appendListBoxString(panelName, "<font=4>" + sText + "</font>", WidgetTypes.WIDGET_GENERAL, 0, 0, CvUtil.FONT_LEFT_JUSTIFY)
            for iBuild in xrange(gc.getNumBuildInfos()):
                BuildInfo = gc.getBuildInfo(iBuild)
                if gc.getBuildInfo(iBuild).getRoute() == self.iRoute:
                    iTime = BuildInfo.getTime()
                    if iTime > 0:
                        sText = u"%s: %d" % (CyTranslator().getText("TXT_KEY_VICTORY_TIME", ()), iTime)
                        screen.appendListBoxString(panelName, "<font=4>" + sText + "</font>", WidgetTypes.WIDGET_GENERAL, 0, 0, CvUtil.FONT_LEFT_JUSTIFY)
                    iCost = BuildInfo.getCost()
                    if iCost > 0:
                        sText = u"%s%c" % (CyTranslator().getText("TXT_KEY_PEDIA_COST", (iCost,)), gc.getCommerceInfo(CommerceTypes.COMMERCE_GOLD).getChar())
                        screen.appendListBoxString(panelName, "<font=4>" + sText + "</font>", WidgetTypes.WIDGET_GENERAL, 0, 0, CvUtil.FONT_LEFT_JUSTIFY)
                    break
    For your reference
     
  9. Vokarya

    Vokarya Chieftain

    Joined:
    Mar 25, 2011
    Messages:
    5,466
    I'm using a setLabel rather than a placeStats for the moment. I just wanted to get this going. The time part I'm not so certain is useful, but I'd have to figure out how to manipulate the raw number to make it meaningful.

    I finally got the reason for the xrange: it's so that the build list doesn't have to correspond exactly with the routes list.

    So that gives this:
    Civ4ScreenShot0108.JPG
    At least the cost is visible. The next thing for me to do is create a Requirements panel.
     
    Last edited: Jun 4, 2017
  10. Vokarya

    Vokarya Chieftain

    Joined:
    Mar 25, 2011
    Messages:
    5,466
    That turned out to be less painful than I thought. The biggest issue was actually having self.placeRequires in the wrong place. Now the Civilopedia is capable of displaying the tech and resource requirements for routes, including OR prerequisites. Like this:
    Civ4ScreenShot0109.JPG

    The movement panel is going to be next.
     
  11. Vokarya

    Vokarya Chieftain

    Joined:
    Mar 25, 2011
    Messages:
    5,466
    I finally got the movement panel done. This will display the movement cost in fractions of a movement point for a route whose iMovement value equals its iFlatMovement value. This covers Cart Path, Road, Paved Road, Highway, and Tunnel. The fraction in question is the iMovement value divided by 120. Cart Path has an iMovement of 120, so it doesn't normally speed up movement, but units with speed 2 that otherwise don't ignore terrain movement costs (mostly Chariot) can move 2 tiles/turn along Cart Paths.

    For routes with iFlatMovement less than iMovement -- Railroad, Electric Railroad, Maglev, and Jumplane -- it will display both the general number of tiles moved and the movement consumed for fast units. The iFlatMovement allows units to move 120/iFlatMovement tiles per turn regardless of speed, but units with speed greater than iMovement divided by iFlatMovement can move farther. Units have to be speed 3 or more to do this on most of the railway routes, but have to be at least speed 6 to do this on a Jumplane. A Rover with Patrol II promotion would qualify and be able to move 48 tiles/turn instead of Jumplane's normal 40.

    Civ4ScreenShot0166.JPG

    I'm now figuring out what else is possible. I want a small yields panel, and a panel for additional yields to improvements. Some improvements (especially Mines) get more productive with routes. I don't know what else there is to add. Routes don't have any kind of civilopedia file attached to their XML, so I don't know if it's possible to add anything like that. The same goes for the illustration panel like buildings and improvements have.
     
  12. platyping

    platyping Sleeping Dragon

    Joined:
    Oct 22, 2010
    Messages:
    4,626
    Location:
    Emerald Dreams
    Mine includes:
    1) Cost reduction via tech
    2) Yields to Improvements
    3) Units that can build them
    4) Concept info just to fill the space
     
  13. Vokarya

    Vokarya Chieftain

    Joined:
    Mar 25, 2011
    Messages:
    5,466
    I've got the yield and improvement yield panels working, but I need to rearrange them a bit.

    The one thing that doesn't seem to be working is if the Tunnel ability can be checked by Python. I want to insert a line that says whether the route allows land units to cross water tiles. The <bSeaTunnel> tag controls this in the XML.
    This should be all that is required:
    Code:
            if gc.getRouteInfo(self.iRoute).isSeaTunnel():
                szSpecialText +=    "\n"
                szSpecialText += localText.getText("TXT_KEY_PEDIA_TUNNEL", ())
    but this bit of code, when inserted into my SevoPediaRoute.py file, not only doesn't produce anything, but it wrecks the code following it. That's enough to tell me that this is not a working test. isSeaTunnel appears to be defined in the Sources file, but I don't know if it's possible to use it in Python or how to use it.
     
  14. Vokarya

    Vokarya Chieftain

    Joined:
    Mar 25, 2011
    Messages:
    5,466
    I don't really see a need to fill space with units or concept info that is identical for every route. I think this is what I am going to stick with for now:

    Civ4ScreenShot0167.JPG

    The next problem that I have is that this works fine from the main menu but does not work in-game. With exceptions enabled, I get this:

    Civ4ScreenShot0168.JPG

    I wonder if there is another file that I need to update. So far, I have updated:
    • Python\Contrib\Sevopedia\SevoPediaIndex.py
    • Python\Contrib\Sevopedia\SevoPediaMain.py
    • Python\Contrib\Sevopedia\SevoScreensEnum.py
    • Python\EntryPoints\CvScreensInterface.py
    • Python\Screens\CvPediaHistory.py
    • Python\Screens\CvPediaMain.py
    and made one new file, Python\Contrib\Sevopedia\SevoPediaRoute.py. I looked for every file that looked for Improvements and copied that for Routes, but I know that when I tried updating Python\Screens\CvScreenEnums.py, the whole Sevopedia broke. So I'm not sure what else I can do.
     
  15. platyping

    platyping Sleeping Dragon

    Joined:
    Oct 22, 2010
    Messages:
    4,626
    Location:
    Emerald Dreams
    Actually all along I thought Sevo comes with a Routes page. I believed I saw it in HR or so.
    For mine, I didn't even bothered to edit the screeninterface and enums. Just the main and a new page is enough.

    Since yours is working in the main menu but not in game, chances are the bug is in the main or new page when there is an Active Player.
     
  16. Vokarya

    Vokarya Chieftain

    Joined:
    Mar 25, 2011
    Messages:
    5,466
    I tried pulling out all the panels and even the def interfaceScreen function out of the SevoPediaRoute file and it still didn't make a difference, so I don't think the problem is there.

    This is the line where I'm getting the Python exception, in SevoPediaMain.py:
    Code:
    screen.setTableText(self.ITEM_LIST_ID, 0, i, u"<font=3>" + item[0] + u"</font>", info(item[1]).getButton(), widget, data1, data2, CvUtil.FONT_LEFT_JUSTIFY)
    which generates the list of items for the middle panel. I didn't edit this line at all. Everywhere that I did edit in SevoPediaMain was to clone the code for the improvements panel and edit it for the routes panel. The only things that I can see causing problems are widget, data1, and data2.

    data1 is item[1] from the self.list defined this way:
    Code:
        def placeRoutes(self):
            self.list = self.getRouteList()
            self.placeItems(WidgetTypes.WIDGET_PEDIA_JUMP_TO_ROUTE, gc.getRouteInfo)
        
        def getRouteList(self):
            return self.getSortedList(gc.getNumRouteInfos(), gc.getRouteInfo)
    data2 is just 1. The active player doesn't seem to get used at all, so I really don't get what is wrong.
     
  17. platyping

    platyping Sleeping Dragon

    Joined:
    Oct 22, 2010
    Messages:
    4,626
    Location:
    Emerald Dreams
    WidgetTypes.WIDGET_PEDIA_JUMP_TO_ROUTE isn't a BTS default widget. So it depends on whether it works as intended.
    Unidentifiable c++ exception isn't very helpful, but since cart is shown, while the rest is missing, I would assume that data1 and data2 fed into this widget is problematic.

    Try using WIDGET_GENERAL or WIDGET_PYTHON with -1,-1 and see if you can generate the whole list.
     
  18. Vokarya

    Vokarya Chieftain

    Joined:
    Mar 25, 2011
    Messages:
    5,466
    Replacing WIDGET_PEDIA_JUMP_TO_ROUTE with either WIDGET_GENERAL or WIDGET_PYTHON, not even changing the data1 and data2 values, did produce the list of routes as you said. So you are right that the problem is the widget.

    I looked into the DLL code. I can understand the code to some extent, but I can't write any of it. Here is what I found. There is a difference between doPediaRouteJump and doImprovementRouteJump, lines 2139-2162 of CvDLLWidgetData.cpp.
    This is doPediaRouteJump
    :
    Code:
    void CvDLLWidgetData::doPediaRouteJump(CvWidgetDataStruct &widgetDataStruct)
    {
        PYTHON_ACCESS_LOCK_SCOPE
    
        CyArgsList argsList;
        argsList.add(widgetDataStruct.m_iData1);
        PYTHON_CALL_FUNCTION(__FUNCTION__, PYScreensModule, "pediaJumpToRoute", argsList.makeFunctionArgs());
    }
    and this is doPediaImprovementJump:
    Code:
    void CvDLLWidgetData::doPediaImprovementJump(CvWidgetDataStruct &widgetDataStruct, bool bData2)
    {
        PYTHON_ACCESS_LOCK_SCOPE
    
        CyArgsList argsList;
        if (bData2)
        {
            argsList.add(widgetDataStruct.m_iData2);
        }
        else
        {
            argsList.add(widgetDataStruct.m_iData1);
        }
        PYTHON_CALL_FUNCTION(__FUNCTION__, PYScreensModule, "pediaJumpToImprovement", argsList.makeFunctionArgs());
    }
    I suspect that if doPediaRouteJump matched doPediaImprovementJump, the Sevopedia updates would work.
     
  19. 45°38'N-13°47'E

    45°38'N-13°47'E Chieftain

    Joined:
    Jun 7, 2008
    Messages:
    5,591
    Location:
    Just wonder...
    I will try and change it, no problem
     
  20. Vokarya

    Vokarya Chieftain

    Joined:
    Mar 25, 2011
    Messages:
    5,466
    Thank you. Do that and I will see what happens afterwards.
     

Share This Page