settlers scared by ocean animals

davidlallen

Deity
Joined
Apr 28, 2008
Messages
4,743
Location
California
In Dune Wars (now with its own sub-forum!) we have a problem where AI settlers are built, but left sitting in their cities afraid to move. This is on an archipelago type map, and we have observed that when the ocean animals are removed, then the settlers will move. The ocean animals are actually sandworms, and they are supposed to be able to destroy stuff, that is the point. BTW if you haven't seen the sandworm art, go look and come back. It's jawdropping good.

I would like to find some way to have dangerous ocean animals, but still have the settlers go out. If they do not, then the human player can easily out-expand the AI and the game is not challenging.

I thought about making them into features. I could swap out the feature and then swap it back in when the sandworm moves. But when the user mouses over the terrain, the feature will be noticeably absent; this seems fake.

I have tried making them defensive only just as a test; this did not seem to help, which is weird, because the settler should not be scared of a defensive only animal. Perhaps the AI does not include defensive-only in its check.

Currently the sandworms are part of the standard barbarian civ. I thought about making another civ, which would be friendly with all the other civs. Then the sandworms would belong to this other civ. Maybe the settlers would not be scared. I don't know how to create another civ within python. Also the game mechanics will probably either prevent my friendly civ from attacking, or will make the civ an enemy after it does attack; so that is not a permanent solution in the game.

Can anybody suggest a way to have strong animals, but keep the settlers moving? It seems possible that FFH has some solution already.
 
Hmm. All I can think of is to make these Sandworms hidden nationality, although I logically dont see how it would help, thats how FFH seems to do it. I need to try out/ test this mod, I love Dune!!! XD
 
Fall Further has made it so there are multiple barbarian civs, like the Animals, the Orcs (the main barbarians), the demonic units, etc.

Except I think this required a lot of SDK changes, and I know that it was difficult to do, and potentially made the game less stable.
 
There is a similar problem with lair guardians in FFH2 chasing settlers away. Skyre Noctis has a fix for that in his better AI mod. I recommend looking there.
 
Thanks. I have PM'd Skyre. Is there a specific thread for FFH AI? I could not find one, but there are a number of sub-forums around here.
 
There are actually three different methods for checking if a plot is being threatened, all of which do a pretty similar job. I'm not even sure why there are three, to be honest.

All of them are in the CvPlayerAI class: 'AI_getPlotDanger', 'AI_getUnitDanger', 'AI_isPlotThreatened'.

For the problem you're having, you would want to edit AI_getPlotDanger (which is used by the settler AI) to make sure it ignores the sandworms. However...

Code:
if (pLoopPlot->area() == pPlotArea)

I would have thought the above line would already stop land units from worrying about dangers in ocean tiles. Have you changed anything to do with how areas work in your mod?

We've also got this check later on:

Code:
if (pLoopUnit->canMoveOrAttackInto(pPlot))

I guess I need more info on what you've changed, since it seems ocean animals shouldn't be a problem from a cursory look at the code. *shrugs*
 
Thanks. My comments refer to CvPlayerAI::AI_getWaterDanger(). The problem is on an archipelago map. Dangerous water animals appear to prevent the AI from loading its constructed settlers onto transports and sending them. It picks a colony site on another island, and it builds the settler; then the settler sits there without getting loaded.

In the Better BTS AI code, CvUnitAI::AI_assaultSeaMove() calls this function and there is a comment, "Loaded but with no escort, wait for others joining us soon or avoid dangerous waters".

Is this a problem you have encountered in Better FFH AI?
 
You could make some Escort units as a temporary fix. Just create some Sand Traveling units which use UNITAI_SEA_ESCORT and make them available at the same time as the transport ship. Then the AI should handle things fairly well. You could also just make the Sandworms be Invisible by default and only appear when they strike. I am assuming that you have it set so they wander around for a while and only randomly (rarely) strike, so people are meant to get accustomed to moving right along side the worms and just HOPING that they aren't attacked? You could modify how a specific type of invisiblility acts to have it still show the unit for the human players, but allows you to move onto the same tile without attacking, and keeps the AI thinking that the unit is invisible, thus they will (mostly) act like the unit isn't there, which I presume is the desired effect.
 
Probably we have not dug deeply enough into the code. There are escort units with normal early game strength such as 2-5, which have the same movement capability as the settler. So these could presumably be used as escorts. However, the units out there have high strength, like 20, so that the player cannot accidentally kill them. So we figure the AI is also making a strength determination, and deciding that only a large number of low strength escorts (like hundreds) would be enough.

Another modder has implemented a solution which appears to do what we need; see this link for details. He has added an optional unit flag, bNoDangerCount, which simply ignores certain units for the purposes of checking whether there is danger. So we can have strong units out there which will occasionally cause damage, but the AI will overlook them when deciding whether or not to send out the settler.

From some autoplays, it looks like the number of settlers lost is small, compared to the number of additional cities and population which come as a result. So now the AI players will not be so far behind the human players in the mod.

Thanks, koma13!
 
could you have the sandworms be spawned by events? ie; for each unit on sea terrain the risk of a worm being spawned is increased. Once spawned the sandworm would have a chance each turn of dissapearing back into the depths
 
Please stop by the dune wars sub-forum for more discussion about worm mechanics. I want the worms to actually be out there moving around. Players with long distance recon missions or sentries with good visibility will see them.
 
Back
Top Bottom