Light Style© by Fisana

Jump to content


Photo

A challenger appears : Marilyn (Yet-yet another AI)


  • Please log in to reply
159 replies to this topic

#41 wraitii

wraitii

    Primus Pilus

  • WFG Programming Team
  • 1,665 posts

Posted 21 February 2012 - 09:02 PM

Okay, so I worked most of the day on Marilyn... I think it did some good... I've seen it once crush qBot in 25 minutes, but that seemed to have been a lucky strike... Overall, she's now much more resilient, and again, I've laid ground for further upgrades
New stuff (basically):
-fixed Fortresses building improperly.
-Houses are now far away and more concentrated.
-Attack Plans can now continue during an attack, or be used properly by the defense manager.
-The Defense manager is overall more efficient, and able to detect attacks better. I've also laid grounds for different types of attack recognition, though it's not yet implemented.
-Ability to take care of annoying animals attacking citizens. To playtest this, check out Sahel Water Holes: Marilyn deals with the elephants (particularly true for player 3). This makes her MUCH more efficient than qBot on this particular map.
-Attack plans keep their tactics manager over several turns. Thus they should work better, I'm not sure what effect if has but it can only be good.
-refined a few stuffs in the queues to make everything easier, and made Marilyn build units for plans by batch of 3 and not 1
-Added a few stuffs here and there.
edit: see post below.

Overall, I did a few test drives, and I'm finding Marilyn much more resilient against the mighty qBot (alpha 8). She's more rarely defeated and I've seen fairly clear victories. On maps where animals are threat, she will now be much better than qBot.

There's a lot of tweaks to do (she builds too many fortresses, for example, and more importantly: making the defense manager understand that attacks too far away should not be pursued.), but I think I'll be able to actually add some stuffs in the next days (early scouting, raiding against villagers, this sort of things).

Edited by wraitii, 22 February 2012 - 08:36 AM.

  • 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.

#42 wraitii

wraitii

    Primus Pilus

  • WFG Programming Team
  • 1,665 posts

Posted 22 February 2012 - 08:35 AM

Okay, some more bugfixing... Apparently there was a problem with javascript interpreting my variables as pointers, and a few stuffs I forgot to do in the tactics manager.
There are still a few bugs left when the attack manager can't find a path to the enemy, but those should basically only happen after said enemy's death so not a serious problem.
The tactics manager (ie battle manager) is now designed so that units will only change target once their former target is dead (works much better).

Did some more testing on Sahel Watering Holes, the map being crowded with elephants and nasty fauna... And Marilyn is definitely much stronger than qBot on that map, thanks to the new "animal killing" capability she has. She always defeated qBot (or both qBots, actually, but in this case they simply annihilated each other) in under 30 minutes (and it was basically over after 25).

edit: see below

Edited by wraitii, 22 February 2012 - 05:25 PM.

  • 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.

#43 Echelon9

Echelon9

    Discens

  • Donator
  • 87 posts

Posted 22 February 2012 - 10:17 AM

Would be good to pit your latest Marilyn against the (improved and stronger) qbot in SVN.I believe you're on Mac, so there's some pointers in the current first page thread on getting an 0AD Mac .app up and running from SVN. I'm primarily Mac too so can give some advice if you have trouble.
  • 0

#44 wraitii

wraitii

    Primus Pilus

  • WFG Programming Team
  • 1,665 posts

Posted 22 February 2012 - 12:50 PM

Shall try, but I'll fix the trouble I'm having with the queue manager with (seems like Marilyn sometimes stops buildings citizen soldiers, and a few weird stuffs).
  • 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.

#45 UV_Completion

UV_Completion

    Discens

  • Community Members
  • Pip
  • 16 posts

Posted 22 February 2012 - 02:58 PM

Did you (re)consider putting your code in a public git/svn? This would make testing it a bit easier.

One of your latest revisions contained a .git-folder. This was an accident, I guess?
  • 0

#46 wraitii

wraitii

    Primus Pilus

  • WFG Programming Team
  • 1,665 posts

Posted 22 February 2012 - 03:39 PM

Actually, I tried yesterday, but I ran into a problem... I think I'll try to figure it out later on though, because it could indeed be useful.

I've discovered a really crazy amount of bugs in my defense manager and my economic managers, that should now be fixed, so I think I'll do some testing and release another version... Then try to test against the SVN, and use git.

I also did a few changes to the queue, basically: after 30 seconds, queues raise in importance with time (ie older queues are given priority)
  • 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.

#47 wraitii

wraitii

    Primus Pilus

  • WFG Programming Team
  • 1,665 posts

Posted 22 February 2012 - 05:25 PM

Okay, so here's the fixed version. I think the next update will be in more time, since it seems like whatever I will add now has to be fairly significant.
This fixes many insidious bugs in many things, but mainly the defense and the attacks. As a result, Marilyn works overall better ate defending, and at attacking too.

I've also slightly updated the queuemanager: things that have been in the waiting queues for more than 30 seconds will gradually become more important, and this helps reducing a phenomenon I encountered which was "in the endgame, Marilyn builds no citizen soldiers and few villagers".

Did a few further testings, on Serengeti... Fixed a house building bug by the way. Marilyn generally behaves on par or better than qBot. On Oasis, Marilyn/Hellenes vs qBot/Persians is won by Marilyn in about 30 minutes. The other way around is perhaps more to the advantage of qBot, but it appears qBot behaves better with the Persians, while Marilyn does pretty much the opposite.

On most other maps, I expect the results to be about the same, with perhaps a slight advantage for Marilyn. On maps where animal are a threat, Marilyn is the clear winner.

Download link

Oh, and I've figured git out, too. I'll get the qBot from SVN and play against it (couldn't manage to compile SVN, but with a very benign tweak svn qBot should work on alpha 8).

edit:darn, forgot to check out a debug in plan_building.js ... Search for "obstructionradius" and remove the debug.

Attached Files


Edited by wraitii, 22 February 2012 - 05:41 PM.

  • 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.

#48 Mythos_Ruler

Mythos_Ruler

    Senator

  • WFG Retired
  • 14,967 posts

Posted 22 February 2012 - 06:24 PM

A whole slew of errors once the AI's Civ Centre is taken down.
  • 0

#49 wraitii

wraitii

    Primus Pilus

  • WFG Programming Team
  • 1,665 posts

Posted 22 February 2012 - 07:33 PM

Could you quote the log, just for information?
  • 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.

#50 gudo

gudo

    Duplicarius

  • Community Members
  • PipPipPip
  • 239 posts

Posted 23 February 2012 - 01:07 AM

Another update to the common api:
http://trac.wildfire...changeset/11121

Perhaps there's some space to simplify your code? The other update is here:
http://trac.wildfire...changeset/11067
  • 0
Did you contribute to 0 AD?
Make sure you're in the credits!


AI Players
JuBot | RootBot | SplitBot | qBot | Marilyn | arBot

#51 wraitii

wraitii

    Primus Pilus

  • WFG Programming Team
  • 1,665 posts

Posted 23 February 2012 - 10:20 AM

There is certainly space to simplify my code, even without any API changes... I've modified stuffs from qBot while not necessarily removing them, changed things, made some pretty idiotic design choices now and then (It's now changed, but I asked the "game" for the entity associated with an ID... By asking said entity to give its ID. In other words, I asked for informations I already had while using it).

I'll try to clean the code, to remove most errors, and to optimize the code for the next version... I'm currently cutting the map into smaller squares for the economy manager so it won't have to loop through every resource on the map each time it wants to assign a unit a task... It's working much faster (on Gambia river, a forest-ridden map, it's at least twice faster for each unit, so it's quite quickly 5 or more times faster), but it demands quite serious code change.

Edited by wraitii, 23 February 2012 - 10:23 AM.

  • 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.

#52 wraitii

wraitii

    Primus Pilus

  • WFG Programming Team
  • 1,665 posts

Posted 23 February 2012 - 09:40 PM

Allright, I've decided to upload this newer version a bit early, mainly because it's fairly interesting... The main feature is speeding up of the "reassignIdleWorker" function, by dividing the map into subsquares and looking in those. It's really much much faster on maps where there are tons of trees involved. On Gambia River, this newer version is easily 5 times as fast as qBot, sometimes more. There doesn't seem to by any bug left, though if you notice any "dodgy" behavior in the "looking for resources" area, let me know.


Other things I did: clean up of the code, I removed many unused functions that were left-overs from qBot or early development... Actually implemented garrisoning citizens in case of major attacks. I did a lot of fairly small "sanity checks" that should remove most of the "error: whatever is undefined" errors, though I'm not sure I got them all. Fixed a little bug that could happen on some map with houses.
(BTW: qBot should have a check in "accessibility". If the "start" point is undefined, there's an error).
So now I can start the more interesting stuff, such as actually adding features.

Download Link


Edit: bug noticed thanks to Pureon. It's not a gamebreaker but you'll get a ton of error messages if you garrison a soldier:
Fix: line 378 of defence.js, add:
if (enemy.position() == undefined)  // unit is likely garrisoned. DO not check.
continue;

Line 428 of "attack_city.js"
if (enemy.position() == undefined) // likely garrisoned
continue;

In defence.js, line 200, replace the if condition by this one:
if (enemy.owner() == ennemiPotentiel.owner() && enemy.id() !== ennemiPotentiel.id() && enemy.position() !== undefined)

Edited by wraitii, 24 February 2012 - 09:14 AM.

  • 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.

#53 Pureon

Pureon

    Primus Pilus

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

Posted 23 February 2012 - 10:57 PM

I'm not sure I noticed a performance improvement over qBot, but Marilyn did fight very well indeed.

I was getting quite a number of errors and warnings though:
http://pastebin.com/QmZetcv6

Match was on the new Punjab map with Marilyn as player 1 Hellenes.
  • 0

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


#54 wraitii

wraitii

    Primus Pilus

  • WFG Programming Team
  • 1,665 posts

Posted 23 February 2012 - 11:15 PM

To notice the speed improvement, you'd have to check the profiler on time warp. It becomes very obvious then (otherwise, this function is called once every 10 turn so it's not that noticeable)

These errors are very weird... Apparently, enemy units that are supposed to exist don't. I see absolutely no reason why... Any particular action that was happening when you got those (attacking marilyn, destroying her?)

The warnings are "normal" debug warnings, though, you can turn it off in "Marilyn.js".
  • 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.

#55 Pureon

Pureon

    Primus Pilus

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

Posted 24 February 2012 - 12:11 AM

These errors are very weird... Apparently, enemy units that are supposed to exist don't. I see absolutely no reason why... Any particular action that was happening when you got those (attacking marilyn, destroying her?)

Sorry, nothing obvious - I was still expanding my economy at the time, hadn't even scouted out the AI's base when the errors (not warnings) began appearing. Maybe around 10 minutes into the match.
  • 0

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


#56 historic_bruno

historic_bruno

    Primus Pilus

  • WFG Programming Team
  • 2,485 posts

Posted 24 February 2012 - 12:34 AM

These errors are very weird... Apparently, enemy units that are supposed to exist don't. I see absolutely no reason why... Any particular action that was happening when you got those (attacking marilyn, destroying her?)

If you're dealing with positions, there are several reasons why it might be undefined. The target could be garrisoned, dead, or training in progress (created but not yet spawned). Basically you want to check the position is not undefined before using it, as early as possible so the errors don't propagate all over the place. I think this should be added as a helper function for AIs.
  • 0
Ben Brian [ aka historic_bruno ]

Wildfire Games Programmer
Contact me: ben [at] wildfiregames [dot] com

#57 wraitii

wraitii

    Primus Pilus

  • WFG Programming Team
  • 1,665 posts

Posted 24 February 2012 - 08:33 AM

Mmmh, I forgot about garrisoning making the position undefined, this must be it because there's no way the units that are sorted by this function are dead. I'll give it a try.

(What's fun is that I really, authentically suck at this game, so I never try to garrison anything. I'm even unable to defeat my own bot.)

edit: Yup, garrisoning a soldier makes it go mad because I completely forgot about that possibility. Easy fix.
Anyone else tried playing around a bit?

Fix: line 378 of defence.js, add:
if (enemy.position() == undefined)  // unit is likely garrisoned. DO not check.
continue;
Edit: actually elsewhere too, I'll continue to playtest with some garrisoned units to see if there's any other spot.
Line 428 of "attack_city.js"
if (enemy.position() == undefined) // likely garrisoned
continue;
Edit^2: darn, also in defence.js, line 200, replace the if condition by this one:
if (enemy.owner() == ennemiPotentiel.owner() && enemy.id() !== ennemiPotentiel.id() && enemy.position() !== undefined)

Edited by wraitii, 24 February 2012 - 09:13 AM.

  • 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.

#58 Pureon

Pureon

    Primus Pilus

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

Posted 24 February 2012 - 10:34 AM

What's fun is that I really, authentically suck at this game, so I never try to garrison anything. I'm even unable to defeat my own bot.


One of the easiest ways to defend against an AI is to garrison your citizen soldiers in a fortress/tower.

I quite possibly did garrison a unit just before the errors appeared - it had been attacked by a leopard and needed healing :D
  • 0

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


#59 wraitii

wraitii

    Primus Pilus

  • WFG Programming Team
  • 1,665 posts

Posted 24 February 2012 - 11:23 AM

I can tell you with 100% certainty that you have indeed garrisoned a unit right before the unit appeared :) .
Okay, so since that seems to be taken care of, I'll now proceed to try to actually add stuff. I've already made the AI stop changing its workers of task every minute, so it behaves more humanly (and efficiently)

Edited by wraitii, 24 February 2012 - 11:34 AM.

  • 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.

#60 Pureon

Pureon

    Primus Pilus

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

Posted 24 February 2012 - 11:47 AM

It would be great to see a few AI scouts and some random raiding. This will hurt the AI's early economy, but it makes for a much more interesting and eventful match :)
  • 0

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