Page 1 of 1
Problem with GetUnitDefs()
Posted: 27 Nov 2005, 14:36
by submarine
When getting the unit defs from ta spring i get an error message, saying there are "x missed unit defs", for example 35 when starting an aa1.2 game
i dont get this error in connection with xta or ta:wd; there's either a bug in this callback function, (probably some kind of maximum number of unit defs)
or its an aa:ta issue
Posted: 27 Nov 2005, 16:10
by krogothe
Hmm does GetUnitDefList get ALL unit defs in a mod???
if it does then it is indeed possible to work out the complete buildtrees for either side before the game starts up like we discussed before!
anyways im not sure about your problem, but AA does have some dodgy units:
Code: Select all
Category=ARM SHIP LEVEL2 WEAPON NOTAIR NOTSUB ALL ;
Description=Long-Range Plasma Ship;
FootprintX=7;
FootprintZ=7;
MaxDamage=12200;
ObjectName=ZULU;
Side=CORE;
unitnumber=19214;
Compare Category and side and look at the unit number. Maybe some unit numbers are greater than 65k, which could cause trouble with some int types, i dont know...
Posted: 27 Nov 2005, 16:16
by submarine
yes GetUnitDefList() returns an array holding ALL unit defs of a mod
Posted: 27 Nov 2005, 16:26
by krogothe
Well, then you can get all units, see what they can build, make trees out of it (should end up with one tree per side). That should be enough to let the AI build, it will start building with whatever unit it starts with, be it a comm or con kbot.
If you need to specifically find the commander, go up it until you find a builder unit that cannot be built, which should be the commander!
That wouldnt need a cfg then would it?
Posted: 27 Nov 2005, 17:04
by AF
imho build tree like structures are too much hassle. How do you account for places where you have multiple branches converging, such as a factory that builds untis that can be built udner both arm and core tech trees? How to deal with captured units, factories built by a large selection of builders such as the lvl 1 factories.
All too much info beign processed when much better techniques are available.
Posted: 27 Nov 2005, 18:18
by submarine
well the question was not about necessity of buildtrees...
if there is a bug in the interface it should be fixed no matter if buildtrees depend on that or not
Posted: 27 Nov 2005, 18:33
by jcnossen
The debugger is your friend

But really, IMO all AI developers have the skill and ability to help with debugging such issues, so they should :) Put lesson2 in your VS solution, build spring in debug, search for "missed unit defs" in the code and set a breakpoint, and your bug is probably fixed in no time...
JCAI implements these buildtrees since 0.20 already (BuildTable), you can use it to calculate the shortest build path from unit X to unit Y in constant time. Even from com to krogoth if you want

I solved it as if it's a general pathfinding problem, makes it quite simple if you look at it like that. Even A* could be used for it I guess, but my precomputing is even simpler.
Posted: 27 Nov 2005, 18:39
by AF
Intersting. I'll take a look at whats going on, but I cant use debugging, it just wotn work for me, generates errors todo with the debugers setup.....