[SDK/XML] Canals Mod Component

[BTS] Canals Mod Component 1.0

topsecret

Believer
Supporter
Joined
Feb 11, 2010
Messages
5,946
Location
At the Foot of the Cross
This SDK Mod Component adds a new <bCanal> tag to the TerrainInfos file, allowing you to create land terrains that allow ships to pass through (but not stop).

Spoiler Images :






You must set <bCanal> to 1 and leave <bWater> at 0. This will allow land units to step on the space and water units to pass through the space.
Effects of <bCanal> tag:
1. Ships may pass through, but not stop on, the space.
2. Ships may not enter the space if an enemy unit is on the space.
3. Only roads may be built on the space; all other improvements are blocked in the DLL. (Please notify me if you want a modified version with that feature removed.)
4. If a ship attacks across the space and withdraws into the <bCanal> space, it will be moved on the next turn.

Changed files included.
 
Last edited:
how do I install this?
Download it, unZIP it, and put the "Canals" in your Mods folder under Beyond the Sword/Mods.

If you need more help, let me know.
The terrain is not added automatically. It has to be added in WB.
 
Oh, this is really cool. I've been thinking about the opposite of this (a strait terrain that land units can traverse but not stop on), so I'm curious about your implementation.
 
Oh, this is really cool. I've been thinking about the opposite of this (a strait terrain that land units can traverse but not stop on), so I'm curious about your implementation.
Well, I am really new to DLL modding, but basically in CvUnit.cpp, under CvUnit::canMoveInto, I changed the check for water tiles. Instead of check for water tiles first, it checks to see if the tile is a <bCanal> space and if it does not have enemy units on it.

However, it apparently takes all the ships movement except one to cross a canal. I am not sure exactly what is causing it because this isn't coded extremely elegantly. It's my first real SDK mod, so it works for now until I learn how to get it to do what I want. :)

All the source code is in there if you want to take a look. Just search for "Canal"
 
Alright, I was always wondering how easy it would be to make a unit be able to pass through a tile but not allow it to finish the turn there.
 
Alright, I was always wondering how easy it would be to make a unit be able to pass through a tile but not allow it to finish the turn there.
I think it would be possible, but I don't think it would work with units that only move one. :dunno:

Mine is sort of a "hack". It skips the check for invalid plots and tells the unit to move through anyway. The reason I made it land is because all ships move at least two in my mod.
 
This is a fantastic idea, I think it opens a lot of possibilities.

I merged this in my MOD last night and it was pretty straightforward, I started adapting mapscripts to you use it as well.
Ultimately I would like to adapt Wheel to have (an option) for spoke as Marsh (I took the graphics of the Colonization terrain). I'll post here if interested.

One thing I notice though : when the spokes are more than 1 tile, it doesn't behave like I thought it would.
Actually crossing the canal consume all movement point and leaves you only with 1 movement to go; I don't see anything in your code relating to this.
This I think we could change too because it makes it impossible to cross a 2 tiles wide band of CanalLand/Ford/Marsh. The pathfinder doesn't get it and let you arrive on the second canal tile. Then beginning of the turn ejects you on a nearby tile.

Any idea how to amend this?

Thanks again!
 
This is a fantastic idea, I think it opens a lot of possibilities.

I merged this in my MOD last night and it was pretty straightforward, I started adapting mapscripts to you use it as well.
Ultimately I would like to adapt Wheel to have (an option) for spoke as Marsh (I took the graphics of the Colonization terrain). I'll post here if interested.

One thing I notice though : when the spokes are more than 1 tile, it doesn't behave like I thought it would.
Actually crossing the canal consume all movement point and leaves you only with 1 movement to go; I don't see anything in your code relating to this.
This I think we could change too because it makes it impossible to cross a 2 tiles wide band of CanalLand/Ford/Marsh. The pathfinder doesn't get it and let you arrive on the second canal tile. Then beginning of the turn ejects you on a nearby tile.

Any idea how to amend this?

Thanks again!
I don't know how to fix it yet because this is my first real component. I made a minor change in movement. I would have to look at code but I need to graduate in May before I have time. :lol:
 
With such a feature/improvement, we do not need Forts as canals anymore. But is there a way to limit the Forts, so ships can't use those as "canals" (or ports for that matter)?
 
I admit I knew about that flag - but I'm afraid turning this off.

The AI is using Forts to get access to ressources outside their city worktiles, but tiles still within their culture-range.


Anyway - I still like this new feature. It surely would look better on a map than using 1 or 2 forts as a canal as we do now. And with some (more) graphic works, it would be perfect.
 
Top Bottom