KAI status and future - Page 3

KAI status and future

Here is where ideas can be collected for the skirmish AI in development

Moderators: hoijui, Moderators

User avatar
rattle
Damned Developer
Posts: 8278
Joined: 01 Jun 2006, 13:15

Post by rattle »

If you read up a few posts then you'll notice me asking for a recompile. Now go figure why I'd ask for such a thing... :)
kvdd
Posts: 25
Joined: 27 Jan 2006, 23:44

Post by kvdd »

krogothe do u work at the KAI.dll to compile it to 0.73b1?

UR GREAT!! :P
User avatar
krogothe
AI Developer
Posts: 1050
Joined: 14 Nov 2005, 17:07

Post by krogothe »

Yeah, im gonna do that as soon as i got free time and catch up with my 20 hours of sleep debt!
Ill recompile 0.11, which seems to be the favourite version, and hopefully carry on work on 0.2.
One of the main things coming up next (hopefully) is the Area Manager, which should fix a lot of problems. One of which being builders dying on their way to build mexes behind enemy defences.
I cant just pathfind the route to every free mex spot (too CPU intensive) and using some crappy generalizing algorithm is just no fun (and will result in missed spots), so the AM should fix that problem, along with allowing intelligent water and transport usage in the future instead of randomly placing SYs on puddles or transporting units to locations that are dangerous or already accessible (think amphibious landings on undefended beaches :)). The AM might need threading though, since it can be fairly CPU expensive, so it could take a while...
Another thing to look forward to is the new unit system, which is almost done (thanks to tourne, shame hes not around to finish it). It should allow KAI to play nanoblobs and such and take into account things like geothermals, units that fit into many categories etc (like GD mexes in EE, mobile fusions, etc), as well as reducing or eliminating the weird building bugs, radar farms, some crashes etc
It should be clear by the size of the post that my motivation is pretty high atm, even if i dont have the time to work on KAI. I might not do any of that at all and give up on it still, but that is seeming more unlikely as the week goes by!
kvdd
Posts: 25
Joined: 27 Jan 2006, 23:44

Post by kvdd »

krogothe wrote:Yeah, im gonna do that as soon as i got free time and catch up with my 20 hours of sleep debt!
Say goodbye to ur beatifull bed :P and CARRY ON! :lol:
krogothe wrote: I might not do any of that at all and give up on it still, but that is seeming more unlikely as the week goes by!
[seriously] does this mean u got this finish before the weekend? [/seriously]

I hope so! And yes this post is testifying of a high motivation ;)
User avatar
krogothe
AI Developer
Posts: 1050
Joined: 14 Nov 2005, 17:07

Post by krogothe »

okay it compiled no probs, i was about to release but it just wont move...
guess ill have to check logs and stuff sometime, forget about a re-release anytime this week :(
kvdd
Posts: 25
Joined: 27 Jan 2006, 23:44

Post by kvdd »

Ow hell no, but anyway take it relax ur right ;)
User avatar
1v0ry_k1ng
Posts: 4656
Joined: 10 Mar 2006, 10:24

Post by 1v0ry_k1ng »

1) no quantity of ordering will make KAI use any of the NI units currently
2) KAI NEVER builds GD armed mex's when it should ALWAYS build them to play GD well...
3) how will the area thing affect KAI's playing?
User avatar
1v0ry_k1ng
Posts: 4656
Joined: 10 Mar 2006, 10:24

Post by 1v0ry_k1ng »

double post, but, will KAI be compatible with EE's new hub system??
User avatar
krogothe
AI Developer
Posts: 1050
Joined: 14 Nov 2005, 17:07

Post by krogothe »

KAI is most likely dead, so your best hope is the other AIs...
And to make it clear:
Feel completely free to use KAI code on your AI's guys, i dont care if there is or isnt a message at startup, or even a comment in the code (though that would be polite). So please at least use the defence placement code, its a much needed feature and not all that hard to add.
User avatar
hrmph
Posts: 1054
Joined: 12 May 2005, 20:08

Post by hrmph »

Too bad :( It was the most challenging AI.
User avatar
krogothe
AI Developer
Posts: 1050
Joined: 14 Nov 2005, 17:07

Post by krogothe »

Well, it really is a pain to code someone else's project, so im not surprised no one has stepped up to port it to the latest version...

Since i heard 0.11 was broken (likely due to hurried commenting), ill upload a working (but debug-mode) version of 0.11. its on the SVN now
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

Krogoth, I attempted to integrate the chokepoint and defence placement into NTai and found I had to eventually copy over 95% of KAI to get it to compile.

Simply put, if you dont tell us anything then this simple task becomes a task thats just not worth the trouble.

Eventually I gave up trying to integrate KAI stuff into NTai and went elsewhere. AAI's defence placement is understandable and clear and isnt seemingly spread across AAI core classes.

All in all the only thing I managed to get out of KAI was a new antistall algorithm, only to find that my existing algorithm is much better.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

Also the svn version you put up doesnt work, its obvious you havent tested it with 0.73 because its complaining about virtual functions not existing, aka the EnemyDamaged function added to the interface by 0.73


VS2003 Pro output:
------ Build started: Project: KAI, Configuration: Release Win32 ------

Compiling...
TestAI.cpp
TestAI.cpp(20) : error C2259: 'CGlobalAI' : cannot instantiate abstract class
due to following members:
'void IGlobalAI::EnemyDamaged(int,int,float,float3)' : pure virtual function was not defined
..\..\..\rts\ExternalAI\IGlobalAI.h(46) : see declaration of 'IGlobalAI::EnemyDamaged'
SunParser.cpp
mtrand.cpp
micropather.cpp
Maths.cpp
Debug.cpp
UnitTable.cpp
UnitHandler.cpp
UnitHandler.cpp(99) : error C2660: 'IAICallback::HandleCommand' : function does not take 1 arguments
UnitHandler.cpp(407) : error C2660: 'IAICallback::HandleCommand' : function does not take 1 arguments
UnitHandler.cpp(432) : error C2660: 'IAICallback::HandleCommand' : function does not take 1 arguments
UnitHandler.cpp(459) : error C2660: 'IAICallback::HandleCommand' : function does not take 1 arguments
UnitHandler.cpp(511) : error C2660: 'IAICallback::HandleCommand' : function does not take 1 arguments
UnitHandler.cpp(725) : error C2660: 'IAICallback::HandleCommand' : function does not take 1 arguments
UnitHandler.cpp(801) : error C2660: 'IAICallback::HandleCommand' : function does not take 1 arguments
UNIT.cpp
ThreatMap.cpp
SpotFinder.cpp
PathFinder.cpp
MyNode.cpp
MetalMap.cpp
MetalMaker.cpp
GlobalAI.cpp
FastScoreList.cpp
EconomyTracker.cpp
EconomyTracker.cpp(109) : error C2039: 'UnitResourceInfo' : is not a member of 'IAICallback'
c:\Documents and Settings\Shade\Desktop\taspring\spring_folder\rts\ExternalAI\IAICallback.h(80) : see declaration of 'IAICallback'
EconomyTracker.cpp(470) : error C2039: 'UnitResourceInfo' : is not a member of 'IAICallback'
c:\Documents and Settings\Shade\Desktop\taspring\spring_folder\rts\ExternalAI\IAICallback.h(80) : see declaration of 'IAICallback'
EconomyManager.cpp
DefenseMatrix.cpp
BuildUp.cpp
AttackHandler.cpp
AttackGroup.cpp
AttackGroup.cpp(172) : error C2660: 'IAICallback::HandleCommand' : function does not take 1 arguments
AttackGroup.cpp(181) : error C2660: 'IAICallback::HandleCommand' : function does not take 1 arguments
AttackGroup.cpp(672) : error C2660: 'IAICallback::HandleCommand' : function does not take 1 arguments

Build log was saved at "file://c:\Documents and Settings\Shade\Desktop\taspring\spring_folder\Ai\Global\Kai-0.11\Release\BuildLog.htm"
KAI - 13 error(s), 0 warning(s)
submarine
AI Developer
Posts: 834
Joined: 31 Jan 2005, 20:04

Post by submarine »

AF wrote: AAI's defence placement is understandable and clear and isnt seemingly spread across AAI core classes.
maybe its located in a single function but you will need to port major parts of aai to get it working (sector manangement, scouting, map learning, building selection, building placement) - so basically you need to port the whole ai to get it working :)

so dont blame krog for his code - imho lots of ppl confuse ai coding with lego - you cant expect being able to exchange/add a single algo from another ai and it works. we all use quite different approaches, inetgrating some code of another ai will most likely requiere heavy modifications in your own...
User avatar
1v0ry_k1ng
Posts: 4656
Joined: 10 Mar 2006, 10:24

Post by 1v0ry_k1ng »

bah im just going to have to keep the old spring around for AI battles.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

The thing is your code has some comments here and there and the structure is plain to see, I know what i need to move along with a system to get it to work, and where it links in, and generally the basic idea about how it works.

With KAI I get lost once I trace it back to the PathFinder::CreateDefenceMatrix() function, which has no commenting and isnt very clear as to what exactly it's doing. Whereas with AAI I can be reverse engineered and re-implemented, as everything is so much easier to figure out and read, there's a strong structure to how things are generally laid out overall in the core workings.

I did find the mersenne twister class useful though.
User avatar
krogothe
AI Developer
Posts: 1050
Joined: 14 Nov 2005, 17:07

Post by krogothe »

AF wrote:Krogoth, I attempted to integrate the chokepoint and defence placement into NTai and found I had to eventually copy over 95% of KAI to get it to compile.
You cant just copy and paste bits of code and expect it to work on a completely different AI. I said use not copy-paste. The idea is you see how its done and code/adapt it yourself.
Simply put, if you dont tell us anything then this simple task becomes a task thats just not worth the trouble.
You never asked for help...
Also the svn version you put up doesnt work, its obvious you havent tested it with 0.73 because its complaining about virtual functions not existing, aka the EnemyDamaged function added to the interface by 0.73
If all it took was pressing the compile button do you honestly think i would have gone though the trouble of going opensource uploading KAI to the svn several times?

I gotta comment that code sometime but it takes time which i dont have currently, so sorry if its the best i can do for now...
User avatar
hughperkins
AI Developer
Posts: 836
Joined: 17 Oct 2006, 04:14

Post by hughperkins »

Just a comment ,without having read the code (yet) (where is the code btw, do you have a URL?), often the actual code itself is not that hard to write, what is key is the ideas, concepts and strategies that the code is based on.

You could probably write those down in just a few pages of Wiki?

*How do you keep your units grouped?
*How do you decide building placement?
*How do you make decisions between build economy vs build war?
*How do you decide when do you attack, and where?
*Do you have learning algorithms; how do they work?
*Why is it hard to d-gun a plane, and how do you succeed?
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

The problem is I udnerstand defence palcement almost entirely, tis just the bit thats the most important part aka CreateDefenceMatrix(), I have no idea whats going on in that function, and there are no clues as to what is going on either, and I'd much prefer a quick 2 or 3 entence explanation to a several week wait for code comments.....
User avatar
krogothe
AI Developer
Posts: 1050
Joined: 14 Nov 2005, 17:07

Post by krogothe »

from a pm i sent to sub:
First it needs to generate the chokepoint map. This is done in CreateDefenseMatrix() (in pathfinder.cpp) by finding the starting positions on frame one, checking for all units on the map. Since only comms exist the units returned are in the start locations.

It then pathfinds between those positions many times over. Each time this is done it updates the cost array, basically drawing the paths in so that it is tries to take a new route each time. costmask is used to draw thick, smooth lines so that it wont take thousands of paths to fill a big map.

It can make chokepoint maps for each movetype, but it is currently disabled because its too slow. (at this point i noticed a variable called kitty, which made me LOL).

try changing the number of iterations on some loops and looking at the TGAs (use MakeBWTGA) to see how it works
Once KAI has all the chokemaps it saves them for the actual defense placing.

Once KAI wants to place a defense, it will use an algorithm similar to the metal class to search for the best location (highest sum of chokepoint values inside its range), then place the defense and change the chokepoint array over that radius. This is all done in defesematrix.cpp.
Post Reply

Return to “AI”