UnitDef->moveType dought

UnitDef->moveType dought

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

Moderators: hoijui, Moderators

Post Reply
Chocapic
Posts: 556
Joined: 16 Oct 2005, 03:35

UnitDef->moveType dought

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

Post 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!
Chocapic
Posts: 556
Joined: 16 Oct 2005, 03:35

Post by Chocapic »

are you sure its a pointer ??
all its says in the unitdef.h is this

Code: Select all

int moveType;
cain
AI Developer
Posts: 124
Joined: 09 Aug 2005, 10:04

Post 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)
User avatar
Veylon
AI Developer
Posts: 174
Joined: 21 Sep 2005, 19:45

Post 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
}
Chocapic
Posts: 556
Joined: 16 Oct 2005, 03:35

Post 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.
User avatar
ILMTitan
Spring Developer
Posts: 410
Joined: 13 Nov 2004, 08:35

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

Post 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.
Chocapic
Posts: 556
Joined: 16 Oct 2005, 03:35

Post 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.
User avatar
Veylon
AI Developer
Posts: 174
Joined: 21 Sep 2005, 19:45

Post by Veylon »

Try this:

Code: Select all

unitdef->movedata->movefamily
I think 0 = Tank, 1 = Kbot, 2 = Hover, 3 = Ship.
Look in the movedata.h file in the source.
Chocapic
Posts: 556
Joined: 16 Oct 2005, 03:35

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

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

Return to “AI”