How can I make a canal mod?

What do you think would work best)


  • Total voters
    3

Jonas Kerz

Chieftain
Joined
Jul 3, 2018
Messages
3
I would love to make a canal mod that lets you build a tile improvement or a district that changes a land tile to a water tile or both so that ships can sail across, but i have no idea how i should do this...
If it's a district it should function as sort of an aquaduct (no pop restrictions)
If it's a tile improvement a military engineer should build it instead of a builder.
Any ideas on how i could make this?
 
I'm afraid that you can't make something that allows naval units to move on land with the current tools.
 
This can be done via lua (ie, altering a land tile to a water tile) but this opens up and creates a whole list of potential issues. An incomplete list of these issues is:
  1. the tile graphics will not update until the game is saved and then reloaded. this has been an issue with changing a plot's base terrain since civ5
  2. modifier effects that used to be applied to the tile and should be removed (or that should be added to the tile now that it is a water tile) are not updated and reflected in tooltips and do not seem in many cases to be applied/unapplied until a save and reload of the game
  3. "continent" values may be adversely effected
  4. the game's "chokepoints" system must also be updated along with the change in the terrain in order to not cause CTD type issues.
  5. embarking / unembarking land units that may still be on the plot may be an issue once the terrain is swapped over to water, regardless of the update of the graphics mentioned earlier
  6. the AI still doesn't seem to understand canals anyway even when a city center plot creates a canal, so water units of AI probably still will not function in any proper way with regard to the "canal".
  7. Auto-pathing of units may or may not be affected. Sometimes the game seems to do a decent job of understanding how to make use of "lakes" but other times the auto-movement pathing (especially of trade units) seems bizarre relative to whether or not to embark across small portions of water.
-----------------------

And none of the above addresses the logic needed in the lua scripting nor the logic of determining whether a proper "trigger" has occured in-game to cause the lua script to implement.
 
the tile graphics will not update until the game is saved and then reloaded. this has been an issue with changing a plot's base terrain since civ5

Is there a way to reload the graphics? If I am not mistaken, the map is generated in Lua scripts, so maybe there is a workaround to reload the graphics without reloading the whole game. That would be nice.
 
The maps are generated before the graphics are loaded, the corresponding Lua files are loaded before the Lua script files and the Lua/XML UI files.
 
So, forgive me if this is a stupid question, but if a city center can act as a canal, why can't a district? I have been reading the code, and it looks like the city center is treated like a district (full disclosure, I am not yet a modder, not a coder/programmer, and while I passed my one semester of computer programming, I hated it and have never looked back). If so, then shouldn't there be a way to mod a district with the same parameters?
 
The short answer is "no"

The long answer is that there is nothing within the xml files that define DISTRICT_CITY_CENTER that actually appears to tie back to anything which allows that specific district to act as a canal, but every other district does not have, and which we can add to the definition of other districts. This "attribute" appears to "control" the behavior but also would be useless to assign to any other district:
Code:
CityCenter="true"
.

The special behavior of DISTRICT_CITY_CENTER is presumed to be coded at the DLL level, to which we currently have no access whatsoever -- we can actually only surmise that the "canal" effect of the City Center is coded within the DLL, but we cannot know for sure.
 
Back
Top Bottom