Tunneling..

Snerk

Smeghead
Joined
Jan 16, 2006
Messages
8,234
Location
Norway. You'll never leave
Perhaps this has been suggested before but if not then its weird nobody has thought of it. The idea is to allow the building tunnels through mountains, and therfore allow road or railroad to go through mointains. It probably wount change the gameplay much but it could perhaps prove usefull at sertain times. Im no modder so i cant make such an addition to the game but it can be an idea for other modders.

Another idea is to allow the makings of canals, however i've seen that suggested before...
 
sweetpete, tunnelling has been on my todo list for a while... I think I know how to do it as well. I just haven't had time to implement it.
 
Make peaks a land terrain, but make them off limits to all units except workers and unimprovable. Routes are not improvements, I believe. Workers would be able to build roads on peaks, and little else, but I believe the roads would pretty much function as tunnels, though they wouldn't look like anything but a road probably.

I know in civ3 you could make terrain impassable to units, but they could traverse it if there was a road.

PS.
Apparantly that doesn't work in civ 4. I can make peaks land and terrainimpassabl (in unitsinfo) to all units but workers and workers still can't go there unless I give them the power to pass impassable terrain, and then they can build roads that other units can't use because apparantly roads don't make terrain passable. Its like you only see the tip of the iceberg. Even hills are defined as water domain in terrain infos, I guess the base terrain is what counts.
 
TheLopez said:
sweetpete, tunnelling has been on my todo list for a while... I think I know how to do it as well. I just haven't had time to implement it.

Is it in python?
If so I will do it for you as I have nothing to do this week and need to keep my python skills brushed up.
 
Lord Olleus said:
Is it in python?
If so I will do it for you as I have nothing to do this week and need to keep my python skills brushed up.

No, it's not just in python, it would take very minimal C++ programming. Basically in the python API there is a method in the CyPlot class called isImpassable. What you would need to do in the SDK is add a new boolean flag called m_bHasTunnel in the CvPlot class and create the infrastructure around it to get/set it through python. After you do that then you would need to update the isImpassable method in the CvPlot class to be:
Code:
bool CvPlot::isImpassable() const
{
	if (isPeak())
	{
		if(m_bHasTunnel)
		{
			return false;
		}
		return true;
	}

	if (getTerrainType() == NO_TERRAIN)
	{
		return false;
	}

	return ((getFeatureType() == NO_FEATURE) ? GC.getTerrainInfo(getTerrainType()).isImpassable() : GC.getFeatureInfo(getFeatureType()).isImpassable());
}

After you do all that the rest is trivial: add a new improvement graphic for the tunnel, update the worker so they can build tunnels, add a new technology enabling the usage of the tunnel action by workers, etc. I am willing to do the SDK programming today and make it available if you can do the python, get the images, etc. How does that sound to you?


EDIT: A suggestion you might want to add a new road type if you want called tunnel but I'll leave that part of the mod to you.
 
Could the same think be done to build underwater tunnels? Just create a new (and expensive) unit and have it build tunnels on the sea.

Oh, and what about the AI?
 
Lord Olleus said:
Could the same think be done to build underwater tunnels? Just create a new (and expensive) unit and have it build tunnels on the sea.
I don't see why not, I would just need to tweak the isImpassable method to return false if the target plot is water and has a tunnel.

Lord Olleus said:
Oh, and what about the AI?
I'll leave that up to you... but it might require some more SDK code.
 
Getting the AI to actually build the tunnels will be the hard bit - it should use them naturally. You'd have to weight the neccessity of building a tunnel against other things such as building farms or mines. Not easy.

Sea tunnels sound cool - though unit-ship combat might get a bit weird.

Good luck!
 
The Great Apple said:
Getting the AI to actually build the tunnels will be the hard bit - it should use them naturally. You'd have to weight the neccessity of building a tunnel against other things such as building farms or mines. Not easy.
I agree

The Great Apple said:
Sea tunnels sound cool - though unit-ship combat might get a bit weird.

Good luck!

Well, its an easy check, if a land unit is on a plot with tunnels and the plot is a water plot then don't allow combat with sea units.
 
Or the land unit automaticaly dies if a ship moves on top of it.
That will make keeping a navy important!
 
I think I agree with Olleus - the tunnel would be unlikely to be built under the surface if it was any length, rather placed on top of it. They would be very vulvernable to navies.
 
Getting the Ai to build them will be very hard though.

Mountain tunnels should be rather easy. Set it a low priority (same as roads not going to cities or resources) and let the workers build it. Sea tunnels would be harded.

Should tunnels only be usable if they are in your cultural borders? Seems wierd for enemy troops to be able to use them?
 
Having tunnels isn't such a bad idea at all. ;)

LOL at TheLopez's sig... (you know your sig is too big when...) :p

No wonder you don't have time to make stuff... you're always err... making stuff. :p
 
The terraforming mod allows building of roads on mountains. It then turns them into a new terrain that looks about the same, but a little falttened, and units are able to move across them.

Roger Bacon
 
Tunnels to make mountains traversable is a good idea, but what i would like to see is huge tunnel systems throughout an empire allowing it to deliver troops to the edges of its borders. Imagine, an enemy pushes through your extensive territory and after destroying their way to the capital they find themselves ambushed from behind. Or they blockade a city and troops still can get in or out. Not historically accurate on the scale i am talking about (how big is a civ square) but i like th idea.

They cut the roads and you still move quite freely.
 
not very realistic though ?

besides, if you have covered all of you tiles with roads, then you can just take an alternative route.
 
Top Bottom