Jump to content
Sign in to follow this  
quantumstate

qBot (yet another AI)

Recommended Posts

I recorded a video showcasing qBot's new defense:

The guys are still working on AI improvements for Alpha 8 release, but even now the AIs are looking very promising.

While defense is impressive the defeat was largely due to a flawed strategy . You can defeat qbot with half the no of units Simpley don't attack structures directly instead just use siege weapons to take down one tower at a time systematically and eventually the main civ center . What you did was to throw a huge number of units at qbot's main civ center . You went deep into its territory without destroying most of the towers hence the defeat .

Share this post


Link to post
Share on other sites
This will of course change once we implement Settlement Phases (Ages).

On the concept of Ages. I was thinking that maybe instead of simply copying AoE's Age concept you could add a little twist to that:

It is obvious that some sort of über-techs like Ages should be implemented as they let the player advance through the course of a match. However, instead of recycling the concept of a handful of Ages that unlock a huge range of techs and units across the board, it would possibly be cooler to have certain techs that are meta-techs as well but that unluck only a specific branch of new techs/units, e.g. something like 'iron smelting' for a range of military improvements/units, something like 'geography' for trade, diplomacy and scouting. 'Iron smelting' could be followed by 'Marian reforms' (or a more multicultural name, whatever) that enables the next line of military improvements/units, and so forth. Units/buildings could visually show improvements when you have researched an über-tech that affects them ('iron smelting' may change the appearance of military units, but not of buildings; for, say, 'masonry' [possibly unlocking building improvements/new buildings] it would be the opposite).

This way you could have more über-techs than 'just' four Ages (each being a bit cheaper than Ages of course), say ten or so, allowing the player to specialize in some fields over the course of the game, and it'd emancipate 0AD from AoE as well :). Key to this would be simplicity though; avoid cross-references in the techtree, clearly indicate the techs/units that will be unlocked by each über-tech, etc.

Has there already been a discussion on Ages etc. so far?

Edited by Android GRRR

Share this post


Link to post
Share on other sites

While defense is impressive the defeat was largely due to a flawed strategy . You can defeat qbot with half the no of units Simpley don't attack structures directly instead just use siege weapons to take down one tower at a time systematically and eventually the main civ center . What you did was to throw a huge number of units at qbot's main civ center . You went deep into its territory without destroying most of the towers hence the defeat .

ac892006 I agree with you, but I was aiming to showcase qBot's new garrison defense ability, not show everyone how amazing I am at hurling rocks ;)

Here's a full singleplayer gameplay video against qBot:

(viewed best in

)

Share this post


Link to post
Share on other sites

I think the bots need to put up new expansions by the 10 minute mark. Then every 5 minutes after that.

I tend to prefer doing things based on situation rather than time, so if it has been attacked early it doesn't spend resources uselessly on tactical expansions but I can aim to have to happen at about the 10 minute mark for a typical game. Where do you think would be good for the placement of the expansion? Aiming for resource concentrations is the obvious thing, but how far away should they be. Do you aim to keep a continuous area of territory or aggressively build near the enemy to restrict them more?

Also I have recently committed two significant military improvements. Now qBot will retaliate when you attack its offensive troops so you can't just ambush its troops easily like before. Also I put in some path randomization code so the assault could come come from any direction.

Share this post


Link to post
Share on other sites

Also I have recently committed two significant military improvements. Now qBot will retaliate when you attack its offensive troops so you can't just ambush its troops easily like before.

sounds like a good improvement. but i don't understand it exactly:

will qbot attack shortly after you've defended yourself against his offensive troops? or will he always keep some defending troops at his base?

thx!

lookin forward to the final version for alpha 8 ;)

Share this post


Link to post
Share on other sites

sounds like a good improvement. but i don't understand it exactly:

will qbot attack shortly after you've defended yourself against his offensive troops? or will he always keep some defending troops at his base?

When it sends it's attacking force towards the enemy base, the attacking force defends itself if attacked - what happened before is it would just continue to walk along while all it's troops were being killed until none were left.

I tested the latest version - it attacked me very early and then built up a very large infantry force and attacked me from 2 different angles. It also built a fortress in the middle of the map, and used it's expanded areas to build scout towers and economic buildings. Good to see!

Share this post


Link to post
Share on other sites

"Check for resource accessibility, stops the game lagging due to too many pathfinder requests." :cheers:

Notable improvement? I hope the FPS hiccups decrease :)

Share this post


Link to post
Share on other sites

"Check for resource accessibility, stops the game lagging due to too many pathfinder requests." :cheers:

Notable improvement? I hope the FPS hiccups decrease :)

This does not generally improve performance, it removes extremely bad performance in certain unusual cases. Performance shouldn't be too bad currently, in late game I find that the pathfinder is more significant. Also performance should be improved by a new API fairly soon.

Share this post


Link to post
Share on other sites

qBot is now in svn. Unfortunately due to me being rubbish with svn I managed to commit it with no commit message. I will post an update of what features are planned soon.

20 lashes for you!

Share this post


Link to post
Share on other sites

Hmm I think Atlas needs a "default" AI setting in the player panel, so that it doesn't always manually set the AI. It's going to be a pain to update all the maps if we want qBot as default :( The intent was that it would only set the AI if the map designer explicitly wanted that, and usually player_defaults.json would be used for default player settings, but that's not how it works now.

Share this post


Link to post
Share on other sites

Hmm I think Atlas needs a "default" AI setting in the player panel, so that it doesn't always manually set the AI. It's going to be a pain to update all the maps if we want qBot as default :( The intent was that it would only set the AI if the map designer explicitly wanted that, and usually player_defaults.json would be used for default player settings, but that's not how it works now.

Agreed. That would be good.

Share this post


Link to post
Share on other sites
It's going to be a pain to update all the maps if we want qBot as default

All it should need is "sed -i s/jubot/qbot/ *.xml" which doesn't sound too much of a pain :)

Share this post


Link to post
Share on other sites

I have code snippet to sort the targets based on distance to the attack troops

the code change is below:

In the after the line 55 in attackMoveToCC.js, add the following lines


//Sort targets based on distance
targets = targets.toEntityArray().sort(function(a, {
var pos = pending.getCentrePosition();
return (VectorDistance(a.position(),pos)-VectorDistance(b.position(),pos));});

I have tested the code long back, please you also test this and commit

Edited by infyquest

Share this post


Link to post
Share on other sites

I have code snippet to sort the targets based on distance to the attack troops

I have tested the code long back, please you also test this and commit

One thing I am not sure about is whether this is a good thing for the AI to do. Can you explain why you think it would be a good tactical decision? From my point of view there should be several attack modules, one should be a raider which targets economic units sending small groups especially early in the game, another should aim for training facilities to damage their military capacity and there should be an all out base destruction on which tries to flatten everything, aiming for the CC seems sensible for this since destroying it removes the territory, effectively forcing the defender to build a new one or surrender the base.

Share this post


Link to post
Share on other sites

currently we are targeting all the conquest critical buildings first

like CC, fortress, towers (not so sure),........

attack and destroy the nearest defensive building or CC or important building, then go for the rest.

deplete the defenses, then military buildings and CC to last

Share this post


Link to post
Share on other sites

Sorry for being a little bit out-of-topic, but I'd like to follow your development and maybe even learn a little bit or gain some experience. What IDE's or editors are you using?

Share this post


Link to post
Share on other sites

currently we are targeting all the conquest critical buildings first

like CC, fortress, towers (not so sure),........

attack and destroy the nearest defensive building or CC or important building, then go for the rest.

deplete the defenses, then military buildings and CC to last

This might be worth having, but the problem that I see with this is that static defenses are primarily designed to kill/slow down an enemy. So if you can get to the rest of the enemy base without being significantly damaged by the defenses then that means the enemy wasted effort/resources on defenses that were useless. Fortresses might be worth attacking because they also train units, the value of them as training facilities needs to be considered. So unless a defense is a threat to something we are trying to do (e.g. blocking the route into a base or encroaching on our own territory (I'm looking at you Pureon :sly:)) then we should avoid attacking them since we are wasting time which could be spent attacking more valuable targets.

Sorry for being a little bit out-of-topic, but I'd like to follow your development and maybe even learn a little bit or gain some experience. What IDE's or editors are you using?

I use eclipse JS Helios (I found the latest version too buggy on linux) it has the best javascript code support of any IDE I have tried . You could use pretty much any editor you want and find most comfortable. I also quite like Geany.

Git is the most useful tool, using it with git gui is fairly straightforward and will help you keep up to date with the latest changes.

Share this post


Link to post
Share on other sites

I thought it would be helpful to summarize future priorities for qBot, this is mainly a compilation of suggestions from people posted here (mainly Pureon). Currently I am prioritizing military improvements since the economy is fairly strong (also units look at the distance of a resource from a dropsite now, due to a recent change) relative to the military side. I think that military improvements should make it more fun to play against as well.

  • When defending it's territory, the defending soldiers walk all the way to the enemy base when enemy soldiers retreat. This is a bug in my code since I tried to fix it but it failed.
  • Starting cavalry/early trained cavalry are not used effectively. I plan to put in a form of economy raiding attack (though limited a bit to try and stop it form being annoying) which will use these. Also they could be used for meat gathering longer term.

  • The attacks should be less predictable, maybe sometimes the attacking force can divide into smaller groups, like Jubot does, and attack a number of targets. This has had some improvement with my new random attack directions code, target selection will be made more variable, especially with the new attack types planned. As you may have picked up I am of the opinion that splitting up offensive forces is a risky move that should be carefully considered so in some cases qBot might split its army but not often.
  • The AI should take more territory mid-late game - and push forward with a fortress or a few forward towers. It should aim to control the map and remove the resources available to enemies. This is a fairly big task to do well, consider it a long term goal.
  • Any starting resource treasures (those nearby the CC) should be gathered immediately, It could collect treasures throughout the map - these are an instant boost in resources. Infyquest is looking into this currently.
  • It appears to begin gathering metal and stone at the start, perhaps it should focus on food and wood to build a larger workforce. This is fairly minor, it should be improved but doesn't have too much of an impact currently.
  • Place structures in more suitable positions depending on their role. This is being worked on, I have written most of the enabling code for it. This should also help with multiple starting base maps where placement is pretty poor.
  • Use siege effectively. This would allow the bot to destroy bases much more effectively, will probably be a new attack module. This might help fend off tower rushes as well.

Share this post


Link to post
Share on other sites

Just thought of another thing, it would be great if qbot would be able to barter, that way it could survive even if an enemy at that point is surrounding it and it has used used up all nearby wood, but there is plenty of stone and metal (and more long-term food, but if it hasn't resolved this particular issue by that time it probably has no chance). Not sure how much it would take to get it to do that though, and in general I'd say it's better to focus on expansion so it never finds itself in that situation. Just something to keep in mind.

Once trade is in qbot should definitely use that though, I'd say that should be higher priority. Both because that actually produces resources (compared to barter which just converts them to get you out of a tricky situation etc) and because it would be great for interacting with other players in a non-combat way (and even if you're not allied with qbot trade routes would be either a nice target or at the very least they'd make the map more alive :) ).

Share this post


Link to post
Share on other sites

Thanks for the summary ;)

Some possible additions:

  • Place foundations in safe areas - It shouldn't place new foundations where the enemy has already destroyed multiple building attempts.
  • Long range siege defense - It should be able to defend itself better against rock throwers.

qBot is already doing really well - It's much less predictable and does expand throughout the map (y)

Share this post


Link to post
Share on other sites

A bit off topic: I would be happy if there was some source of information about how all the relations between the AI programming and the game engine, and some theoretical explanation of how each bot is programmed.

I'm a programmer, and took a look at the JS. Although there where lots of comments in the code, I still got comfused. My main question was "What is calling these functions and when?"

I can't promise anything, but I like this game and if I will have the knowledge and time I might contribute something.

:)

Thanks

Share this post


Link to post
Share on other sites

A bit off topic: I would be happy if there was some source of information about how all the relations between the AI programming and the game engine, and some theoretical explanation of how each bot is programmed.

I'm a programmer, and took a look at the JS. Although there where lots of comments in the code, I still got comfused. My main question was "What is calling these functions and when?"

I can't promise anything, but I like this game and if I will have the knowledge and time I might contribute something.

:)

Thanks

A little while back I wrote https://github.com/quantumstate/qBot/wiki/qBot-Structure-Overview which is a summary of how qBot works. I scanned over it quickly and it all seems to still be accurate although some new parts of the code aren't mentioned. If you are confused by any parts (which is pretty likely, given my documentation) please ask further questions.

Share this post


Link to post
Share on other sites

A minor suggestion, I notice qBot gets attacked by animals sometimes, but often the victim is a ranged unit that can never fight back because they have a minimum range and the animal is fast enough to take advantage with a melee attack. Anyway it looks very strange and always catches my eye :) Would it be possible to detect this and flee, or perhaps order a group attack? I guess this problem affects all ranged units really, so perhaps qBot should detect when a ranged unit has a melee unit attacking them within minimum range.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...