more dune wars related ai questions

I'd recommend having an auto-unload process that 'eats' the movement of the carrier.

Ie, each time you are attacked, the units in the transport are candidates. If you use a unit in a transport, that transport gets 1 less movement next turn. (you'd code this as giving the transport negative movement, then in the pass where you hand out fresh move to each unit you take negative movement into account as a 'movement debt').

This gets rid of the quite uninteresting "did I unload the transport" for both the player and the AI. I understand that "I ambushed the transports and defeated the units before they could deploy!" makes an interesting thought process, but given how simple it is and how annoying it is to have forgotten to hit the U key for the player, and how annoying it is for the AI...
 
I'd recommend having an auto-unload process that 'eats' the movement of the carrier.

Ie, each time you are attacked, the units in the transport are candidates. If you use a unit in a transport, that transport gets 1 less movement next turn. (you'd code this as giving the transport negative movement, then in the pass where you hand out fresh move to each unit you take negative movement into account as a 'movement debt').

This gets rid of the quite uninteresting "did I unload the transport" for both the player and the AI. I understand that "I ambushed the transports and defeated the units before they could deploy!" makes an interesting thought process, but given how simple it is and how annoying it is to have forgotten to hit the U key for the player, and how annoying it is for the AI...

Agree entirely with Yakk here. That's what I was trying to get at, the whole unloading mechanic as you guys are trying to go about it is the sort of micromanagement tedium a dev should avoid. I have to say though that negative movement is a bad idea, if you incorporate this and it causes negative movement points for the transport, I'd just make it automatically skip it's turn; I've seen it before where incorporating rolling debt mechanisms leads to undesirable behavior.
 
I'd recommend having an auto-unload process that 'eats' the movement of the carrier. Ie, each time you are attacked, the units in the transport are candidates. If you use a unit in a transport, that transport gets 1 less movement next turn.

The concept of auto-unload seems clear by itself, but I am not sure I understand your suggestion. With auto-unload, at the end of the player's turn, any unit loaded into a transport which is on land will unload, and somewhere the game will store which units were loaded into which transports, so that the right units get reloaded at the start of the player's next turn. I am not sure how to implement that storage. Also, not that we can say much about "reality" when it comes to Civ, but I can imagine the commander of the unit in the transport saying: "OK, troops, everybody out. Stand there for a week so the other guys can shoot at you. OK, back in for a week of travel. OK, everybody out again."

I guess you are suggesting a refinement of that, where the auto-unloaded units can be chosen by the game for defense normally; neither the player nor the AI has any "say" over this, the game does it. And when a unit which used to be in transport A is chosen for defense, then transport A has one less movement point next turn. Assuming you want to keep the stack together, that means the entire stack has one less movement point. So a good way to stall an incoming SOD with movement 2 is to suicide one cheap unit every turn. This slows down the stack by half.

I've spent some time looking through AI_assaultSeaMove and I still don't understand it, but I will keep looking. I would greatly prefer to keep the rules the same, and have the AI unload as soon as it is on land over the intended continent. I have determined that the existing danger functions simply count how many enemy units capable of attack are there; it does not do any actual analysis of the threat. So it is only useful for waking up workers.

Regarding micromanagement of unloading, the way DW works, you cannot load and unload in the same turn. So a player who tried to make his units less vulnerable by doing this would only get one transport move every other turn. Without this, there were a number of exploits possible such as the move/pillage/move away trick that I mentioned.
 
I'm going to restate what I think is a critical flaw in any process that lets units inside transports defend: these units are not displayed, and so are invisible to a human player attacking the stack (and possibly to the AI).

We cannot have a mechanic where units can defend without the player being able to see how many of them there are, or what type they are. The human player has to be able to see any combat units in order to make sensible strategic plans.

Letting non-unloaded units fight is just not going to work here.
 
When you attack the stack, you get the odds against the best defender in the stack.

So you won't be able to see most of the stack, but you will be able to see the best defender.

Hmm. You could also expose what units are in transports -- there is going to be code in Civ4 that hides that units are in the transports so they don't show up to rivals. Just find that code, and don't hide the units when you are over land?

By auto-unload, I meant that when a stack of transports is attacked on land, units in the transports are valid defenders, and will be "auto unloaded" to fight if they are the best defender. I figure a modest penalty (like -1 move per unit unloaded on the transports next turn) might be called for so you can 'harrass' a column of transports and slow it down without defeating it, but that is optional really.
 
So you won't be able to see most of the stack, but you will be able to see the best defender.

You need to be able to see the whole stack to make intelligent combat decisions.

You could also expose what units are in transports -- there is going to be code in Civ4 that hides that units are in the transports so they don't show up to rivals. Just find that code, and don't hide the units when you are over land?
If this is feasible its worth considering.
By auto-unload, I meant that when a stack of transports is attacked on land, units in the transports are valid defenders
I imagine it would be easy enough to let units inside transports defend; it would be much harder to make that unit actually unload.
Though... the former method would also let them defend when over desert tiles, which is undesirable. Transports *should* be vulnerable when in deserts; thats why you have to escort them.

I am still inclined towards an AI method that just automatically unloads its transports when it hits the target continent it is attacking, if there are any enemy units within 2 tiles.
 
Sigh. If a unit is allowed to deploy on the tile that the transport is on, you permit it to defend. I'm just saying it isn't ridiculously complex, and it solves the problem in a way that, while not perfect, removes much micro, and makes some sense.

Similarly, you might allow the units that can deploy (or just all units) to be displayed while in a transport. The "you cannot tell what units are in a boat" rules in Civ4 are (relatively) arbitrary.
 
I'm just saying there is a minor code and gameplay difference between being able to defend while loaded and automatically unloading when attacked. Particularly since we made it so that a unit that is loaded into a transport cannot unload again in the same turn; you must have your full movement in order to be able to unload.

I'm just saying it isn't ridiculously complex, and it solves the problem in a way that, while not perfect, removes much micro, and makes some sense.

Micro isn't really the issue here. I don't have a problem with forcing human players to unload their units to get them to defend.

Similarly, you might allow the units that can deploy (or just all units) to be displayed while in a transport.
If this can be done, then this removes most of my objection.

But it might still be be a more parsimonious design to have transports still function low how people are used to, where you have to unload to fight. If we can fix the AI weakness problem it by changing AI without changing the game mechanics that the player has to deal with, that would be ideal.
 
Here is question #4 on this thread. With jdog's help in the all terrain settlers thread, I have gotten settlers to travel from one island to another. This has helped the Fremen through their initial expansion. Next, I am trying to get all terrain combat units to attack foes on water. I have set up a vanilla testcase based on 0.82 but again I am unable to find the right places in the AI to change. ... Any help in figuring out where there are more incorrect calls to "area == getarea()" or similar will be appreciated.

I have investigated this a little further. In the testcase I attached, the problem does not always occur. Sometimes the city defender will capture the worker on water. I tried messing around with a few things and eventually discovered that a city defender whose unitai is CITY_COUNTER will capture the worker on water. Once I monitored which defender had which unitai, the behavior was consistent.

Units with UNITAI_CITY_DEFENSE do not seem to venture out of the city even to capture a solo enemy worker with no other threat around. But units with UNITAI_CITY_COUNTER will capture the worker.

So, I no longer believe there is a fundamental AI issue preventing all-terrain units from attacking on water. I'm a little surprised UNITAI_CITY_DEFENSE does not capture an unescorted worker, but that is a much smaller problem. I will try adding UNITAI_CITY_COUNTER to all the units which appear to be showing this problem, and see what happens.
 
I'm a little surprised UNITAI_CITY_DEFENSE does not capture an unescorted worker, but that is a much smaller problem

I'm not sure its even a problem; I wouldnt' want to be able to expoit the AI by bringing up a couple of lone workers in separate stacks adjacent to my main stack, and then luring city defenders out of the city to capture my workers leaving me free to take the city.
 
Heck, even if they return to the city, I get to strip off the 25% defence bonus from fortification!

I'd so use workers as bait in a number of situations if the AI could be tempted to pull defenders out by them (worker-bait already is pretty good, and can be used to pull some units out of a city, and then stomp on them)
 
I would "assume" that the likelihood of BBAI sending a defender out to capture a worker goes down significantly if there are visible enemy attack units. But that was not part of my test; there were no enemy units besides the worker anywhere.
 
I would "assume" that the likelihood of BBAI sending a defender out to capture a worker goes down significantly if there are visible enemy attack units.

I would not be at all confident about this, the AI is very very easy to bait with workers, which it has a very high prediliction for chasing after. Remember some of the problems we had with Harkonnen slaves, which the AI would always attack.

I remember one game I played once on a Eurasia map. I was Russia, sitting in eastern Europe/Russia, and doing well on tech trading with all of Europe, so I had cavalry units.
China declares at war with me, and comes in with a *huge* stack of curaissers and cannons, probably 50+ units.
I then was able to spend the next 4-5 turns baiting their giant stack by sacrificing a worker each turn while making them amble around aimlessly inside my culture/road network, and then each turn attacking their stack with cavalry (each killed a unit and injured cannons) who would retreat back to a city to heal, and so I was eventually able to buy the time to whittle down their monster stack and avoid having multiple cities conquered/razed by the huge army, with almost no losses on my part other than the sacrificial workers.
 
You'd have to detect any approach by any enemy stacks within 5 turns to make deploying a city defender to attack a worker safe. Admittedly the danger goes down as the number of turns go up.

Otherwise, sacrificial workers would be quite effective at removing fortify bonuses from cities.

The short of it is that city defenders don't deploy and attack. Their job is to defend.

Possibly the AI should have fewer defenders and more flexible units.
 
Here is question 5. In Dune Wars, we have noticed a problem with UNITAI_ASSAULT_SEA. On an assault, all-terrain transports (which have a low combat strength) take their full load of units onto land adjacent to the enemy city and then end their turn, with their troops still loaded. These transports are sitting ducks for the city defender, so they usually get destroyed, losing all the loaded troops.

Sephi has provided a code fix. At the end of the turn, all transports on land, in danger are unloaded. See this post and following for details.

At this time, the only active question in the thread relates to AI_foundValue, and we have established that nobody understands it. I have dug into it a few times and I will keep trying. Poor colony placement (after the initial city) is hampering the DW AI. If I get anywhere, I will write up what I learned.
 
Hi guys,
I'd like to add another AI issue to the mix.

Something strange is happening with espionage AI.

I watched a detailed auto-play of behavior by one faction (the Bene Tleilaxu) - see http://forums.civfanatics.com/showpost.php?p=8741134&postcount=56.
This faction's leader has a fairly high iEspionageWeight, and a Facedancer UU who replaces the basic infiltrator (= a spy), and has a few extra promotions and will eventually have some unique espionage missions.
All espionage units have the "suspensor travel" promotion, which lets them move across desert tiles (=coast and ocean), so they can get between the "islands" in the desert.

Watching the AI, it built a very large number of Facedancers (~12-13 units eventually), and accumulated a large number of espionage points (especially against its two neighbors, 1400 vs the Harkonnnens and 1800 vs House Ecaz) by the end of the game, but it never seemed to actually use any spy missions.

The facedancers spent most of the game wandering around in the desert just outside the cultural borders, but never really seemed to enter enemy territory, and never spent the large EP reserves on any spy missions.

Any ideas why, on how we might improve/fix this?

Also, the AI seemed unwilling to expand much. The AI only founded 3 cities all game (including one on another island), despite good city cites close to its capital on its home island.
 
I have looked into the CvUnitAI code for spies a little bit to see if I could find anyplace that might be overlooking all-terrain movement. If my analysis is correct, I believe I have found one significant place. In CvUnitAI::AI_moveSpy, it goes through several pages of code related to operations when the unit is in enemy territory, or when at peace. The following section is executed when in friendly territory, and at war. I have removed some curly braces and combined lines to make it take up less space.
Code:
if(area()->getNumCities() > area()->getCitiesPerPlayer(getOwnerINLINE()) )
	if (GC.getGame().getSorenRandNum(4, "...") > 0)
		if (AI_reconSpy(3)) return;
	else if (AI_cityOffenseSpy(10)) return;
if (AI_load(UNITAI_SPY_SEA, MISSIONAI_LOAD_SPECIAL, ...
I translate this as: If there are cities on this continent which I don't own, then 75% chance to "recon(3)", else "cityoffense(10)". If that didn't work, try to load onto a ship which can spy. Recon(n) looks for a useful plot within 3 moves and moves there. Cityoffense(n) looks for a useful city within 10 moves and moves there.

However, that first clause "if there are cities on this continent which I don't own" seems to be a sticking point. In an archipelago map, this will hardly ever happen. In a *vanilla* archipelago map, it makes sense to then find a spy ship to go on. But in DW, spies are also all-terrain.

I locally experimented with adding "or if this unit is all-terrain" to that first clause. The results look much better. I had a mid game save and I studied one of the civs that focuses on spies. There were 13 spies standing around, all within a few plots of each other in domestic territory. I am not sure why that area was so popular but they were all there. I autoplayed a few turns with the original AI and confirmed they were all standing there. Then I switched the dll to have this new AI and reloaded the game. The pack of 13 saboteurs immediately streamed off towards enemy cities. It was quite remarkable, like lemmings.

We'll do some more tests but it seems that we will need to carefully study each AI behavior for all-terrain safeness. I will notify about any more changes, in case there is interest in putting them into the main BBAI code.
 
Back
Top Bottom