Closed GoogleCodeExporter closed 9 years ago
Original comment by lowerlo...@gmail.com
on 15 Nov 2009 at 7:23
Original comment by lowerlo...@gmail.com
on 15 Nov 2009 at 7:24
Not sure how this can be implemented since psionic storms aren't units in
broodwar,
but I'm sure its possible with some more reverse engineering. Perhaps there is
a way
to iterate over all the sprites and find ones with an identifier for psionic
storms.
Would also be useful for detecting nuke dots.
Original comment by lowerlo...@gmail.com
on 15 Nov 2009 at 9:47
well i took some time, poked around, now i'm sure there is only 1 place where
starcraft saves the psionic storm, along with some other things, I suspect that
this
is the "sprite list" I was hearing about but I have no sources to check if this
is
true. Attached a .dll that demonstrates that the method works. It's a linked
list,
probably a deque. I simply iterated through the LISTITEMs starting with the
first
item. Also, I suspect that (LISTITEM::time_left>>8) returns the frame count
till
psistorm disappears.
typedef struct __LISTITEM
{
__LISTITEM *next;
__LISTITEM *previous;
int __unknown00[7];
unsigned short type; // if this is 0x9D, this is a psi storm
unsigned short __unknown01;
unsigned short pos_x;
unsigned short pos_y;
int pos4_x; // (pos4_x >> 4) == pos_x
int pos4_y;
int __unknown02[11];
int time_left; // use time_left>>8 for frames
} LISTITEM;
int *listcount = (int*)0x64DEBC;
LISTITEM **firstitem = (LISTITEM**)0x64DEAC;
LISTITEM **lastitem = (LISTITEM**)0x64DEC4; // just in case...
in the dll, this is the code used
for(LISTITEM *curritem = firstitem ; curritem; curritem = curritem->next)
{
if(curritem->type != 0x9D)
continue;
Broodwar->text(CoordinateType::Map, curritem->pos_x, curritem-
>pos_y, "frames: %d", curritem->time_left>>8);
Broodwar->drawCircle(BWAPI::CoordinateType::Map, curritem->pos_x, curritem-
>pos_y, 4, BWAPI::Colors::White, false);
stormcount++;
}
If this is the sprite list, it should be even easier to implement...
Original comment by goo...@teabix.com
on 16 Nov 2009 at 1:56
Attachments:
Wow, excellent work! If you ever want to become a project member/committer,
just let
me know. :)
The struct is different from the sprite specified in BW/Sprite.h (
http://code.google.com/p/bwapi/source/browse/trunk/bwapi/BWAPI/Source/BW/Sprite.
h ),
so perhaps this new struct you found is for a related type of object.
Other spells like Dark Swarm and Disruption Web already exist as real units in
Broodwar and BWAPI, so for consistency I'm planning to add Psionic Storm as a
sort of
pseudo unit to BWAPI - to AI modules it will appear to be just another Unit,
however
it will correspond to items in this struct.
Original comment by lowerlo...@gmail.com
on 16 Nov 2009 at 6:50
Original comment by lowerlo...@gmail.com
on 16 Nov 2009 at 6:52
thx, someday meybe =)
I got it figured out. The psionic storm was just a beginning. This list
contains
BULLETS! Since a human can see bullets i suggest BWAPI includes them into its
functionality sometime in the future. There are Unit* references saved in the
BULLET
structure, I made a .dll tool which detects all Unit* references in the BULLET
structure as they appear and shows them, so I hope adding this functionality to
BWAPI will be a piece of cake for you guys =)
The locations are shown in bytes from start of structue, so
unit: +100 b
means that a unit entry were detected at base_address+100 bytes
oh and: since there is always a Unit* at +100, whick is the owner unit of this
bullet, the dll does not show it, only draws a green line instead of orange.
typedef struct __BULLET
{
/*00*/ __BULLET *next;
/*04*/ __BULLET *previous;
/*08*/ int __unknown00[7];
/*24*/ unsigned short type; // if this is 0x9D, this is a psi storm
/*26*/ unsigned short __unknown01;
/*28*/ unsigned short pos_x;
/*2A*/ unsigned short pos_y;
/*2C*/ int pos4_x; // (pos4_x >> 4) == pos_x
/*30*/ int pos4_y;
/*34*/ int __unknown02[11];
/*60*/ int time_left;
/*64*/ UNIT *owner;
} BULLET;
i really recommend trying the Valkyrie, Goliath antiair and Mutalisk attacks
Original comment by goo...@teabix.com
on 16 Nov 2009 at 2:32
Attachments:
with this you can see where a lurker attacks you without being able to klick on
the
lurker, just like in "real life"
Original comment by goo...@teabix.com
on 16 Nov 2009 at 2:59
You sure that's the CBullet struct?
Original comment by AHeinerm
on 19 Nov 2009 at 1:51
What do you mean?
The "unit: xx b" messages lie in the __unknown areas and behind *owner, those
are
99.999% correct, but the other fields could be misinterpreted.
Anyway it's the struct I use in the .dll
Original comment by goo...@teabix.com
on 19 Nov 2009 at 9:12
It looks like the CImage struct to me, because CBullet has a smaller struct
size.
(The C prefix is the accepted name for the structure based on debug strings)
Original comment by AHeinerm
on 19 Nov 2009 at 3:28
-"It looks like the CImage struct to me"
Could not find BW/Image.h nor BW/CImage.h
do you mean there is already a documented structure like this one, or do you
mean
the name should be changed to CImage?
-"because CBullet has a smaller struct size."
yeah i forgot to note the struct size.. i think it was 112 bytes or something
-"The C prefix is the accepted name for the structure based on debug strings"
The name BULLET was just because I copy-pasted it from my source code, call it
as
you like. The C always reminds me of "Class"
Original comment by goo...@teabix.com
on 19 Nov 2009 at 5:14
Oh, yeah that's not in the BWAPI source. >.>
There are other sources that define it as such. (Images are linked to by
sprites, and
are used to display all graphic information, and perform special opcodes that
control
unit animations)
They were named that because of things like:
"Starcraft\\SWAR\\lang\\CBullet.cpp"
in the Starcraft executable.
Yeah, the size is 112 bytes. There are 100 entries.
0x0064B2E8 is the base address for bullets
0x0064DEA8 and following it should contain the information(first, last, count).
Original comment by AHeinerm
on 19 Nov 2009 at 5:41
0x0064DEA8 looks like it, but
-"Images are linked to by sprites, and
are used to display all graphic information, and perform special opcodes that
control
unit animations"
that doesn't look like this bullet array. Only grahical manifestations of a
unit's
actions are saved here, only 1 entry per action. There are probably sprites
created
to actually show the graphics. You could play zerg with an empty bullet array
if you
use meele units only.
Original comment by goo...@teabix.com
on 19 Nov 2009 at 6:09
yeah I know. That is indeed the bullet array, not the images array.
Original comment by AHeinerm
on 19 Nov 2009 at 7:00
Original comment by AHeinerm
on 22 Nov 2009 at 2:43
Original comment by lowerlo...@gmail.com
on 23 Nov 2009 at 5:25
I've started adding Attacks and AttackTypes in r1628 and r1629.
Original comment by lowerlo...@gmail.com
on 23 Nov 2009 at 9:28
nice work researching all the bullet and rocket names =D
for convenience a AttackType::getUnitType() would save lives ;)
Original comment by goo...@teabix.com
on 23 Nov 2009 at 9:35
I just added the image struct. Just a side note that the C prefix really does
indicate that it is a Class. (Confirmed when peeking at Starcraft II)
Will probably look at bullets too and add the struct.
Original comment by AHeinerm
on 7 Mar 2010 at 5:13
Bullet support completed in r2370.
Original comment by lowerlo...@gmail.com
on 8 Jun 2010 at 8:33
Original issue reported on code.google.com by
goo...@teabix.com
on 15 Nov 2009 at 6:28