Experimenting with AI Mechanics: A Thread

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Experimenting with AI Mechanics: A Thread

      Wasn't entirely sure where to put this, 'cause it is an experiment to test out the limits of AI countries in CoW.

      To be fair, only reason I'm doing this is because I have exams, therefore can't seriously play CoW, so I wanna do something useful (debatable) while I slowly lose my mind.

      So here's the gist:
      • I'll be playing as Mexico in HWW, the most inactive world map; only neighbour is the USA, so gotta make sure I'm friendly with them. Otherwise, I'll be left to my own devices.
      • Will be doing the standard "set shared map for all AI" to boost their opinions, but I will also be setting shared map with all the playable countries. Thought long and hard, and to be honest, there isn't much they can really do; I don't plan to invade any country in this run.
      • If any country declares war on me, I just chill in my own borders and declared ceasefire (maybe peace)

      • If a country declares war or surprise attacks another country (and their global popularity drops) then I immediately switch to peace so my popularity doesn't fall as well.
      I'll be honest I probably haven't thought of everything, but we'll see.

      Now we get to the purpose of this experiment: how do AI run these computer and inactive countries? Can they stand up to the skills of the human? Can they make some semblance of an army? Will they have a good economy? What units do they prefer? Do they take terrain into consideration? That is, my friend, what this experiment is all about.

      Also just remembered I could use espionage to find out armies and buildings and stuff, but I'm not sure if it damages your popularity so not gonna risk it (either way Mexico isn't that rich in this gamemode so ¯\_(ツ)_/¯)

      Won't promise daily updates or anything, maybe thrice a week?

      Either way, its gonna run for a looooong time, maybe 40-50 days (if I survive)

      Time to hunker down...
      :tumbleweed:
      Have an amazing rest of your day ^^

      "Everything is impermanent. The only thing that is permanent it impermanence itself."

      Need support? ---> Send a ticket here!

      dxter's CoW Battle Calculator ---> Use it here!

      :tumbleweed:

      o7
    • It would probably be most useful to focus on a single AI country and compile as much of its activity as you can for each day in a spreadsheet. I'd pick a country that can't attack me and is least likely to be attacked by another player and use as many spies as you can afford.
    • The experiment isn't local for a reason; I want to test to see if the neighbours' popularities would affect troop positions, diplomatic activity, aggressiveness, etc.

      I might still do what you mentioned, but a lot of the data is subjective, except I suppose number of troops, number of builldings, but then still it is hard to judge the "quality" of each unit, since each unit has a different cost per unit, damage output and SBDE.
      Have an amazing rest of your day ^^

      "Everything is impermanent. The only thing that is permanent it impermanence itself."

      Need support? ---> Send a ticket here!

      dxter's CoW Battle Calculator ---> Use it here!

      :tumbleweed:

      o7
    • I've observed a few things about AI behavior. Curious to hear what others have seen, and what your experiments with Mexico show.

      The AI operates its military on a province level. It has no strategic objectives.

      When you place units on the border of an AI province, the AI will attempt to match the numbers. There is some kind of local army strength to opponent army strength ratio for every province. Provinces that are under greater pressure draw units from provinces that are under less pressure. For example, if France places a large stack next to a German AI, and Poland moves his army East, away from Germany, then German troops will over time migrate West to counter France. You can exploit this behavior by forcing the AI to vacate the border you want to invade, and then move in quickly to take over large swatch of lightly defended territory.

      The flip side of this province level, power balance logic, is that the AI will try to take advantage of empty provinces. This is why fighting the AI along a large border can be so frustrating. As soon as you stack your units to push forward, the AI will stream across the border, threatening empty provinces with anything it has on hand. Then you either have to divert your artillery and air power to knock them out one by one, or suffer unnecessary losses in small, pointless, but bloody close combat all over the map.

      The worst case scenario is when you completely surround an AI country, which wasn't a threat all game, but then you get large enough so that every AI declares war on you. That small AI country in your middle will now send units in every direction. This kind of mess takes a lot of effort to clean up. Tip: Don't let it happen. Kill everything while your front line with that country is still manageable. EVERY country is an enemy, in the long run.

      The AI has a concept of unit type.

      When the map is swarming with airplanes, the AI will start building more AA guns, and moving them close to your air base. This is assuming the AI has access to the tech and the factories. On maps with less air power, the AI seems to build less AA. Similarly for tanks and AT guns. I'm less sure of this observation. It may be accidental. More research needed.

      The AI tries to balance its resources through the market.

      It doesn't change its tactics depending on resource availability. Neither do most players, so this is not a knock on the AI's programmers. When the AI is lacking in food, for example, it will bankrupt itself trying to buy more, selling everything else in the process. Because of this, the AI is typically broke. Take cities (especially capitals) while they are still player controlled, else your conquests will not be very profitable.

      One interesting outcome of this trading behavior is that food-rich AI countries will tend to do the best. They will build effective units (infantry, militia, AT guns) in greater numbers. An AI rich in rares will end up with more flying bombs, or nothing, because it's trying to buy food by selling its rares.

      The AI researches tech in breath-first order.

      Meaning, it will try to get every tech to level 1, then 2, etc. It doesn't go deep into any tech tree. Again, noob players do the same thing. This is not a knock on the AI programmers. But this leads to bad strategic outcomes. Instead of fielding level 2 AT guns to match your medium tanks, it will be researching flying bombs, because that's next on its research menu.

      AI control over air power, naval power, are complete unknowns to me. There is no obvious logic to it. Sometimes, they will attack. Other times, they will patrol, or go somewhere else. Often you can simply go around AI navy stacks, take all their land, and the navy will disappear without a fight. The only issue is a battleship or cruiser close to the shore, making it harder to take that last city. Often you can just wait for it to sail away, and then take the city, so you don't have to spend a single HP.
    • My observations have been similar to yours, though I've also never paid much attention to them because they're so predictable and easy to defeat.

      One thing I've noticed is that they are almost always moving units dot-to-dot, rarely sending units on longer journeys. This holds for their reinforcement behavior, where they'll draw units from the nearest couple provinces and fill them back in later. I've seen some instances of them sending units multiple provinces when there's an empty province to defend, and some rare instances of them sending units on long treks to the front line, but otherwise it seems like they're usually moving one province at a time (or one dot at a time for naval units).

      I wonder what kind of data Bytro gathers and whether some sort of machine learning algorithm could watch players' decisions and learn from that to create a stronger AI.
    • jubjub bird wrote:

      I wonder what kind of data Bytro gathers and whether some sort of machine learning algorithm could watch players' decisions and learn from that to create a stronger AI.

      I've thought about this as well. How would they select the training data? Which players and which games would they mine? They would have to pick players who doesn't use gold (because gold-based play styles don't work without gold). They would have to pick players who win regularly, and against top opposition. They could optimize for every doctrine. The end result would be much better at CoW than most human players. Only the best could compete against the AI. The noobs and golders would give up and walk away. It would kill the game :)
    • All good questions. They could segment the player population by win percentage or k/d and set up multiple AIs that game creators could choose from, but the default maps would probably have to be pretty basic level. Maybe up the AI competitiveness with map size, with the 100p map getting a harder AI than the 50s, which has a harder AI than the 22, etc.

      Back to the discussion of AIs as they currently are, my observation has been that the AI makes multiple decisions at the same time--for example, you'll often see multiple AI units start moving simultaneously. I assume, but don't know for sure, that construction or production starts also occur at this time (maybe Python can confirm if they can get enough observation time). I wonder if the developers could increase the frequency of these decision times to make AIs a little more active and therefore more competitive.

      Another unrelated idea could be to give AIs an economic advantage to make up for their strategic inferiority, like cutting all construction and production costs for AI by 25% or something.
    • They're prolly should be some kinda limit for machine learning AI tho; it would completely ruin small maps, turn games in WW1 style trench warfare since AI would learn defensive, static positions are the most cost-effective method to not die against bigger opponent

      jubjub bird wrote:

      Another unrelated idea could be to give AIs an economic advantage to make up for their strategic inferiority, like cutting all construction and production costs for AI by 25% or something.
      Wayyyy too OP

      Imagine some random guy leaves on Day 25 in WaW; the AI would magically get 25% extra resources to spend, increasing army strength. Sure, they don't know how to use it properly, but if its between them and their industrial capacity the invader would still suffer.

      jubjub bird wrote:

      Back to the discussion of AIs as they currently are, my observation has been that the AI makes multiple decisions at the same time--for example, you'll often see multiple AI units start moving simultaneously. I assume, but don't know for sure, that construction or production starts also occur at this time (maybe Python can confirm if they can get enough observation time). I wonder if the developers could increase the frequency of these decision times to make AIs a little more active and therefore more competitive.
      Yea, I think everyone has seen this; the AI tends to make collective decisions, which can startle you if you see idle troops for 6 hours, then they suddenly push out a general offensive. Very predictable, and it usually happens in response to something (declaration of war, taking of capital/other city)

      z00mz00m wrote:

      I've thought about this as well. How would they select the training data? Which players and which games would they mine? They would have to pick players who doesn't use gold (because gold-based play styles don't work without gold). They would have to pick players who win regularly, and against top opposition. They could optimize for every doctrine. The end result would be much better at CoW than most human players. Only the best could compete against the AI. The noobs and golders would give up and walk away. It would kill the game
      If this were to be implemented (which I doubt it would), it would have to be dynamic, perhaps different for each map. The devs would have to take into account the average level, KDR, wins, and other relevant data to make an AI that can stand up to the average player on that map. It would be useless to have an AI which shreds noobs on the Europe map but is a cakewalk for those with a greater than 1 KDR.

      z00mz00m wrote:

      One interesting outcome of this trading behavior is that food-rich AI countries will tend to do the best. They will build effective units (infantry, militia, AT guns) in greater numbers. An AI rich in rares will end up with more flying bombs, or nothing, because it's trying to buy food by selling its rares.
      Even I have noticed this; always wondered why AI love flying bombs. Mostly likely because of their low cost (especially manpower) and since with certain countries' balance of resources they always have spare steel, oil and RMs (altho these are all necessary for industry no?)
      Have an amazing rest of your day ^^

      "Everything is impermanent. The only thing that is permanent it impermanence itself."

      Need support? ---> Send a ticket here!

      dxter's CoW Battle Calculator ---> Use it here!

      :tumbleweed:

      o7
    • z00mz00m wrote:

      When you place units on the border of an AI province, the AI will attempt to match the numbers.
      This is true. I also have the sense that if you put more units near their border they are more likely to declare on you. Any thoughts? More importantly, what is your feeling on how they can detect you? Do you have to be in visible range for them to count your units? Fog range? Any range?

      jubjub bird wrote:

      Back to the discussion of AIs as they currently are, my observation has been that the AI makes multiple decisions at the same time
      Yes! They don't do shit and then all of a sudden they all start marching to this place or that. There seems to be some timer where some calculation is made and everything moves. Individual stacks can move at any time though depending on immediate reaction, e.g. artillery.

      Regarding planes that someone commented on, my experience is that they usually pick one of your cities to attack and keep attacking it, even if it has no units. This is easy to kill without losses by patrolling over the city.

      Regarding AI. It would be pretty easy to use machine learning to dominate most human players. Obviously, bytro doesn't want to do that. They are not using machine learning for AI. It is just some simple hacky code.
    • Talvisota wrote:

      Did anything ever come of this?
      I wish, but I kept dying to US and also had exams; feel free to take up the challenge tho, post results here.
      Have an amazing rest of your day ^^

      "Everything is impermanent. The only thing that is permanent it impermanence itself."

      Need support? ---> Send a ticket here!

      dxter's CoW Battle Calculator ---> Use it here!

      :tumbleweed:

      o7