Author Topic: (done, give feedback!) letting cpu-ultra and cpu-mega fight more effective  (Read 1871 times)

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,240
    • View Profile
    • http://www.titusgames.de
Yesterday I experimented with the way different AI types attack in fights.

What I did is, I told the CPU-ULTRA/MEGA to first attack standing, not running units in firering range ( only regarding fighters of course ).
I made it a bit random if this new logic is used or the old one where only the nearest enemy unit was choosen.

To show an example of the new logic:
Imagine you have an swordman and an archer attacking you and you have 2 archers. As long as the enemy swordman runs over to you the archers will now attack the enemy archer which is also in range, as its eaier to hit standing units. Once the swordman has arrived they will start to fight the swordman, as its the nearest enemy unit with an attack skill.

I first thought the AI would play very evil wiht this, but it was ok in singleplayer. So I tried it with tomreyn, but we always got out of syncs up to now, so its now commented out in the code :/
« Last Edit: 5 June 2012, 09:16:49 by titi »
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

Ishmaru

  • Behemoth
  • *******
  • Posts: 1,071
  • um wat??
    • View Profile
    • DelphaDesign
Re: letting cpu-ultra and cpu-mega fight more effective
« Reply #1 on: 31 May 2012, 20:11:47 »
That's too bad it caused sync errors...

How about haveing ai puting  priority on units with an attack skill? At least on annex there are times where ai gets demolished by a single turret because they are targeting a defenseless unit with high hp. This way ai will target all defenses, warriors first before destroying structures/workers.  This should make ai better and more believable.
Annex: Conquer the World Release 4 For Pc Mac + Linux
https://forum.megaglest.org/index.php?topic=9570.0
Annex is now on Facebook!
https://www.facebook.com/AnnexConquer

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,240
    • View Profile
    • http://www.titusgames.de
Re: letting cpu-ultra and cpu-mega fight more effective
« Reply #2 on: 1 June 2012, 16:18:32 »
The AI already does something like this, the problem is the attack range of different units.
If you have a unit with attack range 5  it will first attack all units in its attack range which have attack skills. After this it kills the others. But if there is a unit outside the attack range which itself has more attack range like 7 and always shoots at our unit, the unit will not attack this, as its first cleaning its firering range ....
« Last Edit: 3 June 2012, 20:57:19 by titi »
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

Ishmaru

  • Behemoth
  • *******
  • Posts: 1,071
  • um wat??
    • View Profile
    • DelphaDesign
Re: letting cpu-ultra and cpu-mega fight more effective
« Reply #3 on: 1 June 2012, 17:47:26 »
It doesent really feel like it though...

Maybe targets should be chosen through sight range instead of attack range? Is that possible?

Or Perhapse a code that would have unitA target prioritize units that are attacking from outside unitA's range?
Annex: Conquer the World Release 4 For Pc Mac + Linux
https://forum.megaglest.org/index.php?topic=9570.0
Annex is now on Facebook!
https://www.facebook.com/AnnexConquer

treba

  • Guest
Re: letting cpu-ultra and cpu-mega fight more effective
« Reply #4 on: 2 June 2012, 09:19:26 »
i think most recent games handle it somehow like this:
-unit a attacks everything within its range
-if there's no enemy with attack skill within range, but unit a gets attacked from outside its range:
  -it will "call" units close to it to whom apply the same conditions (no enemy with attack skill in range)
  -together they move in the direction of the attacking unit, attacking only units with an attack skill
  -when they attacked a unit on their way, they will stop after they killed it and continue attacking everything within range
  -this gets triggered again when the unit, that initially attacked unit a, attacks again

hope this is somehow understandable :)

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,240
    • View Profile
    • http://www.titusgames.de
Thanks to softcoders help my initial idea is now available in svn. Please play it and tell me what you think.
Is cpu-ultra now fighting too hard or is it ok? I mean the difference between cpu and cpu-ultra wasn't that big before, now I think, its more different ;-D.

@uuu/derek and friends, now ultra/mega should play a bit harder, have fun  ;D

( @treba: I think it is already a bit like you describe it. )
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

carolinus

  • Daemon
  • Posts: 8
    • View Profile
Hi,
i'm not too good player thus my opinion may be not so very helpful :)

I often play as indian. (never rush attack vs CPU - which is indian  power  at beginning of game)
Regular version: on some maps i can win with 1xCPU mega 2.5-3.0 or with 2 x cpu 1,5; sometimes vs 2 x CPU2,0
New dev version: yet I have not found the map on which I could win vs 1x cpu 2.0 (indian vs cpu romans)

conclusions: now CPU mega is too much for me - so i must get more experience... or set CPU less than 1.5 to have a fun :P

--
#191319 win7 home 64/ lubuntu 12.04 i686 Pentium b940 /graph: hd3000

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Regular version: on some maps i can win with 1xCPU mega 2.5-3.0 or with 2 x cpu 1,5; sometimes vs 2 x CPU2,0
New dev version: yet I have not found the map on which I could win vs 1x cpu 2.0 (indian vs cpu romans)

conclusions: now CPU mega is too much for me - so i must get more experience... or set CPU less than 1.5 to have a fun :P
Well, if the AI works well, you should not be able to defeat it on a 2x multiplier. Theoretically, it should have twice the units you'll have. The task is really just how much the AI can be improved so it doesn't have to cheat to be challenging. So if you're a self described "not too good player", being unable to defeat a single 2x AI player should be a sign that we're slowly approaching a reasonable AI. :thumbup:
Edit the MegaGlest wiki: http://docs.megaglest.org/

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

victorj

  • Guest
The great bad thing that I think is the control of the CPU with magic they seem to be the worst CPU playing "For me, Magic is a faction considered unusual among other" CPU handles it very poorly related to online players.  ;)
« Last Edit: 6 June 2012, 22:04:34 by victorj »

Ishmaru

  • Behemoth
  • *******
  • Posts: 1,071
  • um wat??
    • View Profile
    • DelphaDesign
Considering that this is ment to improve Ai of ranged units, I'm sure Magic benifits from this update as well.

Btw this does NOT affect human controled units right?
Annex: Conquer the World Release 4 For Pc Mac + Linux
https://forum.megaglest.org/index.php?topic=9570.0
Annex is now on Facebook!
https://www.facebook.com/AnnexConquer

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,240
    • View Profile
    • http://www.titusgames.de
sorry for the late reply, no it does not effect human controlled units.
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

 

anything