Jump to content

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


Recommended Posts

A problem with the AIs, Marilyn in particular, is that they will make plans and abandon them frequently, especially building foundations, like Civ Centres and Fortresses. The resources are already expended when the foundation is laid, so the bot should go ahead and build it, or delete the foundation and get the resources back. :) It also has trouble deciding when and where to build Mills. :/

Link to comment
Share on other sites

Yeah, making an AI work properly for absolutely trivial tasks such as where to build a mill is what makes you realize the human brain is amazing.Marilyn restarts attack plans all the time for now, but it's "wanted", because it's the best way I found of making it work fairly properly for now.

@Pedro Falcao: yes, she ignores the fog of war... But I made her only detect incoming army in her territory to compensate. LOS I think could be added by some changes in the C++ code (there is support for human LOS, apparently AI LOS is possible to have at some point), but it would increase lag.

Attacking your rams however works as designed... The way the "battle manager" works now is to send units deal with each group of enemy , so your rams were detected a a new group and units were sent.

Edited by wraitii
Link to comment
Share on other sites

That is weirder. This should work:

if (!unit || (unit && !unit.position()) ){

Sorry wraitii, that still didn't fix it. But this time ignoring the errors I continued the game and had 2 Marilyn bots attacking and raiding my base from all sides until the lag (probably partly to do with the errors) caused me to stop the game. Very ferocious bot :)

Link to comment
Share on other sites

This error is confusing me... I'll look into it. I'm not sure what's causing the lag... The economic manager has been sped up quite a lot, but there is something in my attack plans that lags terribly...

Btw, what map were you playing?

Anybody noticed that Hellenes cavalry raid specifically target your villagers?

Edited by wraitii
Link to comment
Share on other sites

Btw, what map were you playing?

Anybody noticed that Hellenes cavalry raid specifically target your villagers?

I've been testing Marilyn on Spahbod's new random maps (on the svn now). The last 2 maps I used were 'Lake' and 'Phoenician Levant' - and I didn't use Romans or any island maps.

I noticed the raids were focusing on villagers - that worked well. The raids could be less predictable - smaller groups of attackers, maybe even 2-3 cavalry units minimum - enough to disrupt normal economic build-up. The few raids I saw involved around 10 cavalry units. I

disrupt the AI's early economy with 1 cavalry unit.
Link to comment
Share on other sites

Yeah, that comes from me sucking at this game so I don't really know what's efficient enough. I guess 2/3 units would indeed be better, but it might require a bit cleverer movements from the AI to not get his units killed in a few seconds, which I do not have right now.

I'm trying to improve the performance of my plan managers but it's proving harder to do than I expected... I'll look into the "defense error" thereafter.

edit: can't seem to reproduce the error you're having... Any details on how to do so?

Edited by wraitii
Link to comment
Share on other sites

edit: can't seem to reproduce the error you're having... Any details on how to do so?

I'm using a clean version of the svn, so it can't be any other changes causing it. Try Marilyn as Persians... and then maybe 10 minutes in to the game, when Marilyn is attacking, the errors begin. Is Marilyn on github?

Link to comment
Share on other sites

That is weirder. This should work:

if (!unit || (unit && !unit.position()) ){

I have no knowledge at all about Java script but is the evaluation of such expressions fixed by the standard? I.e. is unit && !unit.position() evaluated from left to right and is the evaluation stopped if unit==false (without checking the second condition)?

Link to comment
Share on other sites

I have no knowledge at all about Java script but is the evaluation of such expressions fixed by the standard? I.e. is unit && !unit.position() evaluated from left to right and is the evaluation stopped if unit==false (without checking the second condition)?

If javascript is like java (and very likely is), then all operations are read from left to right. So (suposing the operations are all java-like) the computer reads as following:


if unit is not true or (unit is true and unit.position() returns false), then...

Link to comment
Share on other sites

I have no knowledge at all about Java script but is the evaluation of such expressions fixed by the standard? I.e. is unit && !unit.position() evaluated from left to right and is the evaluation stopped if unit==false (without checking the second condition)?

Yes, javascript does work in this way, with an || if the LHS is true then the RHS will not be executed and similarly with && if the LHS is false the RHS won't be evaluated. The first code

if (!unit || !unit.position() ){

that wraitii posted should work in an identical way though.

Link to comment
Share on other sites

Yeah, making an AI work properly for absolutely trivial tasks such as where to build a mill is what makes you realize the human brain is amazingimpulsive.

Fixed. :D

Is Marilyn on github?

Not as of now...

Working with an interpreted language, I can see how you wouldn't haven't bothered to release your code separately. But as this AI grows, you will probably run into regressions, and then version control will be invaluable. (If you are using a local git repository or something similar, my apologies.)

Link to comment
Share on other sites

@Pureon: I still find myself unable to reproduce this error... I guess I'll leave it alone for now, if it happens to you again and you have more information about what happens, I'd be very glad.

Sure thing. If it happens to me again I'll try to provide you with more info. I still think it has something to do with garrisoning - I use it a lot during raids/attacks.

Link to comment
Share on other sites

Okay, a new version. Changes:

-Attack plans overhauled, started less frequently, more reliable, more efficient. Allowed raiding for any civ. Also added an option to "stay close" when attacking.

-tons of little optimizations here and there, and bugfixing. Optimization was needed since I now call Marilyn every two turn and not every 8 turns (like qBot)

-Defense manager also more reliable, able to detect when to stop pursuing (no more "a whole army chasing one unit on the whole map"), better at a few stuffs, generally more efficient.

-further overhaul of the worker assigner functions. It's factored by the gather rates, though this may be hard to notice

-Changed a few stuffs in the building orders and the priorities of the AI for better play.

Technicalities:

-added a function for bartering, though I haven't used it yet.

-implemented a few stuff from svn qBot.

The AI is now called every two turn, instead of every 8 turn for qBot. This is balanced by the fact not every function is called every turn, and tons of little (or fairly big) optimizations everywhere. testing against Svn qBot, it is more "frame efficient".

You should notice a much better ability at defending from the AI, though it may have a bit of troubles actually attacking.

Download Link

I'll soon be working again, so I will have much less time... Hopefully I'll be able to carry development on a bit. I'll need roman support, better attacks (this is really the one area where much work is needed), and ship support.

Link to comment
Share on other sites

New error to report: http://pastebin.com/1wv5dDh6 This one appeared after I began attacking. I wasn't attacked or raided, so didn't garrison my units at any point.

Marilyn may have got stuck - it didn't defend its territory or itself when I finally invaded. I had 3 fortresses and it had only just started to build a barracks:

0ADMarilfarm.jpg

Hope this is somehow useful :)

Link to comment
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.

 Share

×
×
  • Create New...