1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Trade Route Screens, Tutorials, Questions, etc.

Discussion in 'Civ4Col - Medieval: Conquests' started by Kailric, Jan 4, 2014.

  1. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    Here we can discuss all things related to the new trade route screens. I am currently working making the new system modder friendly when I get the first update done I will post a tutorial as well.


    Current Status and To Do list
    -fix up the different Price lists from all routes on Unit Help
    -fix up button spacing for new travel commands
    -re add the links to other routes in all trade screens
    -finish Directions
    -add Techs requirements to current branch
    -fix up required tech colored plots
    -add XML tag for Movies
    -Setup the Automate Route commands
    -add in a "Sail to West" option in trade screens
    -debug

    Units can travel from:
    Land Routes
    Sea Routes
    Both Land and Sea
    Any City
    Barbarian City
    Foreign City
    Owned Cities,
    Or Cities with certain buildings


    The above is in development.
     
  2. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    You can add new Trade Screens in these 5 main steps:

    1. Make a copy of an existing Trade Screen python file such as CvSpiceRouteScreen.
    Rename it to whatever you want, I’ll use CvIncenseRoute for an example.

    Open this new file in a code editor, I use Komodo for python files.

    Change the “class CvSpiceRouteScreen:” to ”class CvIncenseRouteScreen:”

    Goto - def getScreen(self):
    return CyGInterfaceScreen("EuropeScreen", CvScreenEnums.SPICE_ROUTE_SCREEN)

    Change CvScreenEnums.SPICE_ROUTE_SCREEN) to CvScreenEnums.INCENSE_ROUTE_SCREEN)

    2. Open CvScreenEnums.py and add the INCENSE_ROUTE_SCREEN to bottom of list as:

    Code:
    SPICE_ROUTE_SCREEN = 32
    SILK_ROAD_SCREEN = 33
    TRADE_FAIR_SCREEN = 34
    IMMIGRATION_SCREEN = 35
    [COLOR="Red"]INCENSE_ROUTE_SCREEN = 36[/COLOR]
    3. Open CvScreenInterface.py in Python/EntryPoints folder
    Add the following lines below the immigration screen code:

    Code:
    import CvImmigrationScreen
    [COLOR="Red"]import CvIncenseRouteScreen[/COLOR]
    Find this code next and add the incense code below it:

    Code:
    immigrationScreen = CvImmigrationScreen.CvImmigrationScreen()
    def showImmigrationScreen(argsList):
    	if (-1 != CyGame().getActivePlayer()):
    		immigrationScreen.interfaceScreen()
    
    [COLOR="Red"]incenserouteScreen = CvIncenseRouteScreen.CvIncenseRouteScreen()
    def showCvIncenseRouteScreen(argsList):
    	if (-1 != CyGame().getActivePlayer()):
    		incenserouteScreen.interfaceScreen()[/COLOR]
    
    Goto- HandleMouseoverMap and add incense code to the list such as:

    Code:
    TRADE_FAIR_SCREEN: tradefairScreen,
    [COLOR="Red"]INCENSE_ROUTE_SCREEN: incenserouteScreen,[/COLOR]
    Goto- HandleInputMap and add the incense code there:
    Code:
    TRADE_FAIR_SCREEN: tradefairScreen,
    IMMIGRATION_SCREEN: immigrationScreen,
    [COLOR="Red"]INCENSE_ROUTE_SCREEN: incenserouteScreen,[/COLOR]
    This next part can be skipped as I added code to bypass the Control system, but if you want to add a Control then by all means do so :)
    You will also need to use the same WIDGET_ACTION as the other default Trade Screens in the MainInterface.py in step 4.
    Spoiler :
    Now you can add Control code to the DLL, open CvEnums.h in a C++ editor. I use the Free Microsoft Visual C++ 2010 Express.
    Add the below code in red:
    CONTROL_TRADE_FAIR_SCREEN,
    CONTROL_IMMIGRATION_SCREEN,
    CONTROL_INCENSE_ROUTE_SCREEN,

    Open CvGame.cpp add the below codes:
    In the CvGame::canDoControl function add:
    case CONTROL_TRADE_FAIR_SCREEN:
    case CONTROL_IMMIGRATION_SCREEN:
    case CONTROL_INCENSE_ROUTE_SCREEN:

    In the CvGame::doControl function add:
    case CONTROL_SILK_ROAD_SCREEN:
    {
    CyArgsList argsList;
    argsList.add(-1);
    gDLL->getPythonIFace()->callFunction(PYScreensModule, "showSilkRoadScreen", argsList.makeFunctionArgs());
    }
    break;
    case CONTROL_INCENSE_ROUTE_SCREEN:
    {
    CyArgsList argsList;
    argsList.add(-1);
    gDLL->getPythonIFace()->callFunction(PYScreensModule, "showIncenseRouteScreen", argsList.makeFunctionArgs());
    }
    break;

    Open CvGlobals.cpp go to CvGlobals::CheckEnumControlTypes and add

    FAssertMsg(!strcmp(GC.getControlInfo(CONTROL_INCENSE_ROUTE_SCREEN).getType(), "CONTROL_INCENSE_ROUTE_SCREEN"), CvString::format("XML error. Found %s instead of CONTROL_INCENSE_ROUTE_SCREEN at index %d", GC.getControlInfo(CONTROL_INCENSE_ROUTE_SCREEN).getType(), CONTROL_INCENSE_ROUTE_SCREEN).c_str());
    GC.getControlInfo(CONTROL_SILK_ROAD_SCREEN).getType(), CONTROL_SILK_ROAD_SCREEN).c_str());

    Finally open CyEnumsInterface.cpp and add the below code in red to python::enum_<ControlTypes>

    .value("CONTROL_TRADE_FAIR_SCREEN", CONTROL_TRADE_FAIR_SCREEN)
    .value("CONTROL_IMMIGRATION_SCREEN", CONTROL_IMMIGRATION_SCREEN)
    .value("CONTROL_INCENSE_ROUTE_SCREEN", CONTROL_INCENSE_ROUTE_SCREEN)

    Now open CIV4ControlInfos.xml, we need to add the new control info. It needs to be places right after CONTROL_IMMIGRATION_SCREEN to keep the order in sync:
    <ControlInfo>
    <Type>CONTROL_INCENSE_ROUTE_SCREEN</Type>
    <Description>Incense Route</Description>
    <Help/>
    <HotKey>KB_I</HotKey>
    <bAltDown>1</bAltDown>
    <bShiftDown>0</bShiftDown>
    <bCtrlDown>0</bCtrlDown>
    <iHotKeyPriority>0</iHotKeyPriority>
    <HotKeyAlt/>
    <bAltDownAlt>0</bAltDownAlt>
    <bShiftDownAlt>0</bShiftDownAlt>
    <bCtrlDownAlt>0</bCtrlDownAlt>
    <iHotKeyPriorityAlt>0</iHotKeyPriorityAlt>
    </ControlInfo>
    We are using KB_I with the alt key pressed as a HotKey for this screen as this is not being used. You will have to search the XML for existing HotKey assignments.


    4. Now to get the Screen Button Displayed and functioning open CvMainInterface.py

    First add your new screen to the list of Trade Screens at:
    Code:
    def SetGlobals ( self, screen ):
    		#TK Med Trade Screen List
    		global TRADE_SCREEN_SPICE_ROUTE_MARKET
    		global TRADE_SCREEN_SILK_ROAD_MARKET
    		global TRADE_SCREEN_TRADE_FAIR_MARKET
                    [COLOR="Red"]global TRADE_SCREEN_INCENSE_ROUTE_MARKET[/COLOR]
    
    		TRADE_SCREEN_SPICE_ROUTE_MARKET = CvUtil.findInfoTypeNum('TRADE_SCREEN_SPICE_ROUTE_MARKET')
    		TRADE_SCREEN_SILK_ROAD_MARKET = CvUtil.findInfoTypeNum('TRADE_SCREEN_SILK_ROAD_MARKET')
    		TRADE_SCREEN_TRADE_FAIR_MARKET = CvUtil.findInfoTypeNum('TRADE_SCREEN_TRADE_FAIR_MARKET')
                   [COLOR="Red"] TRADE_SCREEN_INCENSE_ROUTE_MARKET = CvUtil.findInfoTypeNum('TRADE_SCREEN_INCENSE_ROUTE_MARKET')
    [/COLOR]

    Next add this code:

    Code:
    iRoutes = iBtnX + (self.ADVISOR_BUTTON_SPACING / 2)
    screen.setImageButton("TradeFairScreenButton", ArtFileMgr.getInterfaceArtInfo("INTERFACE_EUROPE").getPath(), iRoutes - (TOP_CENTER_HUD_HEIGHT - self.ADVISOR_BUTTON_SIZE) / 2, (TOP_CENTER_HUD_HEIGHT - self.ADVISOR_BUTTON_SIZE) * 4, self.ADVISOR_BUTTON_SIZE, self.ADVISOR_BUTTON_SIZE, WidgetTypes.WIDGET_ACTION, gc.getControlInfo(ControlTypes.CONTROL_TRADE_FAIR_SCREEN).getActionInfoIndex(), -1 )
    screen.setImageShape("TradeFairScreenButton", ImageShapes.IMAGE_SHAPE_ELLIPSE, -1)
    screen.setHitMargins("TradeFairScreenButton", self.ADVISOR_BUTTON_SIZE / 6, self.ADVISOR_BUTTON_SIZE / 6)
    screen.hide("TradeFairScreenButton")
    
    [COLOR="Red"]iBtnX += self.ADVISOR_BUTTON_SPACING
    screen.setImageButton("IncenseRouteScreenButton", ArtFileMgr.getInterfaceArtInfo("INTERFACE_SPICE_ROUTE").getPath(), iBtnX, (TOP_CENTER_HUD_HEIGHT - self.ADVISOR_BUTTON_SIZE) / 2, self.ADVISOR_BUTTON_SIZE, self.ADVISOR_BUTTON_SIZE, WidgetTypes.WIDGET_POP_UP_SCREEN, TRADE_SCREEN_INCENSE_ROUTE_MARKET, -1)
    screen.setImageShape("IncenseRouteScreenButton", ImageShapes.IMAGE_SHAPE_ELLIPSE, -1)
    screen.setHitMargins("IncenseRouteScreenButton", self.ADVISOR_BUTTON_SIZE / 6, self.ADVISOR_BUTTON_SIZE / 6)
    screen.hide("IncenseRouteScreenButton")[/COLOR] 
    Note that ArtFileMgr.getInterfaceArtInfo("INTERFACE_SPICE_ROUTE").getPath() needs to point to your new Trade Route Screen button, but for now we use Spice Route button.

    Also note; iBtnX and the equation "(TOP_CENTER_HUD_HEIGHT - self.ADVISOR_BUTTON_SIZE) / 2", these numbers set the X and Y coordinates of the button on the interface screen. You will need to toy with these numbers in order to get the button exactly where you want it.

    Next add the code below to def updateTravelRoutes( self ):
    Code:
    if (pPlayer.getHasTradeRouteType(TRADE_SCREEN_SPICE_ROUTE_MARKET)):	
    				screen.show("SpiceRouteScreenButton")
    				
    			else:
    				screen.hide("SpiceRouteScreenButton")
    			
    [COLOR="Red"]if (pPlayer.getHasTradeRouteType(TRADE_SCREEN_INCENSE_ROUTE_MARKET)):	
    				screen.show("IncenseRouteScreenButton")
    				
    			else:
    				screen.hide("IncenseRouteScreenButton")[/COLOR]
    Next add code to the def updateCityScreen

    Code:
    screen.hide("SpiceRouteScreenButton")
    screen.hide("SilkRoadScreenButton")
    [COLOR="Red"]screen.hide("IncenseRouteScreenButton")[/COLOR]
    Next add this code to def updateResourceTable

    Code:
    screen.hide("TradeFairScreenButton")
    screen.hide("SpiceRouteScreenButton")
    screen.hide("SilkRoadScreenButton")
    [COLOR="Red"]screen.hide("IncenseRouteScreenButton")[/COLOR]
    Lastly, add this code to def updateInfoPaneStrings

    Code:
    screen.hide("SpiceRouteScreenButton")
    screen.hide("SilkRoadScreenButton")
    [COLOR="Red"]screen.hide("IncenseRouteScreenButton")[/COLOR]
    5. Next add your new trade screen route to CvEuropeInfos.xml such as:
    Code:
    <EuropeInfo>
          <Type>TRADE_SCREEN_INCENSE_ROUTE_MARKET</Type>
          <Description>TXT_KEY_COMMAND_TRAVEL_SILK_ROAD</Description>
          <Strategy>TXT_KEY_COMMAND_TRAVEL_SILK_ROAD_HELP</Strategy>
          <Help>Incense Route</Help>
          <Direction>north</Direction>
          <DirectionArrays/>
          <bStart>0</bStart>
          <iTripLength>3</iTripLength>
          <iMinLandDistance>0</iMinLandDistance>
          <iMaxLandCoverage>4</iMaxLandCoverage>
          <iWidthPercent>20</iWidthPercent>
          <TradeScreenTypes/>
          <PythonTradeScreen>showIncenseRouteScreen</PythonTradeScreen>
          <Button>Art/Interface/Game Hud/Actions/travelsilkroad.dds</Button>
        </EuropeInfo>
    
    You can now set the specifics of your new trade route and change the above xml tags to your needs.

    6. One final step is to add your trade screen XML tag to the TradeScreen file. Open CvIncenseRoute.py and change the below red code as so:
    Code:
    #TradeScreen Code
    		self.TRADE_SCREEN_SPICE_ROUTE_MARKET = CvUtil.findInfoTypeNum('[COLOR="Red"]TRADE_SCREEN_INCENSE_ROUTE_MARKET[/COLOR]')
    Please, let me know if there are any questions or bugs in this tutorial.
     
  3. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    I am looking at the possibility of creating Unit Trade Screen Buttons on the fly. In the CvMainInterface.py there is the "actions = CyInterface().getActionsToShow()" code that apparently builds the list of actions a unit can do. But I can't seem to find where the getActionsToShow() is defined.

    Anyway, if that much of the code is off limits to us we will then have to either tap into the for loop that builds a Unit's command list that is present and add our Trade Screen Commands or perhaps display those commands elsewhere on the screen.

    Code:
    ActionButtonList = []
    for i in actions:
    	if CyInterface().canHandleAction(i, True):
    		Xcord = (math.sin(math.radians(iAngle * self.NADER_SIGN)) * int(yResolution * self.CENTER_POINT_HEIGHT)) * self.NADER_SIGN * ASPECT_ADJUSTMENT + ((xResolution) / 2)
    		Ycord = (math.cos(math.radians(iAngle * self.NADER_SIGN)) * int(yResolution * self.CENTER_POINT_HEIGHT)) - (yResolution * self.CENTER_POINT_HEIGHT) + yResolution - (yResolution * self.CENTER_HUD_HEIGHT)
    		#Tk Med Move Delete
    		#iPriority = gc.getActionInfo(i).getOrderPriority()
    		szName = "ActionButton" + str(iCount)
    		screen.setImageButton(szName, gc.getActionInfo(i).getButton(), int(Xcord) - LARGE_BUTTON_SIZE, int(Ycord) - LARGE_BUTTON_SIZE, LARGE_BUTTON_SIZE * 2, LARGE_BUTTON_SIZE * 2, WidgetTypes.WIDGET_ACTION, i, -1)
    		screen.setImageShape(szName, ImageShapes.IMAGE_SHAPE_ELLIPSE, -1)
    		screen.setHitMargins(szName, 18, 18)
    		if not CyInterface().canHandleAction(i, False):
    			screen.overlayButtonGFC(szName, ArtFileMgr.getInterfaceArtInfo("INTERFACE_DISABLED_BUTTON").getPath())
    		elif pHeadSelectedUnit.isActionRecommended(i):
    			screen.overlayButtonGFC(szName, ArtFileMgr.getInterfaceArtInfo("INTERFACE_HIGHLIGHTED_BUTTON").getPath())
    		ActionButtonList.append(szName)
    
    		iAngle -= self.ARC_SEPERATION
    		if iAngle < 0:
    			self.NADER_SIGN = -1
    		iCount += 1
     
  4. Nightinggale

    Nightinggale Chieftain Supporter

    Joined:
    Feb 2, 2009
    Messages:
    3,986
    "actions = CyInterface().getActionsToShow()" is the only place in vanilla that getActionsToShow() is used. Looks like the interesting part of this function hides inside the exe :(

    Are you sure we can't add buttons with the location "next in the button row"? If I select a free colonist I get the found city button. If I select a monk I get found monastery. If I select both I get both, but the buttons now have new locations on the screen. Investigating how those button placement works seems to be the key to place the new buttons.
     
  5. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    Yeah, after sleeping on it, it would stand to reason we can hijack the above code and place our own Trade Screen buttons there, preferably having them appear all the way to the left perhaps. All we would need to do is cycle through the "EuropeInfos" and use a "canTravelTradeScreen()" function, and for each one the unit can travel on create a button using the Xcord and Ycord coordinates...

    I just tested this and I was able to continue the code and I manually added back the Delete Unit Button as the first button on the left. So, it all looks promising.
     
  6. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    I am working on some of the requirements for the Trade Routes so if anyone has some suggestions now is a good time. Below is a list of the options I have planned...


    Units can travel from:
    Land Routes
    Sea Routes
    Both Land and Sea
    Any City
    Barbarian City
    Foreign City
    Owned Cities,
    Or Cities with certain buildings

    Right now only the north, south, east, and west directions are being used but I plan to see if we can also setup Corner Trade Routes like in the northwest for example. That would give a total of 8 potential different travel locations. But, different trade routes can leave from the same location so the potential is far greater than 8.
     
  7. Nightinggale

    Nightinggale Chieftain Supporter

    Joined:
    Feb 2, 2009
    Messages:
    3,986
    At one point I was considering using the center of planets for land trade routes in col2071. I have no idea if it is a good idea or how to code it generically.

    However it does tell me that we should allow the map generating script to place access points where it wants to do it. Codewise this would be accesspoint you don't place using your code. Instead the python script would need access to place access points. This will allow map scripts with placements we haven't even considered yet. It will also allow different map scripts with different route placements etc.

    EDIT: traveling from cities could be limited by city types as well as owner.
     
  8. Lib.Spi't

    Lib.Spi't Overlord of the Wasteland

    Joined:
    Feb 12, 2009
    Messages:
    3,671
    Location:
    UK
    For requirements, you have foreign cities, is that all none player cities?

    would it be possible to have an X Civ cities?

    So CIVILIZATION_VIKING cities for example?

    Then you could have different Civs with different units available etc. or have civs with a specific yield that they will buy high or sell low. Particularly useful for scenarios.

    Another one might be Improvements or tiles, so you could do things like a worm hole in 2071, or a 'market' improvement. They may not get used straight away, but I could certainly see them coming in handy as tools in the future. Again especially for scenarios.

    On Buttons, one thing I noticed in game is that you often have duplicates of the 'travel to X' buttons, like two silk roaads. Actually this might just be the auto go to and the leave for X button. But I think they actually do the same thing...
     
  9. Nightinggale

    Nightinggale Chieftain Supporter

    Joined:
    Feb 2, 2009
    Messages:
    3,986
    We should have more complex logics on which buttons to show. Something like:
    Spoiler :
    if (unit can use traderoute && player has access to traderoute)
    {
    if (plot is access point)

    {
    show travel from this plot button​
    } else {
    show move to route button​
    }​
    }

    This should reduce the number of unneeded buttons.
     
  10. orlanth

    orlanth Storm God. Yarr!

    Joined:
    Nov 17, 2001
    Messages:
    1,759
    How about instead of needing to make a separate interface button for every tradescreen, you use the existing box that comes up whenever you enter a "Sail to Europe" plot in vanilla. Instead of asking if you want to sail to europe, it would let you select from any of the TradeScreens linked to that plot (if you have discovered access to them).
     
  11. Nightinggale

    Nightinggale Chieftain Supporter

    Joined:
    Feb 2, 2009
    Messages:
    3,986
    That wouldn't make a real difference if the code from #9 works. Using that one will only show the buttons with traderoutes available from the plot in question.

    The goto access plot on the other hand could be interesting to merge into one button with a popup. However it should be easy to use meaning we could do something like "goto the last 3 you visited" and then a popup with a full list.
    The popup could me made like the arrow for units on the right of the button row. If we add traderoutes on the left and code to ensure only one is active at once, then we will have something. Still I prefer to have the buttons in the row as long as there are room for them. For now I don't consider the lack of space to be an issue.

    Give me a 1024x768 monitor for a month and ask again if you really want to hide buttons :p
     
  12. orlanth

    orlanth Storm God. Yarr!

    Joined:
    Nov 17, 2001
    Messages:
    1,759
    Is it possible to discover access to Sail-to-Europe plot types separately from discovering access to TradeScreen types? I think this may be already technically possible XML tags but not sure if the AI pathfinding could handle that, if it's currently coded to look specifically just for SpiceRoute etc.

    Similar to Lib Spi't I have been thinking about using lines made of an impassable terrain to segment the map into several regions, and let the player gradually discover access to "SailtoEurope"-plottypes linking these regions. This could be used for any mod with various "theaters of operation", e.g. having several small sub-maps for areas like the Carribean, India, the Orient, and Africa, like in Empire Total War & similar games. If there is one SailtoEurope plot type for each of these areas, you could gradually discover access to them independently; and certain civs could get a "head start" with access to certain areas which would be interesting. In vanilla I think you can already choose which of the discovered SailtoEurope plot types to sail to when exiting the Europe tradescreen, so I think that should be possible.

    Lib Spi't mentioned he encountered errors in trying to separate map regions, which I'm guessing may be due to pathfinding. I think to really achieve this there would need to be some code so that when the AI tried to reach an incaccessible area, it could also consider going to a Sail-to-Europe plot to reach it.

    BTW what does Lib Spi't mean or stand for? Im intrigued :crazyeye::p
     
  13. Nightinggale

    Nightinggale Chieftain Supporter

    Joined:
    Feb 2, 2009
    Messages:
    3,986
    I wonder if the easiest approach to do this would be to change the terrain at certain trigger events. We can make the barrier 3 plots wide and demand 20 move for each plot if we want a 3 turn travel time.

    Maybe not precisely what you had in mind, but this approach would mean absolutely no AI code even though the AI can figure out how to use it.
     
  14. Lib.Spi't

    Lib.Spi't Overlord of the Wasteland

    Joined:
    Feb 12, 2009
    Messages:
    3,671
    Location:
    UK
    Yeah it wasn't an error, it was just that there are 2 buttons sometimes for some trade zones, usually when on the trade zone itself.

    Lib. Spi't is my 'Rap Artist' name it is short for Liberator Spirit, which is a sort of spiritual nickname I adopted as a christian in my late teens. The theory being that I would always look like the biggest twit in the room so everyone else would feel liberated to do whatever they felt like without feeling foolish, as they would have to work hard to catch up to me. :D

    Then it was also a kind of dual addition of Adlib (meaning to freestyle, or improvise, as I am also an actor) and then spit, like to spit bars on the mic.

    You can hear one of my tracks at monkeydocompany in my sig. go to monkeydomusic on my site. Produced with a couple of friends of mine. Also available as a digital download on the MonkeydoMusic Sampler for just £2. That works out cheaper than itunes people! (4 tracks)

    Shameless self promotion over....
     
  15. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    Ok, I made some head way today, rough headway, long way from done...

    I've added Buttons to EuropeInfos.xml so that you can by pass the whole hardcoded CommandInfos.xml system.

    Python will check to see if you are on a Europe space, then it will check if that unit "canCrossOcean" associated with that Europe tile, if it can it will display the new Button in your unit commands list.

    When you hit the Button it you set sail for that Trade Route Screen associated with that EuropeInfo. So far I have only tested the Spice Route.

    I need to add in "canAutoCrossOcean", so if it can not "canCrossOcean" it will check for AutoCross, that way you only have one button up at a time for each Trade Route.

    Also, I need to configure it so that Multiple Trade Routes can be used from the same Europe plot.

    Well, I am excited about the progress so far. It looks like we will have a fully customizable Trade Route system... given me enough time ;)
     
  16. Lib.Spi't

    Lib.Spi't Overlord of the Wasteland

    Joined:
    Feb 12, 2009
    Messages:
    3,671
    Location:
    UK
  17. Nightinggale

    Nightinggale Chieftain Supporter

    Joined:
    Feb 2, 2009
    Messages:
    3,986
    Sounds good. Speaking of moving hardcoded code to XML I have come up with a new idea. City types. Adding a new (small) XML with city types will completely remove the need to hardcode any behavior in the DLL. Professions will then not have bools to tell which type of city it founds. Instead it will have an int telling the index (aka the type from the new XML). This allows the DLL to work with any number of city types.

    The differences in behavior can then be options in XML. Buildings can have city type as requirements just like they have buildings as requirements now.

    One good part of this is that if behavior of city types is defined by a number of ints/bools, then different mods can set cities differently according to needs. For instance 2071 can set domain requirement to DOMAIN_WATER for water dwelling aliens and that type of city can then be built in water, but not on land. I can't imagine a useful usage for this feature in M:C meaning that one will then use DOMAIN_LAND (default value) for all city types.

    I will look closer at this at some point, but I need to finish one feature before I start on the next :)
     
  18. Trade Winds

    Trade Winds Chieftain

    Joined:
    Nov 21, 2013
    Messages:
    235
    From my point of view, if the final result is to do a whole world mod, it has no sense to have such trade routes similar to the fixed vanilla Europe screen.

    Trade should be only among cities, as it happened in history. If you have the key to the orient, civs should come to you to trade silk, until they discover your sources. This is what happened with the Arabs in the middle ages, or tobacco at the beginning of the American colonization.

    Then, as somebody said here, you may decide which city to open to the markets with special buildings or whatever.

    So if there is a time when nobody wants your cloth, produce new things or concentrate in the internal demand. Don&#8217;t just keep sending east loads of it.
     
  19. Nightinggale

    Nightinggale Chieftain Supporter

    Joined:
    Feb 2, 2009
    Messages:
    3,986
    The whole idea of moving the traderoutes to XML is to be able to adapt their behavior to fit any mod. If a mod is designed to be the entire world, then the XML file will be pretty empty, in which case the result will be what you write about.
     
  20. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    That sounds terrific!

    Well the final result of the Medieval Mod is not a whole world mod, but sense we are planning on using this mod for a launching pad for a whole world mod then we can be sure to make provisions for trading among cities. I already have new options in the EuropeInfos for trade routes that work from Foreign cities. That pretty much is what you are talking about, correct? You move your unit to a Foreign city, click the trade button and you are taken to that cities trade screen. We also need to add options for things like Civ specific Trade Routes. I think this was mentioned before and there will probably be XML load order issues that will arise on some options. I know you can "cheat" by counting off the Civ list and the just using an int instead of the Civ's XML name, then just setting the type in the DLL, but there is bound to be a more modder friendly way, ah Nightinggale?
     

Share This Page