Amphibious attack AI

Discussion in 'Civ4 - Better AI' started by jkp1187, Jul 1, 2008.

  1. jdog5000

    jdog5000 Revolutionary

    Joined:
    Nov 25, 2003
    Messages:
    2,601
    Location:
    California
    Caboose: There are two issues, one is choosing who to declare war on and the other is executing the war ... if you clear out your starting continent early (like before/around Astronomy), the AIs on other continents may never choose to pick a fight with you. If you have a continent to yourself you may simply be too powerful for them to consider, especially if there are local targets on their continent. We'll do our best to make it so that if transcontinental war breaks out the AI will fight well, but if you have a runaway lead in power the AI will never consider it a good idea to fight you.
     
  2. Caboose

    Caboose Another Drill IV defender

    Joined:
    May 1, 2008
    Messages:
    302
    Location:
    Norway
    Ok, I explained it in Solver's patch thread, forgot to do here.

    I am at war with everyone. Yet they don't attack overseas. Also, the AI has been alot more powerful than me for a long time. He has a lot more troops and is technologically advanced.
     
  3. jdog5000

    jdog5000 Revolutionary

    Joined:
    Nov 25, 2003
    Messages:
    2,601
    Location:
    California
    Ah, I understand ... getting naval invasions to be better executed in this kind of scenario is definitely something we aim to improve! Could you post a save or two from different points in the game? Having specific in game scenarios to test different AI behavior with is very useful.
     
  4. Caboose

    Caboose Another Drill IV defender

    Joined:
    May 1, 2008
    Messages:
    302
    Location:
    Norway
    Ah, ok, here goes.

    Description of attached saves:

    • Tiny map size
    • Monarch difficulty
    • 3 opponents
    • I am Alexander

    1st save: Right before AI declares war after I attack his friend Justinian for the second time.

    2nd save: AI has declared war.

    3rd save: AI sent some troops over, but only a few.

    4th save: I reach radio and still he's nowhere to be seen on my land. Only harassing my sea resources.
     
  5. jdog5000

    jdog5000 Revolutionary

    Joined:
    Nov 25, 2003
    Messages:
    2,601
    Location:
    California
    Great, thanks. This will be very useful, if I figure any explanations other than "the AI could be better" I'll post those as well.
     
  6. armand453

    armand453 Chieftain

    Joined:
    Jul 25, 2007
    Messages:
    45
    Code:
    switch (pArea->getAreaAIType(getTeam()))
        	{
    			case AREAAI_OFFENSIVE:
    				iMaxUnitSpending += 5;
    				break;
    			
    			case AREAAI_DEFENSIVE:
    				iMaxUnitSpending += 10;
    				break;
    			
    			case AREAAI_MASSING:
    				iMaxUnitSpending += 25;
    				break;
    			
    			case AREAAI_ASSAULT:
    				iMaxUnitSpending += 8;
    				break;
    				
    			case AREAAI_ASSAULT_MASSING:
    				iMaxUnitSpending += 16;
    				break;
    			
    			case AREAAI_ASSAULT_ASSIST:
    				iMaxUnitSpending += 6;
    				break;
    			
    			case AREAAI_NEUTRAL:
    				break;
    			default:
    				FAssert(false);
    		}
    Don't you think the var iMaxUnitSpending must be increase for AREAAI_ASSAULT and AREAAI_ASSAULT_MASSING?
    Because when you had to go in another island or continents you need nore units because of the time that will take reinforcement to help the first wave of unit.

    Armand.
     
  7. Nor Me

    Nor Me Chieftain

    Joined:
    Feb 22, 2003
    Messages:
    50
    If you are going to make the AI build more ground units for amphibious invasions, it would be a good idea to make it check that it doesn't build many more units than it has transport space for. That should just be a question of adapting the existing code for deciding how many transports to build.

    I've seen civs with more inland cities do this a lot. Building units doesn't help you get Astronomy.
     
  8. jdog5000

    jdog5000 Revolutionary

    Joined:
    Nov 25, 2003
    Messages:
    2,601
    Location:
    California
    I'm not sure ... increasing acceptable unit costs could have repercussions for the rest of the AIs economy so I wouldn't want to change that without need. I don't think this is the limiting factor right now (no priority on filling empty transports) but I'll keep an eye on it.

    True, it could otherwise be a viscous cycle.
     
  9. Yakk

    Yakk Cheftan

    Joined:
    Mar 6, 2006
    Messages:
    1,288
    No, that's a debugging string I believe.

    This means you can do things like track down who is using the random number generator, and when. Given that calls to the random number generator have to be extremely deterministic for multiplayer to work (and replays, and reloads, and...), this is a useful trick. :)
     
  10. Caboose

    Caboose Another Drill IV defender

    Joined:
    May 1, 2008
    Messages:
    302
    Location:
    Norway
    So how you guys doing on this? Any hope of getting an AI to actually launch naval invasions in the near future?
     
  11. Yakk

    Yakk Cheftan

    Joined:
    Mar 6, 2006
    Messages:
    1,288
    I've seen impressive (20+ unit, on Galleons) multiple-stage invasions in Better than BTS 0.3. It was enough to take a few coastal cities (the target was an AI I was non-navally at war with), and they almost beat me to the capital (they had enough troops to take the in-land capital adjacent to it when I took it out).

    So... I think that is better. :)

    In that same game, I was attacked multiple times by another power. It was a reasonable target. There did seem to be some problem -- they sent 3 galleons, but far less than 9 units, on the 2nd invasion.
     
  12. jdog5000

    jdog5000 Revolutionary

    Joined:
    Nov 25, 2003
    Messages:
    2,601
    Location:
    California
    It should be better now since the AI will now try to refill empty transports after the first wave. This was the first obvious bottleneck that kept it from performing well, it now remains to be determined what else there may be that it could do better.

    One thing it currently sucks at is picking up troops it has stranded on little islands ... they can be left there for any number of reasons like the enemy capitulating or being beaten to the target city, whatever. During times of peace it will leave transport groups sitting in port doing nothing for turn after turn while 10-20 units hang out on an island gradually becoming more obsolete. Haven't figured out yet how to try to rescue them.

    There are a couple other little things, like if the AI builds Galleon escorts before it can build Frigates they will seemingly hang out doing nothing forever after their useful window, never transitioning to transport AI where they could be upgraded or used.

    Right now though my main focus is on air units ... they need some work in terms of choosing cities to base them in (particularly for bombers) and also could really be much more helpful when defending than they are now by running airstrikes.
     

Share This Page