enemy left radar event without radar?

enemy left radar event without radar?

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

Post Reply
echoone
AI Developer
Posts: 150
Joined: 16 Nov 2009, 18:26

enemy left radar event without radar?

Post by echoone »

I've noticed in developing my AI I seem to be getting spurious events. In my test I have two coms. If I walk one into los of the other com, an enter los event is triggered, just as one would expect. What isn't expected is an entered radar event is also created. Likewise, when I retreat the unit and los is lost, both the leave los and leave radar events are triggered.

According to the unitdef, the unit has (getRadarRadius) zero for radar radius. As such, I'm confused. I expected the enter/leave los to be triggered but can not account for the radar related events.

Is this a bug or desired behavior? And if its desired, why?
Kloot
Spring Developer
Posts: 1867
Joined: 08 Oct 2006, 16:58

Re: enemy left radar event without radar?

Post by Kloot »

Units that are in LOS are also automatically in radar, so this is expected behavior. As for the 'why', it's because the engine sensor system was not designed to make the distinction between LOS-only and LOS+radar.
echoone
AI Developer
Posts: 150
Joined: 16 Nov 2009, 18:26

Re: enemy left radar event without radar?

Post by echoone »

Kloot wrote:Units that are in LOS are also automatically in radar, so this is expected behavior. As for the 'why', it's because the engine sensor system was not designed to make the distinction between LOS-only and LOS+radar.
Is this considered correct or is it just the way things are?
User avatar
CarRepairer
Cursed Zero-K Developer
Posts: 3359
Joined: 07 Nov 2007, 21:48

Re: enemy left radar event without radar?

Post by CarRepairer »

It might help to think in more technical terms rather than using the terms LoS or radar for coverage.

Radar = Area where there's knowledge of enemy unit positions.
LoS = Radar + knowledge of unit types.

LeftRadar makes more sense under those definitions.
echoone
AI Developer
Posts: 150
Joined: 16 Nov 2009, 18:26

Re: enemy left radar event without radar?

Post by echoone »

Radar = Area where there's knowledge of enemy unit positions.
LoS = Radar + knowledge of unit types.
Wow. That's odd. Thanks for the clarification. I had no idea it worked like that. I assumed it used real world definitions. I'll need to think about this for a minute or two to determine if it has any implications for my AI effort. Again, thanks for the clarification.

So anything which is in LOS has a unitdef available. Anything which has not been in LOS but is on radar does not have a unitdef available. Correct?
User avatar
JohannesH
Posts: 1793
Joined: 07 Apr 2009, 12:43

Re: enemy left radar event without radar?

Post by JohannesH »

CarRepairer wrote:Radar = Area where there's knowledge of enemy unit positions.
LoS = Radar + knowledge of unit types.
But how about cloaked units, they can be within LOS range and not be seen, but only if there's a radar will leave a blip there?
Kloot
Spring Developer
Posts: 1867
Joined: 08 Oct 2006, 16:58

Re: enemy left radar event without radar?

Post by Kloot »

echoone wrote: So anything which is in LOS has a unitdef available. Anything which has not been in LOS but is on radar does not have a unitdef available. Correct?
yes
JohannesH wrote:But how about cloaked units, they can be within LOS range and not be seen, but only if there's a radar will leave a blip there?
Yes, because "within LOS range" does not automatically mean a unit can be seen by eye (only when it is not cloaked), just like "within radar range" does not automatically mean a unit can be seen by enemy radar (only when it is not jammed and not underwater, recall that radar ignores whether objects are cloaked).
User avatar
CarRepairer
Cursed Zero-K Developer
Posts: 3359
Joined: 07 Nov 2007, 21:48

Re: enemy left radar event without radar?

Post by CarRepairer »

Sorry, my definition is badly worded then. I shouldn't have said "area" but rather "set of units" as their proximity to your radars and other units are not the only factor in whether you have info on them.

Units in radar range but also jammed are not in the set.

Units outside radar range may still be in the set if lua functions alter their los-state to your team so you can still see them. The simplest example is SetUnitAlwaysVisible which makes the unit visible to everyone at all times no matter where it is.

Oh, and I didn't include prevlos but you seem to be aware of it.
echoone
AI Developer
Posts: 150
Joined: 16 Nov 2009, 18:26

Re: enemy left radar event without radar?

Post by echoone »

Interesting.

Then doesn't that imply the "getRadarRadius" function should return "max( getLos(), unitOrModRadarRadius)"? As it seems LOS implicitly infers radar coverage. Therefore, the minimum radar radius is alway the unit's LOS.

Shouldn't the API layer provide the actual value rather than ALL AIs having to take this into account. Is it known if any AIs would be broken by making this "improvement"? Or does getRadarRadius() have some unexpected implementation details and/or side effect?

Also, how does one determine if they are ONLY seeing a radar blip which is potentially blurred (position error) versus a physical LOS which is not blurred? I assume that means the distance is <= unit LOS?

Perhaps this should be moved to the AI forum?
Kloot
Spring Developer
Posts: 1867
Joined: 08 Oct 2006, 16:58

Re: enemy left radar event without radar?

Post by Kloot »

Then doesn't that imply the "getRadarRadius" function should return "max( getLos(), unitOrModRadarRadius)"? As it seems LOS implicitly infers radar coverage. Therefore, the minimum radar radius is alway the unit's LOS.
That would be true if the engine did not know the concept of a cloaked unit. Again, LOS only implicitly implies radar coverage for non-cloaked enemies.
Also, how does one determine if they are ONLY seeing a radar blip which is potentially blurred (position error) versus a physical LOS which is not blurred?
Well, that's where the EnemyEntered* events come in (*Radar ==> inaccurate position, *LOS ==> accurate position).
Post Reply

Return to “Engine”