IPB Style© Fisana

Jump to content


qBot (yet another AI)


  • Please log in to reply
244 replies to this topic

#241 quantumstate

quantumstate

  • WFG Programming Team

  • Primus Pilus
    (1,072 posts)

Posted 10 July 2012 - 10:09 PM

Now a fuller reply. The only changes within the last month were trying to get the AI not to gather resources which it shouldn't so everything should still be relevant.

View Postalx-9, on 09 July 2012 - 05:43 PM, said:

Siege weapons: when creating an army to be sent to the opponent Civ Center, there should be more siege weapons. It would make it more challenging to defend against qBot's attacks. Right now its fairly easy to garrison inside buildings and kill off the enemy soldiers whilst they take an eternity to destroy a fortress/civ center.

Siege definitely need to be better as you say. Part of the problem is that qBot doesn't know how to use siege effectively and often walks it into a melee. I haven't tested siege properly since the attack priorities got implemented so hopefully they work better now than they did before. Increasing the priority is an easy fix to do for now, I will try that. Some special code for handling siege units is definitely necessary, though this might not be easy.

Quote

Garrison: related to the above, it would be great if qBot sent units into towers/fortresses/Civ Centers when under attack. That would increase their resistence to the player's attack. However, if there are siege weapons assaulting the buildings, then the garrisoned units should scramble out and destroy the siege weapons.

We chatted about this on irc a bit. To briefly summarize, garrisoning is desirable but implementing it without introducing serious exploits is non trivial.

Quote

Female evasion: female citizens should run away from enemy soldiers. Basically the sort of behaviour currently observed by some animals - I believe the deer run away from all human units?

Again this would be good. I'm not sure modelling deer is quite what should be done. It is very important to keep resource gathering going strongly. I played this strategy personally in AoE2 to counter rushes. The principle to keep in mind is always that you need it to cost the enemy more resources than it cost you. In this case the cost to the enemy is the production value of the soldiers whereas you spent the resources making your economy stronger. This means you have to rely on the strength of the buildings which provide a safe zone around your CC so the enemy can't catch up to your workers since they have to take a long way round. Construction of towers provides more safe zone, though garrisoning is also necessary for the safe zones to be properly effective. Also the bot should be producing soldiers while the raid is ongoing which should be possible since the defenders economy will be stronger if they have been playing equally well.

Quote

Target selection: in defence.js you assign defenders to a random enemy in the attacker's group. We thought it would be better if non-ranged units would select the nearest enemy (in the same attacking group). This would give them a better chance of inflicting some damage as you might get situations where a swordsman needs to cross a whole group of enemies to hit his randomly selected target. Ranged units on the other hand could select the strongest enemy. We used your built in getUnitStrength function to determine the strongest enemy. In case of multiple strongest enemies, just select the one who is nearest.
This would help with defence. One thing which I think is more important with defence though is to get the defenders to work in a group. Currently they head straight for the enemy so often they arrive gradually and get picked off one by one. Strength of numbers is a large factor in battles. Especially with ranged the damage dealt is proportional to the number of units. So for example if you send 2 groups of 5 they will deal just over half of the damage (assuming they focus fire) vs a group of 10 compared with sending one group of 10.

Quote

Training units: currently you train units of which the population has the lowest amount of. I assume this assures a nice variety of unit types (no one likes to fight against an elephant spammer...). However, we thought it would be nice if the AI tried to focus on training the stronger units. We attempted to use the getUnitStrength function here too, but since this part of the code deals with templates instead of entities we weren't able to succesfully implement it.

Key buildings: right now you only set Civ Centers to be key buildings (in defence.js). When unassigning defenders, you send them back to the nearest key building (currently only Civ Centers). Maybe you could add fortresses to the list of key buildings?

Patrols: finally, we had a go (but failed) at incorporating patrolling behaviour. Our idea was that we would use the entry points as a patrolling route. A group of soldiers (probably elite soldiers) would walk from one point to the other, guarding the territory. The group could wait a set amount of time at each point (say 10 seconds) and then move on to the next entry point. Eventually qBot will build fortresses on these entry points, at which point the patrol group(s) would simply be walking from fortress to fortress. I think it would be a neat defensive behaviour, as apposed to simply standing still somewhere. Further patrolling points could be Civ Centers and other important buildings.

Training could be improved. The game has not yet been balanced though so any system should be flexible enough to easily handle changes to the template data, so don't bother with lots of manual testing obviously. The templates contain all of the necessary information so you should be able to get this working. I could try and help if you still have problems. It might be necessary to modify the getUnitStrength function a bit.

Adding fortresses to the key buildings list sounds pretty reasonable. If you implement patrols this might become a bit redundant though.

We talked about patrols on irc as well. I think they are fine to do with units that would be idle anyway. I consider it to be low priority but patches are welcome. One thing which I thought of is that the entry points are only around the original base. It would be good to defend expansions as well. The fortress building logic could be improved in this respect as well.

Jonathan Waller [ aka quantumstate ]

Wildfire Games AI Scripter
Contact me: jonathanmarkwaller at gmail dot com


Support Wildfire Games!


#242 luziferius

luziferius

  • Community Members
    Pip

  • Discens
    (63 posts)

Posted 20 July 2012 - 02:03 PM

starting about midgame qBot has many idle units standing around resource dropsites (the units that return when a resource runs out)
it fact so many that it blocks of the dropsite and other units can’t drop their resources...
(I saw about 20 idle units blocking the dropsite and another 20 that can’t drop; thats not good for the bot’s economics)
qBot should do one of the following to resolve that
  • (better) retask the soldiers to attack and the females to gather some other resources
  • (at least a fix) task the idle units to walk a bit away so that they don’t block the dropsite
(I’m using the latest dev autobuild: "Jul 18 2012 - 12143-development")

Edited by luziferius, 20 July 2012 - 02:06 PM.


#243 alx-9

alx-9

  • Community Members

  • Tiro
    (4 posts)

Posted 05 August 2012 - 08:11 PM

Hey quantumstate, my friend and I have been busy with other stuff, including holiday, but we wanted to thank you for the reply.

Regarding the siege weapons, I think once qBot has a fortress (ie is able to produce siege weapons) it would make sense that a large portion of the attack group it deploys consists of siege weapons.
Maybe even evaluate the opponent's forces, like a balance between his soldiers and defence towers/fortresses. If he has more of the latter, then focus on training more siege weapons. If his defence consists of primarily units, then obviously less siege weapons are needed.


Female citizens could continue working in the presence of enemies, but I'd reckon it would be more realistic if they started fleeing as soon as the enemy attacks one of the nearby female citizens. At that point its clear the enemy is going to attack them so fleeing would be reasonable behaviour.

Defensive coordination would be neat. But there might be situations where you'd rather not walk as a group to defend. For example, if the group has some mounted units, would you really want them to move at the speed of of the slowest unit in the group? We hadn't thought of the effects of focus fire, although if the ranged units go after the 'strongest' enemy I guess focus fire happens automatically.


My friend and I still think patrolling behaviour would be great to have in 0 A.D. Although there is a slight problem, in that qBot 'cheats' a fair bit by using information it shouldn't have (from the perspective of a human player). If qBot can see where enemies are at any given moment, then patrolling wouldn't be the best defensive strategy - instead the AI could position all of its defensive units on the route the enemy.
I'm not saying cheating is bad, as it does make it significantly easier to implement stronger AI, but I'm interested what your view is on this. Do you think in the final release of the game it would be better to have an intelligent but fair AI? Or would the 0 A.D. community not really care how the AI works as long as it provides a challenge?

#244 ac892006

ac892006

  • Community Members
    Pip

  • Discens
    (30 posts)

Posted 06 August 2012 - 10:11 AM

View Postalx-9, on 05 August 2012 - 08:11 PM, said:




My friend and I still think patrolling behaviour would be great to have in 0 A.D. Although there is a slight problem, in that qBot 'cheats' a fair bit by using information it shouldn't have (from the perspective of a human player). If qBot can see where enemies are at any given moment, then patrolling wouldn't be the best defensive strategy - instead the AI could position all of its defensive units on the route the enemy.
I'm not saying cheating is bad, as it does make it significantly easier to implement stronger AI, but I'm interested what your view is on this. Do you think in the final release of the game it would be better to have an intelligent but fair AI? Or would the 0 A.D. community not really care how the AI works as long as it provides a challenge?


I think it is better to have A.I that cheats rather than an A.I which is unable to provide a challenge . I would also recommend the A.I be allowed to use cheat codes in-order to generate resources or troops when it is besieged this will make it even more challenging . This could be a stop gap measure till the 0ad team implements a stronger A.I .

#245 zoot

zoot

  • Community Members
    PipPipPipPipPipPip

  • Primus Pilus
    (1,475 posts)

Posted 27 August 2012 - 04:31 AM

On the scenario map "Massacre of Delphi", a huge regiment of qBot's units ends up hanging around the tavern in the northeastern corner of the map (probably because there is treasure 'inside' it):

Posted Image




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users