google-code-export / bwapi

Automatically exported from code.google.com/p/bwapi
0 stars 0 forks source link

Detection of attacked units. #184

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Move to an enemy without attacking them.
2. Use BWAPI to detect the attack on your units.

What is the expected output? What do you see instead?
I can attack units, but I can't know when I am attacked.
Well, I could parse all the units visible (Fog of War is enabled) and test 
for isStartingAttack. So I would know the enemy is attacking and I which 
position. But I can't know which unit is attacked. I could know by 
comparing between frames hitpoint of my units but there got to be another 
way. Also, in case there is a siege tank on that shoot at me out of my 
range of Fog, i might not get isStartingAttack flag so I couldn't know I am 
under attack. Unless again I watch hitpoint which i would find stupid.

I saw in the API something about AttackType but it doesn't seems in use 
yet.

What version of the product are you using? On what operating system?
2.6.1 on Vista.

Thanks.

Original issue reported on code.google.com by patrick....@gmail.com on 14 Jan 2010 at 5:54

GoogleCodeExporter commented 9 years ago
Watching the hitpoints is the most logical way to define if one of your units 
got 
attacked. We could make an onUnitDamaged callback, it would trace hitpoints 
internally, same diff.

The AttackType is the new bullet detection feature we're working on (issue 93), 
which will sove the problem of who shot whom, but for now tracing hitpoint is 
only 
reliable way.

Original comment by goo...@teabix.com on 14 Jan 2010 at 1:30

GoogleCodeExporter commented 9 years ago
It's something I can do on my side, doesn't have to be done internally but 
could be 
useful for newcomers.

Original comment by patrick....@gmail.com on 14 Jan 2010 at 4:09

GoogleCodeExporter commented 9 years ago
This would be incredibly helpful. Pretty much every AI will needs to know if a 
unit
is attacked, so at least knowing if a unit becomes damaged would be helpful.

Original comment by darkp...@gmail.com on 14 Jan 2010 at 7:52

GoogleCodeExporter commented 9 years ago
My problem was also that if I detect being attack by hitpoints. I can't know 
what is 
attack me. If a lurker for example attack me. I would retreat. I can detect 
there is no 
unit nearby. But if it's a mine, I still can't see it because it won't be there 
anymore 
but I might decide to sacrifice one unit as a deminer and still attack but if I 
can't 
make the call without more informations.

Original comment by patrick....@gmail.com on 14 Jan 2010 at 9:27

GoogleCodeExporter commented 9 years ago
I had the same problems, then stumbled into the bullet array in broodwar memory 
when 
trying to find a way to detect psionic storms. Bullet support will be THE means 
to 
detect who has been attacking your units. It's even more, just like a human 
player 
can predict when the antiair missile of his goliath will hit the target he 
designated, that will be possible with AIs too.

It won't be helpful with mines, since those are units, not bullets. And like 
with 
anything belonging to the enemy, you do not get to see it's orders or targets. 
You 
have to deduce enemies intentions from his actions.

I will have the bullet support (or a stripped version at least) in the BWAPI1 
interface ready for the BWAPIv3.0 release. Can't promise anything for BWAPI2 
tho.

Original comment by goo...@teabix.com on 14 Jan 2010 at 10:15

GoogleCodeExporter commented 9 years ago
i wonder why the bullet record don't have information about it's source and 
target unit?

Original comment by neoedmund on 15 Jan 2010 at 6:35

GoogleCodeExporter commented 9 years ago
it has (who said it hasn't?).

Original comment by goo...@teabix.com on 15 Jan 2010 at 12:58

GoogleCodeExporter commented 9 years ago
you mean some unknown field in struct AttackType?

Original comment by neoedmund on 15 Jan 2010 at 1:39

GoogleCodeExporter commented 9 years ago
AttackType is work in progress. Broodwar memory does hold all necessary data, 
at 
least I found out all I needed to know.

But don;t expect too much info, you probably won;t be allowed to query the 
target of 
enemy bullets for the same reasons you are not allowed to query the target of 
an 
enemy unit.

Original comment by goo...@teabix.com on 15 Jan 2010 at 2:26

GoogleCodeExporter commented 9 years ago
Thanks tons for BWAPI and looking forward to using this issue functionality in 
future 
releases - being able to tell which of my units are actively firing or being 
fired upon 
and perhaps the direction or location of the attack would help loads with 
organized 
firing or avoiding fire.

Original comment by jeremy.c...@gmail.com on 26 Jan 2010 at 4:23

GoogleCodeExporter commented 9 years ago
Try enemyUnit.isAttacking, then get the enemy's target. Revision 2126

Original comment by AHeinerm on 7 Mar 2010 at 11:42