Sign in to follow this  
Followers 0
wraitii

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

160 posts in this topic

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. :/

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Mmmh, it looks like line 279 also needs to be changed to this:

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

Share this post


Link to post
Share on other sites

That is weirder. This should work:

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

Share this post


Link to post
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 :)

Share this post


Link to post
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

Share this post


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

Share this post


Link to post
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

Share this post


Link to post
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?

Share this post


Link to post
Share on other sites

Not as of now... I'll try to reproduce the error anyway, since it's fairly bothersome and I have reasonably sped up the attack plans.

Share this post


Link to post
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)?

Share this post


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

Share this post


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

Share this post


Link to post
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.)

Share this post


Link to post
Share on other sites

I am using a local git, but I'll likely go online at some point.

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

Share this post


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

Share this post


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

Share this post


Link to post
Share on other sites

Congratulations, my friend, this is a great step forward!:banana:

BTW: Next, you will do?

Solve the problem of game lag? Is QBot caused by lag.

Edited by gameboy

Share this post


Link to post
Share on other sites

Might be related to Pureon's error... That is, you garrison a unit under attack?

Share this post


Link to post
Share on other sites

Might be related to Pureon's error... That is, you garrison a unit under attack?

Yep! Keep getting a bunch of errors until I ungarrison them.

Share this post


Link to post
Share on other sites

That seems to indicate I have forgotten some code somewhere, which is likely. Hopefully I'll be able to find out, thanks.

Share this post


Link to post
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 :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0