Jun 8, 2012
Hello everybody !

I create this thread (hope it's the good place) in order to keep track of the progress of a modpack I'm creating, as well as to ask help, feedbacks, advices, etc.

Who is this dude anyway ?

To start off, I'm a junior game designer, just graduated from my school (in France), and I also hold a degree in computer sciences (but it's not my main qualification). So I can program in almost every language, I just need to learn it (btw, I never learned Lua, but it doesn't seem that difficult). I did not to make any mod for civ up until now.
I have played Civilization back from Civ II ; Civ IV and V being the ones I played the most. I currently doesn't have Civ VI (waiting for all the expansions to be released)

What is the project ?

So, this project is a set of mods each focused on different aspects of Civ V, ranging from small modifications to brand new features (hoping it's doable). I plan to release them separately in order to let players choose to which extent they want to change their experiences.
Since there will also be some utilities mods, they will also be released separately

Features :
(features are listed in the order I plan to work on them)

  • Trade Area Overlay [utility] : show the area in which a caravan/cargo ship can trade, as with City Limits Mod
  • Religion overlay [utility] : I liked the religion overlay that was in Civ IV, and I always felt sad that it wasn't in Civ V (btw, I like overlays)
  • Trading system modifications [modifications] : I wanted to make trade roads have more interactions with the environment, like when it goes throught another city (not the target one), a trading post, kasbah or feitoria. I'm not sure, but I also have the impression that the road between 2 cities is not always the fastest but rather seems to be the shortest, maybe change something in that, or maybe not.
  • Civilization Tradition [new feature] : this one is something completely new. It would be for a civilization, upon changing of era, to earn a small scientific bonus when searching a tech of the same category that the one that was the most searched in the preceding era.
    With an exemple, let's say that Babylonians, when they go to classical era, have discovered Archery, The Wheel, Bronze Working, Animal Husbandry, Mining & Pottery. Three of them are associated with Offense
    (should be looking into tech flavors to be sure everything is correct, but that's an example, so as long as you see the point, it's ok), making it the most researched flavor of the Ancient Era for them. Thus, for all technologies of the next eras, they will have a small science bonus when searching Offense-flavored techs. This bonus will probably be cumulative (2 Offense eras double the bonus, etc.) with either a reset when going from Medieval Era to Renaissance or something else.
  • Religious schisms & victory [new feature] : well, self-explanatory. Allow upon certains conditions for a religion to schism form the original one. These conditions could be something like : having this religion has the main one in your empire and outclass the original religion civiliaztion in one of the victory types. This would cost more faith that simply founding a new religion, and some beliefs could be changed (namely, Pantheon, Founder & 1st follower would stay the same, but 2nd follower, Enhancer & Reformation could be changed for beliefs that wasn't choosed or for beliefs of another religion also present in the schism city). I think there is already a mod with religious victory, so maybe I will not do it.
  • Culture (as in social or ethnic culture, maybe ethnic groups should be more proper) [new feature] : remember that small jauge in the bottom left corner of the city view in Civ IV, the city nationality ? I think we can do something good with this feature, especially with BNW and the ideologies. In my opinion, it's the most complex one, so I will not detail it now, but in a nutshell, there should be something with cities that are too far away from capital or having their own cultural center starting to feel less and less like the home civilization, and cities close to a cultural center of another civ feeling more & more like that other civ. Have something to do with tourism, domination, and religion also.

Well, that's it for now. I hope I don't have any new ideas during the development (but I think that's a lost cause, at least, hope they will not be interesting/doable).
New content (civ/leader/buildings/techs/wonders/etc.) is also planned, but I don't think that adding content is the more interesting thing, so it is delayed to " one day, maybe " .

Of course, any help is appreciated, I don't think I will be doing all of this alone ^^'


Current progess
Trading area visualizer

Okay, so, as I said, I'm starting by the trading area overlay. I based my script on the City Limit mod (I love this one) . The script is rather simple : show the boundaries of the area in which the caravan/cargo ship can trade. What is really difficult is to compute that area, taking into account tiles that cannot be crossed & roads that split the MC by 2. But for now, I will just show the boundaries of an area of 10 tiles (base trade area) around a caravan if it is hovered or selected and on a city tile. Computing will come later.
Ok. That didn't went so well. Mod doesn't seem to change anything, and FireTuner didn't log anything, despite my script being full of logger:info, trace or print. Thus, my mod doesn't even seem to have been loaded even though it appears in the mod screen.

I have to investigate that. I will come back once I found why. If you have any idea, feel free to share ;)

Feel free to say anything you want, be it positive or negative feedback.

Thanks for reading,
Last edited:
See whoward69's what ModBuddy setting for what file types tutorial
Sounds like you don't have a correct set-up for your UI overlay file(s)

Also, for international trade routes you can find the possible target cities via
	local potentialTradeSpots = pPlayer:GetPotentialInternationalTradeRouteDestinations(pUnit);
	for i,v in ipairs(potentialTradeSpots) do
		local tradeRoute = {
			PlotX = v.X,
			PlotY = v.Y,
			TradeConnectionType = v.TradeConnectionType
You first need a player object variable (ie, pPlayer in the quoted code) and a unit object for the caravan or cargo ship (ie, pUnit). The snippet of code is taken from the base game file ChooseInternationalTradeRoutePopup.lua from folder C:\Program Files (x86)\Steam\SteamApps\common\Sid Meier's Civilization V\assets\DLC\Expansion2\UI\InGame\Popups

The lua table of possible target cities gives the XY grid location of the possible target. I don't remember whether the GetPotentialInternationalTradeRouteDestinations() method also includes internal food and production trade routes as well.
Oh, thanks. Now I have something. It's a syntax error, but at least it's something the FireTuner is telling me ^^
Ok, that's it. Now it works. So now I have to compute the actual trade area. I keep in mind what you've shown, LeeS, but I think of something more like the unit overlay showing area around units in which they can navigate within 1 turn. Since essentially, the tradable area of a caravan (I'll see later for cargo ships) is the set of tiles that are within an area of 10-turns movements starting from the city in which the caravan is, I'm more looking into something that could compute this kind of area.

For now, I'm looking at the Civ V source code and API, since doing my own algorithm would be very time-consuming (and well, reinventing the square wheel). I've already seen something in the API & source code called Area, but that doesn't seem to match what I'm looking for. A really bad way of doing this (in my opinion) would be with several Unit:generatePath calls (checking for all tiles within an area if they are at max.10 turn distance) but I think it would work. There is also this CivAStar thing in the code source that seems to revolve around pathfinding. Maybe it's a better (if not the best) way of doing this.

I've yet to read all the API/documentation, so maybe there is a really faster/simpler way of compute that 10-turns movements area, but it's kind of hard to be sure to understand correctly how each method works without any actual explanations in the documentation ^^'.
Area:Something() are methods on a map's areas. A plot is always assigned to an Area.

The Areas on a map are the land-masses, individual seas, and individual lakes present on the map. Each is assigned its own Area ID. A one-tile island, for example, is its own "Area". A three-hundred tile continent is its own "Area" except for the lakes within that continent. The lakes would each be assigned an individual a discreet Area ID distinct from that of the contintent in which they are located.

So the Area methods available through lua probably would not help a great deal in what you are attempting.

However, Map.PlotDistance(Plot1GridX, Plot1GridY, Plot2GridX, Plot2GridY) may be of some value. From William Howard's data-dump of lua methods presented as XML text:
  <api object="Map" method="PlotDistance" static="true">
      <arg pos="1" type="int" name="iX1"/>
      <arg pos="2" type="int" name="iY1"/>
      <arg pos="3" type="int" name="iX2"/>
      <arg pos="4" type="int" name="iY2"/>
      <ret type="int"/>
The 'return' from running this method is specified as "int" which means you get an integer value.

This might also be useful:
  <api object="Map" method="PlotXYWithRangeCheck" static="true">
      <arg pos="1" type="int" name="iX"/>
      <arg pos="2" type="int" name="iY"/>
      <arg pos="3" type="int" name="iDeltaHexX"/>
      <arg pos="4" type="int" name="iDeltaHexY"/>
      <arg pos="5" type="int" name="iRange"/>
      <ret type="Plot"/>
It returns a plot object for the desgnated plot if the plot is within the specified distance "iRange". "iX" and "iY" are the gird XY positions of the starting plot (ie, the plot the caravan is located on), and as I recall the "iDeltaHexX" and "iDeltaHexY" is a distance/direction in the grid X/Y coordinates for X and Y directions so as I recall a negative value for "iDeltaHexX" would be for finding a plot in the negative direction on the map from the original plot.
Last edited:
I'm already using Map.PlotDistance(), but it doesn't take MP into account. It just returns the distance between 2 tiles. It's already a good approximate, but I'll try to do something more precise.
As fot Map.PlotXYWithRangeCheck(), I may be using it the wrong way since it returns nothing. I have to do some more test on this one.

Merry Christmas to everybody !
Thanks to a StackOverflow user who gave me an algorithm, the script now works !
Now it's time to do some improvements before I can release it.
What's left to do :
  • Add cargo ship (currently the mod only works with caravans)
  • Take different multipliers into account (like policies, techs & other bonus)
  • Add a 2nd overlay, showing the maximum area (simulation with all the techs boosting trade range researched) - most likely on v2
I wanted to post an image of what it looks like, but Steam doesn't want to take screenshots :/

Merry Christmas to all ^^
Last edited:
Hello !

Sadly, today is not a post showing progression for the mod or announcing a release; it rather a shift in the current task. While working on the religious overlay mod, I found this one from WHoward and called Religion Spread ( Spread.html), that I can't seem to find on Steam, but that actually performs almost evrything I wanted to do in terms of functionalities.
I wonder if it is possible to tweak the Strategic Active Interface in order to add a new option for religious spread (instead of having it on a minimap like view in the religious overview popup as in WHoward mod) with a popup to choose displayed religion as in Civ IV, but it is not my main concern currently. I prefer to go straight to the next mod, that is to say, the modifications on trade route system mod.

I'm incredibly bad at looking for things, so it might (more probably will) take a while before I simply figure out where or how to change this.
Next time I will show more progression or ask for help ^^
Top Bottom