Do we have --Canals-- yet?

Cannot we "simply" add the fort script to it? Or the relative code/hack/whatever?

It should act like a fort, but the improvement will be built like a path: each tile will have it.

Is it possible? In fact, it is kinda build an automated line of fake-forts improvements who display as water...
 
Cannot we "simply" add the fort script to it? Or the relative code/hack/whatever?

It should act like a fort, but the improvement will be built like a path: each tile will have it.

Is it possible? In fact, it is kinda build an automated line of fake-forts improvements who display as water...

Yes, you can make the route act as if it was a fort in the DLL, but it'll still have the problems associated with fake forts, and more - routes connect with each other, so that your "canal" route will connect to nearby roads/railroads, rather than going straight.

But really, if you just want a buildable canal that doesn't have to be accessible by everyone, then you can use the current fort mechanics already - just take away the defense bonus and use a different graphic - they're buildable and work like canals.
 
I experimented with strait/canal tiles that would allow maps like in Civ2. It worked, but created a number of side effects that I wasn't able to fix (I didn't spend much time on it though, so I think it's still possible). Basically I added a new strait tile that looked like raised water and allowed both land and sea units to pass through, allowing Gibraltar, Bosporus etc. to work like in Civ2. If the tile was converted to land it would work like Suez etc.

So you totally gave up on this?
It would be awesome in SoI, especially near Suez
 
So you totally gave up on this?
It would be awesome in SoI, especially near Suez

I have no use for this in SoI - the old Suez-like canal ceased to exist exactly when the mod starts, and didn't really reopen until 19th century. I actually offered this to RFCE team but no one was interested. In my test setup it allowed land and naval passage through Gibraltar, Oresund and Bosporus straits, linking Spain-Africa, Denmark-Sweden and Black-Aegean Seas. I might go back to it for a Sengoku mod, just figured I could properly link Kyushu and Shikoku to the mainland, if side-effects are fixed that is.
 
Wait a moment... you DID succeed to make working Canals?!? :eek:

wth don't you told us before? :rolleyes:

anyway :goodjob:


Is it possible to add it to entire game and not only in a single mod?

Thanks.
 
In the very first post I said I did and how (CvPlot::isFriendlyCity), but there are rather critical side-effects, like land units being able to enter water though the shared tile.

That was what I meant. ;)

Then just use fort with different name, graphics and stats. No special modding required. EDIT: multiple forts don't work.
 
Well, it appears I got it with another, very simple solution, but it only works for geographical diagonal straits & isthmuses, not buildable canals, so 4lexander won't be happy ;) Works for me though, as it can be used for everything I've listed before: Danish straits, Gibraltar, proper Bosporus, Japanese Inland sea straits.

1. all naval units should have bCanMoveAllTerrain set to 1
2. CvUnit::canMoveInto, below "case DOMAIN_SEA", the line:
Code:
if (!pPlot->isWater() && !canMoveAllTerrain())
has to be changed to:
Code:
if (!pPlot->isWater())

This allows naval units to move diagonally between land tiles like in Civ2, with no pathfinding issues that appear with other solutions (i.e. I noticed you can do this in HotK, but pathfinding doesn't work unless done from adjacent tile, which doesn't allow the AI to move properly).
 

Attachments

  • diagonal-straits.jpg
    diagonal-straits.jpg
    78.3 KB · Views: 680
OMG, this is pretty incredible! :eek2:
 
First of all, my very compliments for your :goodjob:

Second, as long as this thread is about Canals and not only straits, I cannot be satisfied :D

But it IS an excellent achievement Anyway.


I find not technically correct that a ship can move on a land tile though, as shown in shots in which a land unit can.

Is it possible to alter graphic properly so long that a diagonal land tile (resulting by the meeting of two lands surrounded by water) appears more close to a strait? i.e. with water?

Also land units aren't supposed to cross this way. I think there would a good reason for them crossing and ships not.
 
I find not technically correct that a ship can move on a land tile though, as shown in shots in which a land unit can.

Also land units aren't supposed to cross this way. I think there would a good reason for them crossing and ships not.

On the contrary, it's technically/historically correct for both land and naval units to cross this way. You don't need a fleet of galleons to cross the Bosporus, Oresund or Kanmon - they are like rivers, being between 1 and 4 km wide. Previously operated by ferries, they have normal bridges now. Case in point: historical games like Total War and Europa Universalis series allow both land and naval passage between the narrow straits I mentioned.

Also, it greatly helps the AI to be able to move land units with ferries, without preparing a silly naval invasion to cross a strait 1km wide.

Is it possible to alter graphic properly so long that a diagonal land tile (resulting by the meeting of two lands surrounded by water) appears more close to a strait? i.e. with water?

I'm not sure. I was able to alter the height map so that it looks like a strait, but I don't know how to fill it with water yet.
 
I have to say that I agree with embryodead on everything. Here's hoping that he can take this thing to the next level...
 
I also think he's our best hope to have this feature ingame :thumbsup:

Thanks for the pointing out.

About the graphic issue it is not essential but whenever it would be possible it would be great.
 
I have no use for this in SoI - the old Suez-like canal ceased to exist exactly when the mod starts, and didn't really reopen until 19th century. I actually offered this to RFCE team but no one was interested. In my test setup it allowed land and naval passage through Gibraltar, Oresund and Bosporus straits, linking Spain-Africa, Denmark-Sweden and Black-Aegean Seas. I might go back to it for a Sengoku mod, just figured I could properly link Kyushu and Shikoku to the mainland, if side-effects are fixed that is.

Oh, I must somehow missed when you offered your help in this previously.
Actually I'm part of the current RFCE team, and I'm most certainly interested in this...
I'm not so sure about Gibraltar, it's a little wider than the other 2, but those are very much needed
 
Well, it appears I got it with another, very simple solution, but it only works for geographical diagonal straits & isthmuses, not buildable canals, so 4lexander won't be happy ;) Works for me though, as it can be used for everything I've listed before: Danish straits, Gibraltar, proper Bosporus, Japanese Inland sea straits.

1. all naval units should have bCanMoveAllTerrain set to 1
2. CvUnit::canMoveInto, below "case DOMAIN_SEA", the line:
Code:
if (!pPlot->isWater() && !canMoveAllTerrain())
has to be changed to:
Code:
if (!pPlot->isWater())

This allows naval units to move diagonally between land tiles like in Civ2, with no pathfinding issues that appear with other solutions (i.e. I noticed you can do this in HotK, but pathfinding doesn't work unless done from adjacent tile, which doesn't allow the AI to move properly).

This is great, thanks for working on this! :goodjob:
But this means, that all diagonally connected land tiles will be passable for naval units?
If so, that could be a problem in some parts of the map...
 
On the contrary, it's technically/historically correct for both land and naval units to cross this way. You don't need a fleet of galleons to cross the Bosporus, Oresund or Kanmon - they are like rivers, being between 1 and 4 km wide. Previously operated by ferries, they have normal bridges now. Case in point: historical games like Total War and Europa Universalis series allow both land and naval passage between the narrow straits I mentioned.

Also, it greatly helps the AI to be able to move land units with ferries, without preparing a silly naval invasion to cross a strait 1km wide.

I also agree with everything you said.
And you can add up the Dardanelles to your list ;)
Gibraltar: 14 km
Oresund: 4 km
Bosporus: 1 km
Dardanelles: 1 km
 
So, can this be coded to work only for a few specific spots?
In RFCE we have plenty of diagonial sea tiles, but just a few of them are straits.
I want naval units to be able to cross diagonally over land tiles only in the Oresund, Bosporus and Dardanelles
 
So, can this be coded to work only for a few specific spots?
Well, of course it can. :) Its just a matter of writing the code, testing it and debugging it. And writing the code is probably the easy part. :D

I guess it would be possible to create an entirely new Python callback for this new map feature. Like canPassDiagonal - then its just a matter of making the CvGameUtils.canPassDiagonal() method return a True value whenever the path-finding mechanism encounters one of the few selected spots for the map/scenario. It would slow the game down, however, as this callback would be done very, very often. :p

This sort of setup would make it easy enough to implement this in any mod that ships with a specific scenario. You just need to merge the SDK bits and pieces into your mods custom DLL file. The actual definitions (from-to what plots) would then be put into the CvGameUtils.py file, which is readily editable.
 
Well, of course it can. :) Its just a matter of writing the code, testing it and debugging it. And writing the code is probably the easy part. :D

I guess it would be possible to create an entirely new Python callback for this new map feature. Like canPassDiagonal - then its just a matter of making the CvGameUtils.canPassDiagonal() method return a True value whenever the path-finding mechanism encounters one of the few selected spots for the map/scenario. It would slow the game down, however, as this callback would be done very, very often. :p

This sort of setup would make it easy enough to implement this in any mod that ships with a specific scenario. You just need to merge the SDK bits and pieces into your mods custom DLL file. The actual definitions (from-to what plots) would then be put into the CvGameUtils.py file, which is readily editable.

These kinds of things are really done in the SDK for a reason, but the main problem is that you can't do that even in the SDK, at least not with this hack. Pathfinding is in the executable, so we have no direct control over it. There's no check whether a unit can move diagonally or not with my method. Modifying SDK functions that check specific plots or terrains doesn't work properly because the pathfinding engine ignores them. There's already unitCannotMoveInto python callback that you can play with, but from my experience, canMoveInto only works for allowing/disabling movement to specific plots, not pathfinding.

The hack only does two things:
1. it lets naval units enter all terrain through canMoveAllTerrain (XML)
2. it disables canMoveAllTerrain for naval units in the SDK, duh

Since 2. disables 1. nothing changes in terms of units' ability to enter different plots, except that the pathfinding engine now treats naval units like helicopters.

AbsintheRed said:
So, can this be coded to work only for a few specific spots?
In RFCE we have plenty of diagonial sea tiles, but just a few of them are straits.

Like I said I don't I see no way to properly turn this on/off for specific spots. It's all up to you but I've looked at RFCE map and there only a dozen or so diagonal links that are either correct or easily fixed:
- islands in the Atlantic, above Scotland and Rhodes - actually correct, since they're groups of islands
- tip of Greece below Athens - that plot can be removed or left as is since at this scale it doesn't even resemble Greece and you can't tell whether it's one of the islands there or a peninsula
- tip of Visby, tip of Cyprus - easily fixed with +1 land plot
- two peninsulas in Southern Italy - as above + you can link Sicily to mainland too, adding another strait
- lakes/lagoons in croatia can be entered from sea - for lagoons it's actually good, not so much for lakes though they can be moved
 
Back
Top Bottom