Can i get unit current speed?

Can i get unit current speed?

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

Moderators: hoijui, Moderators

Post Reply
slogic
AI Developer
Posts: 626
Joined: 17 Mar 2008, 19:03

Can i get unit current speed?

Post by slogic »

I have looked through AI interface and all i can get is unit max speed. Is there some way to get unit CURRENT speed? Actually i need to know if unit is moving or not. Scanning its command queue for MOVE command is not tasty for me. Also i don't know if it will work for allied teams.
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: Can i get unit current speed?

Post by hoijui »

Unit.h does not have a field speed or current-speed or something.
How i think it works:
For each frame, the engine calculates how far the unit will get, according to its move-type, the terrain, a limit that says, do not move faster then unit X, ...
so the current speed changes each frame, but it is not saved in a variable, and you could just as well calculate it by tracing the units position. There should be little overhead there.
slogic
AI Developer
Posts: 626
Joined: 17 Mar 2008, 19:03

Re: Can i get unit current speed?

Post by slogic »

Isn't in simulation code it is calculated anyway? Just store it in a unit and expose to public. Calculation of speed per each AI type is stupid (if they really needed this info).
slogic
AI Developer
Posts: 626
Joined: 17 Mar 2008, 19:03

Re: Can i get unit current speed?

Post by slogic »

FYI, Kloot was so responsive that added this possibility in master with http://github.com/spring/spring/commit/ ... e3c96c30f8 commit.
Satirik
Lobby Developer
Posts: 1688
Joined: 16 Mar 2007, 18:27

Re: Can i get unit current speed?

Post by Satirik »

Kloot is awesome !
Post Reply

Return to “AI”