KAI status and future
Moderators: hoijui, Moderators
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!
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!
Say goodbye to ur beatifull bedkrogothe wrote:Yeah, im gonna do that as soon as i got free time and catch up with my 20 hours of sleep debt!


[seriously] does this mean u got this finish before the weekend? [/seriously]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!
I hope so! And yes this post is testifying of a high motivation

- 1v0ry_k1ng
- Posts: 4656
- Joined: 10 Mar 2006, 10:24
- 1v0ry_k1ng
- Posts: 4656
- Joined: 10 Mar 2006, 10:24
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.
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.
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.
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.
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:
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)
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 :)AF wrote: AAI's defence placement is understandable and clear and isnt seemingly spread across AAI core classes.
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...
- 1v0ry_k1ng
- Posts: 4656
- Joined: 10 Mar 2006, 10:24
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.
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.
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.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 never asked for help...Simply put, if you dont tell us anything then this simple task becomes a task thats just not worth the trouble.
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?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
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...
- hughperkins
- AI Developer
- Posts: 836
- Joined: 17 Oct 2006, 04:14
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?
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?
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.....
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.