Problem with GetUnitDefs()

Problem with GetUnitDefs()

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

Moderators: hoijui, Moderators

Post Reply
submarine
AI Developer
Posts: 834
Joined: 31 Jan 2005, 20:04

Problem with GetUnitDefs()

Post 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
User avatar
krogothe
AI Developer
Posts: 1050
Joined: 14 Nov 2005, 17:07

Post 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...
submarine
AI Developer
Posts: 834
Joined: 31 Jan 2005, 20:04

Post by submarine »

yes GetUnitDefList() returns an array holding ALL unit defs of a mod
User avatar
krogothe
AI Developer
Posts: 1050
Joined: 14 Nov 2005, 17:07

Post 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?
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post 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.
submarine
AI Developer
Posts: 834
Joined: 31 Jan 2005, 20:04

Post 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
User avatar
jcnossen
Former Engine Dev
Posts: 2440
Joined: 05 Jun 2005, 19:13

Post 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.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post 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.....
Post Reply

Return to “AI”