Author Topic: Improved AI  (Read 10986 times)

modman

  • Guest
Improved AI
« on: 30 September 2008, 22:45:24 »
Hello all.  The purpose of this topic is to discuss the possibility of a CPU-ultra that is more than just and accelerated CPU.  

There are three things that all good AIs similar to Glest share:
  • Preprogrammed military strategies (ambush etc.)
  • Reacting to common situations(ie lone unit spots previously unknown town)
  • Learning from past situations, especially from successes

I was hoping for better logic from the CPU ultra in these ways:
*regrouping after, say, 20 or 30 tiles.  This prevents the CPU from ineffectively fighting in lines.
*"measuring" the amounts of defense that can be provided by certain units and making more accordingly.  This means, for instance, that it knows an archmage can withstand more attackers than a demon, but also knows that it is weak and needs melee to keep units away from it.
*the ability of a CPU to use secondary attacks when needed.  Like an archmage using a static fire on a battlemachine if it's alone instead of the ice nova.
*this goes for switching from primary to secondary if EP==0 and secondary attack EP cost ==0 (yes, I have basic C++ knowledge, nothing else)
*build resource-storing buildings closer to the resources (IE summoner guilds by wood)
*leave at least 2 tiles of space between 2 buildings.  This is so units don't get trapped in their own town.
*Not building more than 1 building that can only do upgrades (like building 3 different archmage towers)
*Summoner should cancel all her queued orders when she loses more than 1/3 of her health.
*This goes for other buildings, like barrackses and aerodromes as well.
*can use military tactics when attacking your town.  Maybe distract you one place, then bring in everything else on the opposite side of your town, also use ambushes, etc.
*Putting melee units closer to the enemy when regrouping, and ranged slightly farther back (the distance is to be determined by the primary attack range)
« Last Edit: 31 January 2009, 17:19:50 by modman »

daniel.santos

  • Guest
Re: Better CPU Ultra
« Reply #1 on: 26 October 2008, 11:14:27 »
I would first like to take this opportunity to chime in with a link to my very first post on this forums (ahhh, the reminiscences :)

https://forum.megaglest.org/index.php?topic=3142

Quote from: modman
Hello all.  the purpose of this topic is to discuss the possibility of a CPU-ultra that is more than just and accelerated CPU.  No, I was hoping for better logic from the CPU ultra in these ways:

*regrouping after, say, 20 or 30 tiles.  This prevents the CPU from ineffectively fighting in lines.
This is the result of the way the AiRuleMassiveAttack rule (sources/glest_game/ai/ai_rule.h:148) works and I agree.  I think the main point of this is that an attack force needs to stay together.  I know I'm about to get my ass kicked usually when 3 to 5 horseman or drake riders show up.  I know this because those are just the fastest units and they got there first, more are surely on their way.  Perhaps the most effective mechanism for this is just the same as what would be required to have units move in formation for players & AI alike -- this will allow a massive attack AI rule to be executed with the units arriving at the same time, except that I would have them break from formation the moment an enemy is sighted and form back up once no more enemies are visible (in case they run into a scout, you don't want to screw the whole attack up just because of that).

Quote
*"measuring" the amounts of defense that can be provided by certain units and making more accordingly.  This means, for instance, that it knows an archmage can withstand more attackers than a demon, but also knows that it is weak and needs melee to keep units away from it.
Yea, that's a tricky one.  In the end, I think each tech tree needs an AI hints section to tell it these types of things.  The ideal strategy game has a rock, paper scissors type of set up where certain units have certain strengths and weaknesses against other certain units -- this keeps it fun and interesting and, as some have put it, keeps a game from becoming a contest of who can harvest resources and build the fastest.

Quote
*the ability of a CPU to use secondary attacks when needed.  Like an archmage using a static fire on a battlemachine if it's alone instead of the ice nova.
I've tried to incorporate some of these mechanisms into the game with auto-attack commands.  Currently, on FPM, battlemachines and Liches have auto-attack commands, which are also the first attack command.  Thus, the AI will choose this as the attack.  For battlemachines, they will seek to get into melee range and whack stuff because that does more damage.  But if they can't whack anything or the nearest target is arial, they will switch to their arrow attack.  For Liches, they will use their withering dispair attack unless they are at less than 100% health, in which case they use the more mana expensive Soul Steal attack.  However, static fire is also huge for taking out units of all types (since they are usually pretty deadly) and that's not something I can figure a good way to implement without getting heavy into AI calculations.  Thus, I suspect this will eventually get solved by making just those types of calculations, each unit asks themselves:
  • who is in range?
  • who is a threat to me personally?
  • who is the greatest threat to my faction?
  • how much damage does each of my attacks do to each of the enemy units in range?
  • how many friendly units will I fuck up with this attack (considering splash damage)?
  • Thus, which unit should I attack and with which skill?  Or should I just turn around and not destroy my friendlies or expose myself to unnecessary risk?

Quote
*build resource-storing buildings closer to the resources (IE summoner guilds by wood)
Yea, I like that one

Quote
*leave at least 2 tiles of space between 2 buildings.  This is so units don't get trapped in their own town.
I believe the minimum the AI will allow is 2 spaces in fact.  If you've seen otherwise, please save the game and email me the saved game file.

Quote
*Not building more than 1 building that can only do upgrades (like building 3 different archmage towers)
Yea, pretty annoying huh?  This is better than it used to be because of tweaks I made a long time ago, but it still does it.  One benefit from this is that if you need a building to make a certain type of unit (like blacksmith needs to exist for various units to be created) then it's good to have a backup in case one is destroyed.  But the benefit vs cost is often not as worthwhile as the AI may think.

Quote
*Summoner should cancel all her queued orders when she loses more than 1/3 of her health.
Agreed, except in cases where they are very close to being done and the risk is worth it.  I have also seen a battlemage suddenly start trying to morph into an archmage in the middle of combat, and he was the only enemy unit left alive.  He was going to die, but he almost killed one of my units and probably would have if he didn't start morphing.

Quote
*This goes for other buildings, like barrackses and aerodromes as well.
I don't agree with this as it's usually important to pump out as many attack units as possible, even when the building is falling into shambles.

Quote
*can use strategies when attacking your town.  Maybe distract you one place, then bring in everything else on the opposite side of your town
Yea, I covered that one my January post (see sneak attack)
« Last Edit: 10 April 2016, 18:22:14 by filux »

modman

  • Guest
Re: Better CPU Ultra
« Reply #2 on: 27 October 2008, 03:06:49 »
How am I supposed to save the game?  If you know, please share.  I would love to continue long games!

Another thing is that the CPU should "compute" the tech tree, and then it knows how to get to the more powerful units better.  This might solve the problem of building, say multiple Summoner Guilds.

I would love to program this in myself, but I'm only slightly better at C++ than programming conversion programs and text-based games.  Sorry.

mictes

  • Guest
Re: Better CPU Ultra
« Reply #3 on: 27 October 2008, 11:02:39 »
I have a simple idea:
Why the units have nut a "priority value" like e.g. :

For buildings:
<unit value="building"/>
<priority="1"/>

>>> for a building which should not built more than 1 times per castle.
      (when one of the building gets destroyed a new one will be built)

For Units:
<unit value="unit"/>
<produce unit="barracks"/>
<priority="10"/>

>>> for a unit that should be build about 10 times per barrack.
      (when one of the unit dies a new one will be producet)

wciow

  • Behemoth
  • *******
  • Posts: 968
    • View Profile
Re: Better CPU Ultra
« Reply #4 on: 27 October 2008, 13:40:04 »
Its a good idea but maybe a little simplistic.

The idea of better AI is not to give it comands about exactly what to build in every situation but to give it a flexible set of rules which allow it to adapt "intelligently" to a situation. I think glest AI is certainly more of the former atm.

I'm talking as someone who has no experience in AI programming so you could just ignore what I have said. However, just giving the computer strict rules like build this many castles or that many horsemen leads to predictable and often stupid AI which does not account for its situation. Human players will very quickly learn what the computer does and how to defeat it.
Check out my new Goblin faction - https://forum.megaglest.org/index.php?topic=9658.0

ZaggyDad

  • Guest
Re: Better CPU Ultra
« Reply #5 on: 27 October 2008, 15:38:52 »
Mictes, I think that would be a bit too complicated, being that it would mean having to write priorities for every unit, which would be a huge amount of work, because you'd have to keep it all coordinated. And having a file with different AI situation sorta things might not be so bad, but it still would be sort of complicated. But it might not be too bad.

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,240
    • View Profile
    • http://www.titusgames.de
Re: Better CPU Ultra
« Reply #6 on: 27 October 2008, 15:47:10 »
We have CPU and CPU-Ultra now, but it would be nice to have some more steps. Some kind of cpulevel would be good!
I didn't had a look into the current implementation, but some kind of random for decisions could probabaly help here.
I asume that there is some kind of decision cycle for the CPU-players.
So if a computer player with a low CPU-level gives a command with a probability of only 10% per decision cycle the decision will (probabaly) be delayed for multiple decision cycles.
The best CPU-player simply does it! probability 100%.
The numbers(10%) are only examples! If you have lots of decision cycles, you probabaly have to lower the probability to something like 0.1% or worse to get a good result.

On most maps 2 ultra cpus are usually too strong for me. But a setup of a 100% CPU and a 80% CPU would give a great fight.
What do you think, is somethink like CPU-leveling possible ( and not too difficult of course ) ?

But please keep the stable/official GAE release in mind. This should have the highest priority !)
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

modman

  • Guest
Re: Better CPU Ultra
« Reply #7 on: 28 October 2008, 00:34:52 »
It's way too hard to beat a 1 on 1 CPU Ultra because their only advantage is that they mine and harvest and research and build faster (sort of like a CPU on a sugar rush).  I think that an improved CPU should be improved so that they could even surpass a now-CPU ultra by using stragegy instead of "cheating".  Cheating is actually what it's called too, when a CPU has an obvious advantage over a player.  Check Wikipedia on AI cheating



The optimal CPU would preferably (just to remind you guys):

*play like a human, or as close to human as possible
*have no more knowledge than a human player would have
*use knowledge given in a human way
*use knowledge of map in a human way
*use knowledge of past attacks like a human ("if enemy has x powerful unit, I need to step up my military a bit")
*use knowledge of friends in a human way

Overall, simulate human behavior as best as possible.

daniel.santos

  • Guest
Re: Better CPU Ultra
« Reply #8 on: 28 October 2008, 19:01:46 »
Quote from: "modman"
It's way too hard to beat a 1 on 1 CPU Ultra ...
I can defeat Ultra every time and 2x Ultra almost every time.  I can defeat 3x Ultra if I get lucky (i.e., they end up attacking each other more than man).  Now, if I put 2x Ultra on the same team, I wont win nearly as often


Quote from: "modman"
...because their only advantage is that they mine and harvest and research and build faster
Actually, I believe that they research, upgrade and build at the same speed.  They even execute harvesting skills at the same speed, they just produce 180%-ish of normal (i.e., cheating AI).  They do not have any awareness of other player's units, but they do always know the location of enemy bases. (some of this could be slightly inaccurate, but I don't think so).

Quote from: "titi"
We have CPU and CPU-Ultra now, but it would be nice to have some more steps. Some kind of cpulevel would be good!
I'm thinking along these same lines and have been working up some requirements for this.  Here's a few settings I have in mind (some of these apply to human and computer players alike)
  • Starting resources: 0%-2000% - a percentage of what is specified in <faction>.xml, normal is 100%
  • Resources Gathered: 10%-2000% - how much resources are gained when a harvester returns their load to a unit (building) that stores them, normal is 100%
  • AI Map Knowledge: 0%-100% - how well AI knows the map, 0% is never seen it before, 100% is remembers it perfectly.
  • AI Attentiveness: 0-1 - how well the AI stays on top of making sure they are producing units, keeping workers busy and responding to attacks.
  • AI Aggressiveness: 0-1 - zero is a home boy that never adventures out, 1 is reckless aggressor that only has military units at their base because it was either just produced or he's massing for an attack and happens to choose his base as a location for massing units (and only because it makes strategic sense offensively, not defensively).
  • AI Cunning: 0-1 - how likely AI is to employ special tactics discussed here and elsewhere and how well those tactics are executed -- this will be an ongoing work for some time.
The first part of my new AI changes are going to be path finding AI followed by target assessment.  The path finding effects both human and computer players, but will be an important part of improving the CPU opponent because it will tally enemy units and be able to apply a target assessment on each one.  Thus, when the AI asks for a path, it doesn't just get a path, it gets a path with lots of meta data (risk assessment, time to traverse, how much it'll probably have to fight, how likely it is to die, how much is unknown about the path, etc.).

Quote from: "titi"
But please keep the stable/official GAE release in mind. This should have the highest priority !)
0.2.8 is out, please let me know if you find any bugs, flaws, etc. as I will assume it's "stable" otherwise.

modman

  • Guest
Re: Better CPU Ultra
« Reply #9 on: 31 October 2008, 17:42:00 »
How do I save a Glest game?  I didn't know that was possible.

mictes

  • Guest
Re: Better CPU Ultra
« Reply #10 on: 31 October 2008, 18:55:33 »
Its possible just in GAE with "z"

daniel.santos

  • Guest
Re: Better CPU Ultra
« Reply #11 on: 1 November 2008, 01:18:04 »
A few more ideas for more settings to tune the AI.  Like the aggression setting, the growth, upgrade to military, scouting settings are more for personality than directly saying how effective the AI should be although a middle number is typically the most effective.  In a campaign, however, especially one that's scripted, tweaking these for various teams in the AI can make a huge difference.
  • Harvesting Efficiency: 0-1 -- A zero doesn't plan where it builds resource storing buildings (as the current AIs) and also arbitrarily decides what to harvest, where as one would put build storage buildings in the best possible places (near the largest and closest clump of resources) and also harvest based upon an analysis of it's needs (i.e., it figures out what units, buildings & upgrades it is going to produce in advance and tries to plan resources for them)
  • Upgrade to Military Unit Production: 0-1 -- The ideal for this would be a 0.5, the zero puts upgrades at priority over producing military units at all costs, only producing military units once all either all upgrades are completed or the resources to produce a military unit are available and no upgrades can be done at the moment (because the building is doing another upgrade, etc.) while one will never produce an upgrade unless it has the resources to do so at a time.  In some campaigns or other situations where there are other friendly factions nearby, it may also be optimal to use a higher setting for this (.8 or so) so that the full might of the faction is realized sooner, having a friendly faction nearby for protection during that vulnerable growth state.
  • Growth: 0-1 -- Zero is growing the base only as needed, one supports using recon to find new resources and take changes on building new camps, even when the base is unstable and it has no military units to defend the new base.  The optimal setting here is 0.5, only build new camps when the base is stable and a descent military force has been amassed to provide at least partial protection of the new base.  A setting of 0.25 would only build new camps when a very strong military has been amassed to protect the new base and setting of 0.75 would build new camps if there is at least a small number of military units to defend it.
  • Scouting: 0-1 --  Zero never scouts and one puts a very high priority on scouting, at the expense of keeping a force large enough to protect the base.  This is tied to military unit production, as it's usually the military units who do the scouting.  In the current AI, this is also directly tied to aggression, because the "attack" and "massive attack" AI rules are triggered by a scout obtaining visual on an enemy unit and the scout also always attacks.  However, the new AI should have the scout behave in a fashion that is most likely to help him scout -- by staying alive.  Thus, good recon is available to support the final setting.
  • Situation-Based Attenuation (of other settings): 0-1 -- Zero is none (all other settings pretty much remain static through the life time of the AI), one allows for the AI to use threat assessment to adjust growth and upgrade to military production settings.  Thus, as the AI will always have a "threat assessment" level that rates the overall threat it expects and a "confidence level" that rates how confident it is in it's threat assessment based upon time alive, reconnaissance and the knowledge (or lack thereof) of how many enemy factions it's playing against.  When the AI first starts out, having experienced no hostile units, the "threat assessment" will always be very green (the world is safe) but it's confidence will be very low, because it hasn't been alive long and it hasn't explored much.  As the game progresses, it will slowly raise the threat assessment anticipating that it's enemies are building up their offensive capabilities.  As the AI (or it's allies) scouts more of the terrain and gains greater visibility, the AI's confidence level in it's assessment rises but the threat assessment wont change much until an actual enemy base is spotted and reconed, this will cause a significant rise in the confidence level.  If the base turns out to be more fortified or protected by more military units than previously thought, the threat assessment level rises sharply.  If it turns out that the base appears under developed, appears to have been heavily attacked by another enemy, or especially if it's being currently attacked by another enemy, the confidence level rises sharply threat assessment level drops (correction: the confidence level will rise regardless of what is discovered). Using a combination of the threat assessment level and the confidence level, the AI can adjust growth and upgrade to military unit production dynamically.

EDITED 2009-09-07: to fix error.
« Last Edit: 7 September 2009, 22:26:20 by daniel.santos »

modman

  • Guest
Re: Better CPU Ultra
« Reply #12 on: 2 November 2008, 04:43:23 »
I got curious and found this.

The link, if you click on it, will take you to Wikipedia with a descriptive list of offensive military tactics.  A better CPU ultra may use one or two of these tactics.  It may not need to decide what strategy to use, per say, but the use of these tactics could definately make it more effective.

Also, a 'regrouping' ability for the CPU might solve this problem on its own.  And you could use this ability to implement this tactic.

Another thing I forgot (I will add it to the first list) is the ability to put melee units in the front and ranged units in the back.  And if a unit has a secondary melee attack that does not cost EP (if, of course the primary one does) then it should switch to that one.  And when it grows its EP back enough to make several ranged attacks (the amount should be determined by the speed of the regen and the attack damage), it should move back the same number it had to come forward to attack (thus putting it approimately in the back with the ranged units again) and attack.

daniel.santos

  • Guest
Re: Better CPU Ultra
« Reply #13 on: 2 November 2008, 06:42:53 »
Very cool link!!! :)

Yea, those are some very highly refined tactics and very difficult to code correctly.  What it really makes me think of, however, is the type of stuff I would like to maybe, one day, see path of reason in FPM be able to do with Generals -- by establishing a "command structure", they are able to coordinate units to behave like this, tanks staying up front and archers behind, on top of the entire battalion staying in this type of formation throughout a battle, being able to advance and retreat (a controlled retreat), while staying in formation and continuing to fight (tanks defending ranged units and ranged units continuing to fire while slowly retreating).  That would be something that both human and AI player could take advantage of, because coordinating something like that is impossible for a human, no matter how fast you can click (unless you pause over and over).

I like your train of thought, but I think it's a *lot* of coding.  The regrouping is much more realistic and I think it can be a good addition to a tactics list.  From an AI perspective, however, descent threat assessments and battlefield presence assessments must be made to determine if it's appropriate to engage a regroup AI rule.  You don't want to retreat and regroup if the enemy is faltering, you want to keep throwing everything you have at them.  So the AI needs to be able to assess how the enemy is doing, how it's own forces *on the battlefield* are doing and what other forces it has that are not on the battlefield.  Otherwise, if it's loosing the battle, but it doesn't have many more forces to throw at it, it might make more sense for the AI to simply retreat back to base and try to rebuild there.  OR, if you are close to their harvesters, it may be better to sacrifice your units and focus on destroying their harvesters instead of attacking the military units.

So you see, when it comes to actually implementing these things, there are a multitude of factors to consider.  For instance, what exactly is a battlefield?  From the AI perspective, you would probably have to take the coordinates of each unit that has been attacked or attacked an enemy over the last 15 seconds and average them to obtain the "center" of the battle.  Next, you would need to calculate it's basic perimeter because you don't want one unit who killed a scout somewhere to screw up the idea of where the battle is taking place, you want to be able to filter those out.  You may discover that you have more than one "front", so maybe you calculate it by using the visual range of each unit who's attacked or been attacked and if they are disconnected by more than, say 10 spaces, you consider it a separate battle front -- now you have to recalculate where the center of that front is because the center of all units who've been in combat over the last 15 seconds may not be good enough.  -- Then you have to tally up all of your units on each front, their average hit points, their total hit points, their total capacity to cause damage and the same for all visible enemy units (that can attack) -- that's how you end up with a battle field assessment (lots of code).  Next, you have to assess your opportunities.  Are a lot of your units low on health?  Are many of theirs low on health?  Do you have a chance to destroy some of their harvesters or other valuable units?  etc...

modman

  • Guest
Re: Better CPU Ultra
« Reply #14 on: 2 November 2008, 06:58:38 »
If the enemy is within sight, they will not be able to regroup.  They will attack.  But it would be nice to see an ambush (I already use this mysely by putting a Fury of the Tiki behind a corner; great defence against melee units because you can take tons of hits at them while the corner increases the perimeter of the path of least distance (A* pathfinding).  It would also be nice if a CPU new when to retreat.  It could compute like this: if you have lost more HP in the last 15 seconds than your opponent has, retreat back to your Castle or Mage Tower.

Do you know who designed the Faction Tech Trees for Magic and Tech?  Because they would be the ones to talk to if you want to do FPM well.

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: Better CPU Ultra
« Reply #15 on: 2 November 2008, 22:21:00 »
If these things are implimented, then the AI's extra resources when harvesting can be removed, since the AI would probably be more than smart enough then.

Also, make an easy difficulty for noobs with slower harvesting, and making less units.
Quote from: "daniel.santos"
A few more ideas for more settings to tune the AI.  Like the aggression setting, the growth, upgrade to military, scouting settings are more for personality than directly saying how effective the AI should be although a middle number is typically the most effective.  In a campaign, however, especially one that's scripted, tweaking these for various teams in the AI can make a huge difference.
  • Harvesting Efficiency: 0-1 -- A zero doesn't plan where it builds resource storing buildings (as the current AIs) and also arbitrarily decides what to harvest, where as one would put build storage buildings in the best possible places (near the largest and closest clump of resources) and also harvest based upon an analysis of it's needs (i.e., it figures out what units, buildings & upgrades it is going to produce in advance and tries to plan resources for them)
  • Upgrade to Military Unit Production: 0-1 -- The ideal for this would be a 0.5, the zero puts upgrades at priority over producing military units at all costs, only producing military units once all either all upgrades are completed or the resources to produce a military unit are available and no upgrades can be done at the moment (because the building is doing another upgrade, etc.) while one will never produce an upgrade unless it has the resources to do so at a time.  In some campaigns or other situations where there are other friendly factions nearby, it may also be optimal to use a higher setting for this (.8 or so) so that the full might of the faction is realized sooner, having a friendly faction nearby for protection during that vulnerable growth state.
  • Growth: 0-1 -- Zero is growing the base only as needed, one supports using recon to find new resources and take changes on building new camps, even when the base is unstable and it has no military units to defend the new base.  The optimal setting here is 0.5, only build new camps when the base is stable and a descent military force has been amassed to provide at least partial protection of the new base.  A setting of 0.25 would only build new camps when a very strong military has been amassed to protect the new base and setting of 0.75 would build new camps if there is at least a small number of military units to defend it.
  • Scouting: 0-1 --  Zero never scouts and one puts a very high priority on scouting, at the expense of keeping a force large enough to protect the base.  This is tied to military unit production, as it's usually the military units who do the scouting.  In the current AI, this is also directly tied to aggression, because the "attack" and "massive attack" AI rules are triggered by a scout obtaining visual on an enemy unit and the scout also always attacks.  However, the new AI should have the scout behave in a fashion that is most likely to help him scout -- by staying alive.  Thus, good recon is available to support the final setting.
  • Situation-Based Attenuation (of other settings): 0-1 -- Zero is none (all other settings pretty much remain static through the life time of the AI), one allows for the AI to use threat assessment to adjust growth and upgrade to military production settings.  Thus, as the AI will always have a "threat assessment" level that rates the overall threat it expects and a "confidence level" that rates how confident it is in it's threat assessment based upon time alive, reconnaissance and the knowledge (or lack thereof) of how many enemy factions it's playing against.  When the AI first starts out, having experienced no hostile units, the "threat assessment" will always be very green (the world is safe) but it's confidence will be very low, because it hasn't been alive long and it hasn't explored much.  As the game progresses, it will slowly raise the threat assessment anticipating that it's enemies are building up their offensive capabilities.  As the AI (or it's allies) scouts more of the terrain and gains greater visibility, the AI's confidence level in it's assessment rises but the threat assessment wont change much until an actual enemy base is spotted and reconed, this will cause a significant rise in the confidence level.  If the base turns out to be more fortified or protected by more military units than previously thought, the threat assessment level rises sharply.  If it turns out that the base appears under developed, appears to have been heavily attacked by another enemy, or especially if it's being currently attacked by another enemy, the the confidence level rises sharply.  Using a combination of the threat assessment level and the confidence level, the AI can adjust growth and upgrade to military unit production
    dynamically.
Genius!
Now here's the question: can you (and will you) do it? (And will it work for me? GAE currently doesn't! >:( )
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

daniel.santos

  • Guest
Re: Better CPU Ultra
« Reply #16 on: 3 November 2008, 10:54:40 »
Quote from: "modman"
If the enemy is within sight, they will not be able to regroup.  They will attack.
 You're still thinking inside the box.  We can do anything with the AI we choose to, including coding the AI to not automatically attack when they see an enemy unit.

Quote from: "modman"
But it would be nice to see an ambush (I already use this mysely by putting a Fury of the Tiki behind a corner; great defence against melee units because you can take tons of hits at them while the corner increases the perimeter of the path of least distance (A* pathfinding).
part of this battlefield awareness and new path finding I've discussed would put an end to this at higher AI levels.  Currently, the AI will attack whoever is closest, that wont neccisarily be the case in the future.

Quote from: "modman"
It would also be nice if a CPU new when to retreat.
*yawn* You can't regroup if you are too busy fighting.  Regrouping usually implies retreat.  I see that you posted the idea of "regrouping" as something to do on the way to an attack -- I say never let them get un-grouped  (loose formations next and, later, tight formations with all the cute patterns).

Quote from: "omega"
If these things are implimented, then the AI's extra resources when harvesting can be removed, since the AI would probably be more than smart enough then.
Precisely! Then we wont need a cheating AI, unless you configure it to cheat (as setting at the top of this thread).  More often I think will be the case is that the player will set their resources to harvest at 150% of normal. :)  (i.e, ADHD so severe that they started to play a game in windowed mode and then got distracted by somebody IMing, and they forgot they were playing a game :)
Quote from: "omega"
Now here's the question: can you (and will you) do it? (And will it work for me? GAE currently doesn't! >:( )
Yea, it can be done and I hope I get to do it.  Either way, I think it's important to have and maybe we'll eventually get some other programmers who get to feel comfortable enough to futs around with this code.  This stuff is a bit more on the back than front, but the path finding portions of it are very close on the agenda.

daniel.santos

  • Guest
Re: Better CPU Ultra
« Reply #17 on: 3 November 2008, 11:00:49 »
Quote from: "omega"
Now here's the question: can you (and will you) do it? (And will it work for me? GAE currently doesn't! >:( )

Wait, are you saying that GAE isn't working on your system?  If so, can you please post details on the Bugs in GAE 0.2.8 thread?

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: Better CPU Ultra
« Reply #18 on: 6 November 2008, 02:28:13 »
Ok... I'm gonna try Kubunta too, but I still don't know how to run this Linux version some guy compiled...

*posted*
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

modman

  • Guest
Re: Better CPU Ultra
« Reply #19 on: 6 November 2008, 05:11:53 »
I'll help you out...I'll upload my version of GAE; I think it has FPM instead of normal Glest factions...you can switch them out if you want.

daniel.santos

  • Guest
Re: Better CPU Ultra
« Reply #20 on: 6 November 2008, 13:31:47 »
Quote from: "modman"
I'll help you out...I'll upload my version of GAE; I think it has FPM instead of normal Glest factions...you can switch them out if you want.
We never replace normal Glest factions, they are always available unless you remove them.

modman

  • Guest
Re: Improved AI
« Reply #21 on: 20 November 2008, 01:11:58 »
Another idea: what if the AI could understand what it "needed" at that point in the game and go for that in the tech tree.
I know that's kind of what yo've already said before, but this is even more.  The AI would understand that its defence at that point in the game was horrible, and OMG if I get this upgrade I can get a really good defence unit, so I should gather the resources and get it.

Also (I know I said this before, but...) the AI would be able to gauge how much defence the new unit could give and compare that to that old one, and understand, for intance, if it needed air because the faction they were playing got air fast, and the old defence couldn't attack air.

PS did you download my faction?  The next beta comes out Friday!

daniel.santos

  • Guest
Re: Improved AI
« Reply #22 on: 28 November 2008, 17:18:04 »
Quote from: "modman"
Another idea: what if the AI could understand what it "needed" at that point in the game and go for that in the tech tree.
I know that's kind of what yo've already said before, but this is even more.  The AI would understand that its defence at that point in the game was horrible, and OMG if I get this upgrade I can get a really good defence unit, so I should gather the resources and get it.
Actually, I'm not sure that I said that exactly, not in the context you are.  Some upgrades are more valuable than others, commodities are not just the resources, but the time it takes to make them (game time) and the time that the building used to make the upgrade is taken (unit's time).  On FPM, once you can finally research Lingering Spirits, this is a big one because it gives you both Liches and Ghost Armor, a "big upgrade".  Robotics is big in tech because it gives you a new attack unit that you can make primarily from wood (while gold is being sucked down for horsemen and such).  So I can think of a few hacks (AI hints) for this, but in the end, the best solution is a complete analysis, which is expensive, but can just be done once every 10 seconds or so to keep CPU usage low (as if if were already low :).  Then we get into the realm of purely genetic algorithms and we go far out of my field of expertise!

Quote from: "modman"
PS did you download my faction?  The next beta comes out Friday!
Sorry, I haven't gotten a chance yet, I've been pretty tied up lately.

modman

  • Guest
Re: Improved AI
« Reply #23 on: 29 November 2008, 03:10:00 »
I have an idea.  What if there were a text document (XML) that told the AI what buildings it should build and under what conditions it should do so.  Like in the beginning, endgame, while under attack, when defence is low, etc.

Also, since you know the AI WAY better than me, there's this bug where the AI simply does almost nothing.  I think the problem is definately in the XMLs, but the game doesn't crash either.  I think the reason it does nothing has to do with the fact that they mine no, or limited resources.  Another wierd thing is that they will build farms (because the faction has a farm in it) but absolutely NO other building.  Also, since the worker-type unit could, sometimes they promoted themselves.  I absolutely KNOW this is a problem in the XMLs, and it was only in factions that probably made origanal XML documents, as opposed to using them from Tech or Magic as a template.  Help Please!!!

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: Improved AI
« Reply #24 on: 30 November 2008, 05:28:57 »
(Slightly) OT:
Ah, been wondering who'd finally pop the question.

That's what happened to military. Once when that happened, the game glinched so bad that the HUD dissappeared and I could zoom infinately (even into the ground and way high) The camera also got stuck in free mode.
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

 

anything