Maniac
Apolyton Sage
I'd like to try to add cliffs to Civ4 for Planetfall.
One way to create cliffs is recycling the Peak plottype, make them passable, workable etc.
The movement rules would be: you can't move from a cliff straight into flatland or water plots, and you can't move straight from water or flatlands into cliffs. But you can cross into a cliff from a hills plot, and vice versa.
The idea is to create easily defendable highland plateaus, bordered all round by cliffs, with only a handful 'ramps'/hills. Using unmodded completely impassable/unworkable Peaks as borders has as consequence the plateaus become too small, thus leaving too little actually worth defending...
As a test I tried this simple way of coding it into the DLL:
It works just fine. You can't eg move from a flatlands to a peak in an adjacent plot.
However there's a big problem.
You are neither able to move directly from a flatland to a peak/cliff two tiles away, even if there's a hill in between. You need to first move to the hills, and only then you can proceed to the peak. This is very annoying for the human players, but no doubt disastrous for the AI: they would only be able to move from flatland to cliffs by pure luck.
So therefore I'm wondering, does anyone have any idea if and how it's possible to modify the pathfinder, so that it can plot paths between flatland/water and cliffs, using hills?
One way to create cliffs is recycling the Peak plottype, make them passable, workable etc.
The movement rules would be: you can't move from a cliff straight into flatland or water plots, and you can't move straight from water or flatlands into cliffs. But you can cross into a cliff from a hills plot, and vice versa.
The idea is to create easily defendable highland plateaus, bordered all round by cliffs, with only a handful 'ramps'/hills. Using unmodded completely impassable/unworkable Peaks as borders has as consequence the plateaus become too small, thus leaving too little actually worth defending...
As a test I tried this simple way of coding it into the DLL:
Code:
bool CvUnit::canMoveInto(const CvPlot* pPlot, bool bAttack, bool bDeclareWar, bool bIgnoreLoad) const
{
...
if (plot()->isPeak())
{
if ((pPlot->isWater()) || (pPlot->isFlatlands()))
{
return false;
}
}
if ((plot()->isWater()) || (plot()->isFlatlands()))
{
if (pPlot->isPeak())
{
return false;
}
}
It works just fine. You can't eg move from a flatlands to a peak in an adjacent plot.
However there's a big problem.
You are neither able to move directly from a flatland to a peak/cliff two tiles away, even if there's a hill in between. You need to first move to the hills, and only then you can proceed to the peak. This is very annoying for the human players, but no doubt disastrous for the AI: they would only be able to move from flatland to cliffs by pure luck.
So therefore I'm wondering, does anyone have any idea if and how it's possible to modify the pathfinder, so that it can plot paths between flatland/water and cliffs, using hills?