I think adding generic default traderoutes would be bad even if they can be turned off. Everything should be configurable in XML. Default trade routes could then be example code in a tutorial which people can copy paste to get say "Europe" or whatever. We shouldn't consider the case where people don't add trade routes in XML just like we don't consider the case where people makes no units available in XML.
Well, the thing is to get a functional trade route is a complicated procedure, at least for me. So complicated that I couldn't just sit down and make one from scratch and I am the one who designed it. So, the tutorial I plan on writing is for me as well as anyone else and the best way I can do this is to simply create a new moddable working trade route and take notes on every step. So, as of now I plan at add at least one generic trade route to M:C, this will also help me test things to make sure I leave nothing out of the tutorial.
I agree with Nightingale it would be best for modding if instead of a fixed set of M:C-specific trade routes like Spice Route and adding several more default ones, it could be moddable in a totally standard way with XML so modders could make & configure as they want.
This is the plan. When I said generic trade routes I meant I would add a couple trade routes that players could mod to their hearts content. Right now their are basically 3 trade routes, if I added one or two more they will all be completely modifiable and not fixed.
Code:
<UnitClassTradables>
<UnitClassTradable>
<UnitClass>UNITCLASS_DHOW</UnitClass>
<iPricePercent>-20</iPricePercent>
<bCanBuy>1</bCanBuy>
<bCanSell>1</bCanSell>
</UnitClassTradable>
</UnitClassTradables>
The above code is already in the game. It is listed under Civ4UnitInfos.xml. The Coastal Merchant code below is an example. iEuropeCost is still used by the AI as they only use the default Europe Screen atm. If TradeScreenType price is not set then that unit is not sold on that trade route. Also, when I make it moddable the Europe Screen will be accessible through XML changes.
Code:
<iEuropeCost>1000</iEuropeCost>
<TradeScreenTypes>
<TradeScreenType>
<TradeScreen>TRADE_SCREEN_SPICE_ROUTE</TradeScreen>
<iPricePercent>800</iPricePercent>
</TradeScreenType>
</TradeScreenTypes>
The existing Civ4EuropeInfos.xml could get a few new tags to allow modding of how Europe plots link to trade screens. E.g.:
Code:
<DiscoverTech>TECH_COMPASS</DiscoverTech>
<RouteType>WATER</RouteType>
<TradeScreens>
<TradeScreen>
<TradeScreenType>TRADESCREEN_SPICEROUTE</TradeScreenType>
<bAccess>1</bAccess>
</TradeScreen>
<TradeScreen>
<TradeScreenType>TRADESCREEN_THEORIENT</TradeScreenType>
<bAccess>1</bAccess>
</TradeScreen>
</TradeScreens>
Like Nightinggale mentioned because of the xml order New Trade Route Techs will have to be assigned in the Civics.xml. TradeScreens are already in the EuropeInfos, see the below code. Also, land routes are made when you set iMinLandDistance to 0.
Code:
<iMinLandDistance>4</iMinLandDistance>
<iWidthPercent>20</iWidthPercent>
<TradeScreenTypes>
<TradeScreenType>
<TradeScreen>TRADE_SCREEN_SPICE_ROUTE</TradeScreen>
<bValue>1</bValue>
</TradeScreenType>
</TradeScreenTypes>
I don't think Civ4EuropeInfos.xml should contain <DiscoverTech>. An XML can only refer to xml files already read when they are read and if I recall correctly Civ4EuropeInfos.xml is read before the inventions. This mean the invention has to tell which "Europe" it unlocks.
This situation has caused me all kinds of wasted hours and hair, trying to get the code to read XML values that were not assigned yet. Took me great pains to finally figure this out.
Like:
Revealing Trade Areas with 'trade levels' or techs (Maybe even removing a trade screen too (if possible) so that you can 'obselete' a zone)
Different Zone Prices and Availabilities (like Silk and Spice being different values, or Plate Armour Not being available everywhere)
Accessing a zone from a town or building or land plot or sea plot or both (which I think I have already been shown)
etc.
Revealing trade routes is already part of the game just needs to be moddable. Different Zone Prices and Availabilities are already in the mod. The below code is for Mail Armor. iPricePercent modifies the price default price by that much. A -1 here disallows that Yield from being bought there.
Code:
<TradeScreenTypes>
<TradeScreenType>
<TradeScreen>TRADE_SCREEN_SPICE_ROUTE</TradeScreen>
<iPricePercent>150</iPricePercent>
</TradeScreenType>
<TradeScreenType>
<TradeScreen>TRADE_SCREEN_SILK_ROAD</TradeScreen>
<iPricePercent>175</iPricePercent>
</TradeScreenType>
</TradeScreenTypes>
Where a Trade Route is accessed will be fully moddable. I'll have options for:
Land
Sea
Any City,
Barbarian City
Foreign City
Owned Cities,
Or Cities with certain buildings
Both land and or sea is a good option also.
It's also better if it doesn't require dll modifications, as this can cause complications (like incompatible project versions) but it is not necessarily the end of the world. (As long as I am shown what needs to change)
As of now I don't see an easy way to do this without dll modifications unless I go ahead and add generic trade routes that are completely modiable. There is just so much code that goes into a trade route. Like new commands and also new automated commands so that units will "travel" to a trade route destination and the only way to add new commands is in the dll. So with my generic trade routes the commands will be there already and all you do is mod them or turn them on or off.