Light Style© by Fisana

Jump to content


Photo

Further AI development

ai aegis bot future plan

  • Please log in to reply
189 replies to this topic

#1 wraitii

wraitii

    Primus Pilus

  • WFG Programming Team
  • 1,664 posts

Posted 15 March 2013 - 01:24 PM

I'm opening a new topic since the API version 3 has now been committed. Kind of a conclusion on the past 2 weeks' work before I head back to school, and probably abandon developing 0 A.D. for a good 2/3 months. Warning: this is a huge wall of text, mainly intended for my own reading later, so that I may pick up where I left off without too much trouble :).

So basically I'm fairly happy of how much progress has been made on Aegis in these 2 weeks of holidays I got (on top of the work I did back then). Defense has been fixed to a fairly great extent, the attack has improved, the economy has learned how to deal with technology and phases without really losing much in terms of efficiency (there's room for improvement, though), and generally everything has been made more robust than it was before.

There is however still a lot to do, as most players and myself can already tell. I would like it if we could release a "Hard" AI that did not cheat. Currently hard mode cheats by gathering 33% faster (and very hard 66%). In order to do this, many things to consider:

First, the AI build order needs to be perfected. I've watched replays of mainly Quantumstate and Alpha123, but there is still work to be done, everything is not perfect. Furthermore the economy manager still isn't completely rational in the way it assigns workers, which makes the AI lose a few precious seconds now and the, but this is particularly problematic in the early game. Also, it doesn't trade.

Secondly, the AI is still very hardcoded. I've switched most of the "time" checks to "number of workers" checks but this is far from enough. The AI is generally hardly aware of itself when it takes decision, thus leading to average decisions, and mostly to a lot of trouble with unexpected cases. In particular, raiding the AI early currently tends to cripple it, as it does not recover well enough, trying to start attacks instead of focusing on rebuilding an economy, things like that.

Thirdly, building placement in general needs to be improved. the code for dropsite placement is in itself fairly efficient, and returns generally pretty good results. However, the code that decides when to build a dropsite is extremely inefficient. Placement of most other buildings is basically random with a few tweaks and doesn't really follow any particular logic, when it probably should.
Third big issue: the defense system is still quite flawed, both from the "no sense of self" effect of the AI, which will make it defend useless things, defend in obviously losing battles, or not defend enough when it ought to, and the many flaws in the logic. It's basically very "instant" defense, it doesn't really consider what happened in the past or what might happen. Case in point: a tower on the border near an AI dropsite will basically make it get all its workers killed as it doesn't really notice.

Fourth big issue(s): attack and unpredictability. The first subpoint is that the AI sucks at attacking. Basically it makes relatively balanced armies, but it sends them to the enemy and doesn't really consider how to use these units the most effectively, making its attack mostly useless against a skilled (micromanaging) player.
Secondly, the AI is extremely predictable. It has only one real "strategy", if you can call it so, which is also extremely hardcoded and not at all enemy dependent. Work on that is less of a priority, of course. The AI should probably handle the above points first, and then we will be able to consider making it actually do interesting things.

Finally, I'll post again the "to-do" list I had posted on the AI API version 3 topic back in early november, as most of the points are still valid :P

-No real naval support. It can handle attack over water, in a basic way, but that's it (Update: that actually might have become slightly buggy)
-No handling of multiple-island realms. For Aegis, its starting island is all there is on the map.
-No handling of the cases where the AI runs out of resources to gather. It will start lagging and clogging the queue manager. Linked with the above points.
-The defense system is really basic. It can't handle continuous frontier skirmishes, placement of defense buildings is not logical, no wall building, it's not reacting perfectly to attacks either. No sense of "this is a dangerous area, I should avoid going/collecting/building there". No support for building units that counter the enemy favorite units. So many other things...
-No diplomacy support (see Fexor's post in the general development forum)
-Economy is still perfectible: drop sites placement and building could be optimized, as could be building construction, or even Build Orders in general. There are some slightly insane behaviours here and then. Generally this is probably the area where the AIs hold up the best, particularly Aegis. (Update: see above.)
-Very partial technology support. Aegis goes up in phases, but it's not flexible. The API support for tech may not be perfect either. (Update: actually, it now researches all techs, but chooses them randomly. So work needs to be done on that).
-Partial attack system. It's OK at strategy, but bad at tactics and will generally attack inefficiently (though Aegis is better than qBot at that).
-no LOS/scouting support. AIs see everything. (Update: this is actually linked to making the AI react naturally: even when cheating, it should be aware of its enemies and take decisions based on them)
-optimization is far from perfect, though it's slowly getting better. Some possible improvements: hierarchical entity collection filtering, getting the AIs not to iterate over all units in a single turn once in a while but balance the load... (Update: probably better now, but there is still ton of room for improvements).

A last word about something that is still bothering me: the queue manager. Currently it gives "accounts" to each queue which grow over time as the AI collects resources. It works fairly well, but it has a tendency to make the AI sit on resources, particularly when the gathering rates are low and the needs high. I think going for the most human approach here is what would work best, but I must say I actually have little idea of what the "human" approach is.
Basically we might need the rest of the AIs to register what they will probably want to train/build in the next minutes for the future needs to be fairly stable (which will also help econ…). Then we need the AI to actually pass stuff, making sure it doesn't sit on tons of food just because the next item needs a little wood, and to do it with the maximal efficiency. I am not sure what the best system for that is, but I think the current queue system isn't quite perfect.

Edit: moved to general forum.
  • 3
Lancelot de Ferrière le Vayer [ aka Wraitii ]
Wildfire Games Programmer, AI developer, auxiliary map designer, dealing with anything water.
Contact me: wraitii@wildfiregames.com

Also the world's only three-dimensional poodle.

#2 Pureon

Pureon

    Primus Pilus

  • 0 A.D. Art Team
  • 3,655 posts

Posted 15 March 2013 - 04:00 PM

Thanks for the write-up wraitii (y)
  • 0

Pureon
0 A.D. Part time Designer / Texturer / 3D Artist
Contact email:
pureon{@}wildfiregames.com


#3 wraitii

wraitii

    Primus Pilus

  • WFG Programming Team
  • 1,664 posts

Posted 24 March 2013 - 08:23 AM

I just moved the topic from the dev forums to the public forum (removed posts about that too for readability). Copied, in spoilers, are 3 of my posts originally in the dev forums about some more specific AI stuffs. Again, I stress that this is mostly informative.

Defense:
Spoiler


Multi-base support:
Spoiler


Naval Manager
Spoiler

  • 1
Lancelot de Ferrière le Vayer [ aka Wraitii ]
Wildfire Games Programmer, AI developer, auxiliary map designer, dealing with anything water.
Contact me: wraitii@wildfiregames.com

Also the world's only three-dimensional poodle.

#4 scroogie

scroogie

    Discens

  • Community Members
  • Pip
  • 74 posts

Posted 24 March 2013 - 01:22 PM

Very interesting read. Its great to gain some insight like this!
Its already enjoyable to play against Aegis, although I noticed some glitches when I tried it yesterday. I played on Sahel Watering Holes and at some time the AI, apparently undaunted by death, intended to build a CC in one tight corner that was left neutral territory. Of course I had some defense at the entrance to my island, but it kept trying to squeeze through with a horde of workers and civil soldiers. So I guess the point "No sense of "this is a dangerous area, I should avoid going/collecting/building there"." is indeed quite important. Looking forward to even more great improvements!
  • 0

#5 Lion.Kanzen

Lion.Kanzen

    Nothing here

  • Community Members
  • PipPipPipPipPipPipPipPip
  • 6,655 posts

Posted 24 March 2013 - 01:46 PM

Great Work now, its more a challenge play against AI. and more variety. you make base of Developing of a great AI.
  • 0

Retired- Without Michael the project is not the same.


#6 sanderd17

sanderd17

    Primus Pilus

  • WFG Programming Team
  • 1,567 posts

Posted 24 March 2013 - 07:49 PM

the 'dangerous building site' problem is indded a very obvious one, but also the 'dangerous path to a safe location' is unknown. Sometimes, a location can be reached via 2 paths, and the AI makes the wrong choice.
Maybe some other thing, do you plan to make the easy modes more fun? Easy modes should also raid a bit more at the start of the game.
  • 1
Sander Deryckere [ aka sanderd17 ]

Wildfire Games programmer
Contact me: sanderd17 on gmail

#7 niektb

niektb

    Ritterbrüder

  • Council of Modders - Moderators
  • PipPipPipPipPipPip
  • 1,338 posts

Posted 22 July 2013 - 12:18 PM

Hi everyone,

My name is Niek, I'm 17 years old and I'm planning to join the programmers here.

I decided to start with the AI, because there aren't many of them and because I already know JS, but I can't find any documentation about the development of AI's with 0 A.D.

Can anyone provide some help?

P.S.:
Is this the right place to ask this sort of questions?

Edited by niektb, 22 July 2013 - 12:25 PM.

  • 0

Pleasure in the job puts perfection in the work. ~ Aristotle 
 

OysU6mp.png


#8 wraitii

wraitii

    Primus Pilus

  • WFG Programming Team
  • 1,664 posts

Posted 22 July 2013 - 12:29 PM

Hi Niek,
It's good to see new developers interested in the project. AI development is actually very undocumented, as nobody took the time to document it properly (in part because it changes a lot, and fairly often). There are a few things on the Wiki though here.
As lead AI developer (de facto), I'm working on Aegis (in the AI file, it's currently qbot-wc). I'm currently rewriting a lot of code on that too, so it's probably best for you not to start with that bot. If you want to get used to the code, check out how qBot works (in the AI files, it's the "qbot" folder, which includes the "common-api-v2" folder).
If you have any questions, PM me or try to catch me on IRC (#0ad-dev)

(it's not out of place, and there's no real place to ask this unless you want to post a proper application, in the dedicated subforum).
  • 0
Lancelot de Ferrière le Vayer [ aka Wraitii ]
Wildfire Games Programmer, AI developer, auxiliary map designer, dealing with anything water.
Contact me: wraitii@wildfiregames.com

Also the world's only three-dimensional poodle.

#9 Josh

Josh

    Duplicarius

  • WFG Programming Team
  • 380 posts

Posted 22 July 2013 - 02:45 PM

Only one thing I wanted to add. I've recently watched some 0AD gameplay videos, and on easy the AI still can be way too hard for beginning players. It might be nice to add an even easier "sandbox" level for those beginning players and maybe even replace some of the extra "easy" bots with the new "sandbox" difficulty on Aegis.
  • 1
Joshua B. [ aka Josh ]
"I can do all things through Christ who strengthens me."

Wildfire Games Programmer

Support Wildfire Games!

#10 Nolanjoker

Nolanjoker

    Sesquiplicarius

  • Community Members
  • PipPip
  • 154 posts

Posted 22 July 2013 - 03:17 PM

for a sandbox gameplay, the Ai can attack with small group of soldiers. and they never do military upgrades. and hsve s small economy.
  • 0
Si dice che nella vita gli esami e i guai non finiscono mai... ma delle file vogliamo parlarne? -- Giulio Castronovo da PensieriParole

#11 Pureon

Pureon

    Primus Pilus

  • 0 A.D. Art Team
  • 3,655 posts

Posted 22 July 2013 - 08:22 PM

Only one thing I wanted to add. I've recently watched some 0AD gameplay videos, and on easy the AI still can be way too hard for beginning players. It might be nice to add an even easier "sandbox" level for those beginning players and maybe even replace some of the extra "easy" bots with the new "sandbox" difficulty on Aegis.


This has been discussed within the team and is something that we (thanks wraitii ;) ) will work on. We want to ensure everyone gets to enjoy the game no matter the experience they have with RTS games.
  • 0

Pureon
0 A.D. Part time Designer / Texturer / 3D Artist
Contact email:
pureon{@}wildfiregames.com


#12 infyquest

infyquest

    Discens

  • Community Members
  • Pip
  • 66 posts

Posted 22 July 2013 - 08:31 PM

We need to work on a sea faring AI, before we can embark on this new quest.
  • 0

#13 Nolanjoker

Nolanjoker

    Sesquiplicarius

  • Community Members
  • PipPip
  • 154 posts

Posted 22 July 2013 - 10:09 PM

We need to work on a sea faring AI, before we can embark on this new quest.

good point, put we must wait the pathfinder first.
  • 0
Si dice che nella vita gli esami e i guai non finiscono mai... ma delle file vogliamo parlarne? -- Giulio Castronovo da PensieriParole

#14 niektb

niektb

    Ritterbrüder

  • Council of Modders - Moderators
  • PipPipPipPipPipPip
  • 1,338 posts

Posted 23 July 2013 - 01:17 PM

If you have any questions, PM me or try to catch me on IRC (#0ad-dev)


How do I post a PM here at this forum?

Edit: I'm going to start a thread.

Edited by niektb, 23 July 2013 - 01:19 PM.

  • 0

Pleasure in the job puts perfection in the work. ~ Aristotle 
 

OysU6mp.png


#15 greenknight32

greenknight32

    Sesquiplicarius

  • Community Members
  • PipPip
  • 167 posts

Posted 24 July 2013 - 11:30 AM

PM is very simple, click on the avatar of the member you want to PM to open their profile, click the "Send me a message" button there.
  • 0
Spencer Selander
(moss-encrusted mythic warrior)

#16 Pureon

Pureon

    Primus Pilus

  • 0 A.D. Art Team
  • 3,655 posts

Posted 24 July 2013 - 12:15 PM

How do I post a PM here at this forum?

Edit: I'm going to start a thread.


You could have just asked questions here to keep current AI discussion in one place...
  • 0

Pureon
0 A.D. Part time Designer / Texturer / 3D Artist
Contact email:
pureon{@}wildfiregames.com


#17 wraitii

wraitii

    Primus Pilus

  • WFG Programming Team
  • 1,664 posts

Posted 24 July 2013 - 04:46 PM

Okay, I'm posting the files to the upcoming version of Aegis for debugging. Please note that this will probably not work fully like expected, and please report any weird behavior and any errors.
I have not yet put back some optimizations I did for the earlier Aegis, so it'll probably be (slightly) slower too.
You will find it under Aegis (wc) in the game menu.

It's a bit of a hassle to install, sorry about that.
Unzip "simulation/components" in the "binaries/data/mods/public/simulation/components" folder.
Unzip "simulation/components/interface" in the "binaries/data/mods/public/simulation/components/interface" folder.
Unzip aegis.zip and common-api-v3.zip in "binaries/data/mods/public/simulation/ai"
Unzip ccmpAIManager.cpp in "source/simulation2/components". It's needed if you want to activate debug mode (which is currently on by default). You will need to recompile.

Attached Files


  • 0
Lancelot de Ferrière le Vayer [ aka Wraitii ]
Wildfire Games Programmer, AI developer, auxiliary map designer, dealing with anything water.
Contact me: wraitii@wildfiregames.com

Also the world's only three-dimensional poodle.

#18 sanderd17

sanderd17

    Primus Pilus

  • WFG Programming Team
  • 1,567 posts

Posted 24 July 2013 - 07:05 PM

It's a bit of a hassle to install, sorry about that.

You have something against diffs?
  • 0
Sander Deryckere [ aka sanderd17 ]

Wildfire Games programmer
Contact me: sanderd17 on gmail

#19 wraitii

wraitii

    Primus Pilus

  • WFG Programming Team
  • 1,664 posts

Posted 24 July 2013 - 07:24 PM

Yeah, for some reason I decided against that because there is a whole folder that's new.
I'll post a diff later today though, because it's not logical thinking.

edit: done.

edit2: actually I'll crash if you finish any foundation, I'll post a fixed diff later.

edit3: should work now. At least that is fixed.

Attached Files

  • Attached File  AI.patch   307.24KB   99 downloads

  • 0
Lancelot de Ferrière le Vayer [ aka Wraitii ]
Wildfire Games Programmer, AI developer, auxiliary map designer, dealing with anything water.
Contact me: wraitii@wildfiregames.com

Also the world's only three-dimensional poodle.

#20 infyquest

infyquest

    Discens

  • Community Members
  • Pip
  • 66 posts

Posted 24 July 2013 - 09:47 PM

any changelog for thispatch, so people can test for specific changes
  • 0





Also tagged with one or more of these keywords: ai, aegis, bot, future, plan