Page 1 of 2

need help with an Ai working for a fun mod

Posted: 21 Jan 2007, 18:55
by Optimus Prime
Hi

i want to have an AI for an existing war evo modification. Actually i added the race arm with just very few units and buildings.
I want the ai to spam the factories and units and send them towards the players.
There is just energy for the AI to use cause the commander gets enough metal for everythingand i think thats the problem for at least the AAI.
It builds a solar panel and tries do get more metal but there is no metal extractor building, so it stops.

Anyone who can help me here? If you have experience with that, it would be nice if you can do the AI for me (or config it). Just send me an PM with you mail and i will send you the .sdz file for the mod.

thanks

Posted: 21 Jan 2007, 22:01
by Guessmyname
you could just add a mex to keep AAI happy

Posted: 21 Jan 2007, 22:21
by AF
NTai RAI and KAI

Posted: 22 Jan 2007, 14:08
by Optimus Prime
NTAI, KAI and RAI dont work. They crash at start saying wrong global AI version. Also AAI dont works if i add a mex building. Perhaps its cause of the new spring version?

Isnt there anyone who wants to make such an AI work for this mod? Its not just a win for the mod but also for your AI because this is perhaps the first mod which will be played against an AI even with enough human players. Think about it...

Posted: 22 Jan 2007, 14:39
by Tobi
AIs have to be recompiled for 0.73b3 yes (due to new safety measures to prevent problems like what happened between b1 and b2). However, KAI-0.12 and AAI are included with Spring.

Posted: 22 Jan 2007, 15:04
by AF
I'll recmpile the latest NTai ocne my building palcement algorithm is fixed.

Posted: 22 Jan 2007, 15:46
by Optimus Prime
Tobi wrote:AIs have to be recompiled for 0.73b3 yes (due to new safety measures to prevent problems like what happened between b1 and b2). However, KAI-0.12 and AAI are included with Spring.
if they are included, there must be another problem i cant fix cause i tried them and it crashed right after start.

Posted: 22 Jan 2007, 16:30
by Tobi
Did you test version 0.74b3? The one released yesterday night?

Posted: 22 Jan 2007, 18:19
by Optimus Prime
Ok it seems that the only AI which doesnt crash is KAI. It also builds factories and spams units, BUT only tech 1 factories. I gave the tech 1 factory a unit restriction limit of 4 and after that the commander tries and tries to build another factory instead of building a tech 2 factory. How can i force him to build tech 2 after 4 tech 1 factories.
Also the units the AI builds dont attack. They just guard the area next to the base...
Any way to fix that myself?

Posted: 29 Jan 2007, 21:41
by Optimus Prime
so no one can help?

Posted: 29 Jan 2007, 21:44
by AF
Be patient.

KAI will eventually do what you want

NTai could do it now if you wrote a config and I fixed the remaining issues

Posted: 29 Jan 2007, 21:47
by Optimus Prime
i tried NTAI but it crashed right after start when i wanted to edit this config file. I didnt even get to the point where i could use this "editor". When i tried to open the empty config for the mod, it crashed.
But i will wait for KAI...

thx

Posted: 30 Jan 2007, 01:12
by AF
I did say NTai isnt ready. The public version atm is incompatible with the latest spring.

Posted: 30 Jan 2007, 13:56
by Optimus Prime
ok. But i tried it before the latest spring version ;)
never mind. I m happy as long as there is someone working on that :)

Posted: 30 Jan 2007, 22:08
by hrmph
Have you tried KAI on several different maps? I've found that it sometimes gets a bit 'stuck' somtimes...

Posted: 31 Jan 2007, 00:32
by Optimus Prime
hrmph wrote:Have you tried KAI on several different maps? I've found that it sometimes gets a bit 'stuck' somtimes...
good point. I will try it the next days, but i think the problem with KAI that the Ai will stop building when it reached the unit restrictions will stay...

Posted: 31 Jan 2007, 01:07
by Kloot
KAI doesn't take per-unit restrictions into consideration when deciding what to build, so it'll keep trying ad infinitum to start construction which the engine then aborts due to the limit having been reached. Directly forcing it to level 2 isn't really feasible though since that would counteract KAI's stalling safeguards, but I'll see if I can come up with an alternative solution.

Posted: 31 Jan 2007, 11:46
by Optimus Prime
what about a restriction check?
I dont know if its possible, but it should because its not just in this mod. A lot of mods will have restrictions for super units and so on.
Isnt it bad if the AI stops working when reaching the restriction instead of building something else?

Posted: 31 Jan 2007, 12:38
by Kloot
Yes, I agree. The problem is that an AI cannot simply ask the engine how many units of a given type there are on its ally-team, so such a check would require internal bookkeeping (unless someone were to *cough* patch *cough* the AI interface), which is a bit more work to implement.

Posted: 31 Jan 2007, 14:14
by AF
It can be read via TdfParser believe it or not. And it need only be read once then cached.

This suits an AI such as AAI very well, since AAI already precaches UnitDefinitions.

I suggest a second interface be added for these sorts of things so that there underlying implementation can change as the AI interface adds dedicated support.

Although I thought unit restrictions where a part of UnitDef class? Thus counting how many peewees you have then comparing it to the maximum number allowed gave you the desired result.