Page 1 of 1
UnitDef->moveType dought
Posted: 05 Jan 2006, 15:04
by Chocapic
what does UnitDef->moveType field means what ????
ive tried it on a lot a diferent units like kbots and vehicles and planes and i always get 0!
am i doing something wrong ?
can anyone give more details on this ?
Posted: 05 Jan 2006, 15:07
by krogothe
:)
its because its a sorta of a pointer or container or something (cant remember now).
Look at AAIs source code, in the buildtable class, it works sorta like UnitDef->moveType->movedata()
planes wont have a movedata though.
You can also simply open spring's source code and look it up!
Posted: 05 Jan 2006, 16:29
by Chocapic
are you sure its a pointer ??
all its says in the unitdef.h is this
Posted: 05 Jan 2006, 19:10
by cain
well, moveData is a pointer. moveType, afaik, was the old way that spring used to store the move information.
now the pointer points directly to the class that handle the movement physics of the unit. so if you look at it you will find that buildings are set to null and that moving unit are set to something, wich point to a moveDAta class.
the need for this is that an automated parser should tag unit this way:
builder if canmove&&buildspeed>0
factory if !canmove&&buildspeed>0
turret if !canmove&&wapons.size()>0
and so on.
BUT factoryes in spring have canmove=true
I'don't know the motivation for this. an explanation is that maybe a factroy should be checked by the collision engine as it can be opened, and unit that cannot move are skipped by the collision check (units collides to them but they cannot actively collide, wich makes sense for a non-moving unit)
Posted: 05 Jan 2006, 20:25
by Veylon
That's essentially what I use, except that it's more like this:
Code: Select all
if(canbuild)
{
if(speed > 0)
builder
else
factory
}
Posted: 06 Jan 2006, 01:07
by Chocapic
well maybe my intentions werent very clear as i was trying to know ingame wich plat is wich (kbot, vehicle , air).
to find out wich ones are the plants i went on the builders UnitDef->buildOptions and look for builders (a con can only build plants and other structures , not units and thats what i built from).
Allthough i might take a look at your methods of doing this as my might not be very precise.
Posted: 06 Jan 2006, 05:52
by ILMTitan
cain wrote:
BUT factoryes in spring have canmove=true
My guess would be it is because you can give a factory a move command, which all units it creates immediatly follow. No other buildings can be given a move command, afik.
Posted: 06 Jan 2006, 17:22
by AF
Chocapic wrote:well maybe my intentions werent very clear as i was trying to know ingame wich plat is wich (kbot, vehicle , air).
to find out wich ones are the plants i went on the builders UnitDef->buildOptions and look for builders (a con can only build plants and other structures , not units and thats what i built from).
Allthough i might take a look at your methods of doing this as my might not be very precise.
In that case I darent ever attempt AI code you write with the kindgoms mod. Considering that, there must be more to it otherwise builders would eb classed as factories for being able to build factories whcih can build things.
Posted: 06 Jan 2006, 20:13
by Chocapic
i meant there was con's cant build con's!
only plants can build con's.
but considering this might be a total imprecision as im going to change it to the speed issue, where the plants have speed 0 i supose.
Posted: 11 Jan 2006, 01:35
by Veylon
Try this:
I think 0 = Tank, 1 = Kbot, 2 = Hover, 3 = Ship.
Look in the movedata.h file in the source.
Posted: 11 Jan 2006, 01:38
by Chocapic
yes i've tried that out but moved on to more important things as that isnt much important to me yet, but geting the movefamily from tha plant itself givesme wrong data or crashes (dont remember) , so ill try with a plant unit.
Posted: 11 Jan 2006, 18:12
by AF
Look at Taros in the TA:Kingdoms mod for spring. con units building other con units, heck even the usual way fo doing ti makes for somewhat messy play on Kingdoms, I'm gonna have to make NTAI build trees incapable of distinguishing between factorys and cons and treating them the same so I can be more robust while havign support for upgrade like structures beign built by factories.