Unit Training Queue ?

This is a discussion on Unit Training Queue ? within the Starcraft 2 Coding board part of the Starcraft 2 forum category; I am interested in the Unit Build/Train queue, i asume a pointer to it is in the unit structure, which ...

Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1
    test1234 is offline Wannabe Member
    Array
    Join Date
    Nov 2009
    Posts
    22
    Rep Power
    4
    Reputation
    1

    Unit Training Queue ?

    I am interested in the Unit Build/Train queue, i asume a pointer to it is in the unit structure, which i have. However, i have no idea where in it it is, can anyone help me with that ?
    Additionally i am very interested in the building grid, so if anyone has any info on this i would be very grateful. In return could contribute some code to translate unit positions from their mapposition to onscreen position.


  2. #2
    UserNamex32's Avatar
    UserNamex32 is offline Moderator


    Array
    Join Date
    Jan 2011
    Posts
    638
    Rep Power
    4
    Reputation
    366
    here's a class created in C# that can handle the building grid to check if a spot is valid or not along with a few other methods in there.
    https://github.com/MrNukealizer/SCII-External-Maphack/blob/v0.13/2cs-API_Source/_2cs_API/clsStarCraft.cs


    this is one of the required/dependent structs to use the above class:
    https://github.com/MrNukealizer/SCII...uild_grid_s.cs


    As for the que it should be within the unit struct info here:
    https://github.com/MrNukealizer/SCII...Data/unit_s.cs

  3. #3
    Mr Nukealizer's Avatar
    Mr Nukealizer is offline I ♥ ¡ǝʞɐↄǝZǝǝчƆ

    Array
    Join Date
    Jan 2011
    Posts
    860
    Rep Power
    5
    Reputation
    496
    Please note that those parts of the code are not up to date, because I haven't had a reason to use them yet.
    I'm here to learn, have fun, and help others learn and have fun.

  4. #4
    UserNamex32's Avatar
    UserNamex32 is offline Moderator


    Array
    Join Date
    Jan 2011
    Posts
    638
    Rep Power
    4
    Reputation
    366
    was talking with him on IRC and found out there were some offsets that weren't in the public SVN that hadn't been updated to the latest version, idk if he was successful generating a pattern or not yet.

  5. #5
    test1234 is offline Wannabe Member
    Array
    Join Date
    Nov 2009
    Posts
    22
    Rep Power
    4
    Reputation
    1
    I still wonder about the Unit Build/Train queue. Mr Nukealizer, i see that your code has some stuff regarding abilities and was wondering if you also did some work regarding the queues, as they seem similar.

    thanks, UserNamex32, most of the stuff for the active building grid works. The offset you gave me on irc was for 1.4.2. For 1.4.3, some offsets in the struct changed to:
    BuildGridValidSquares = 168
    BuildGridInvalidSquares = 184
    BuildGridSideLength = 0xa4 # new, for ex. 5 for cc, 2 for supply depot
    with the struct offset beeing:
    BuildGrid = 0x0177CDE0
    as a pattern for 1.4.2 and 1.4.3 this seems to work: 74 0F 8D 4D D8 51 8B 0D ?? ?? ?? ?? E8
    What i still wonder about is the structure type. As a candidate i found a pointer at 0x9C, but i don't have an idea how to get a clear building id or something from that.


    Also, is there a global structure that shows where one can build and where one can't over the whole map ?

  6. #6
    UserNamex32's Avatar
    UserNamex32 is offline Moderator


    Array
    Join Date
    Jan 2011
    Posts
    638
    Rep Power
    4
    Reputation
    366
    Quote Originally Posted by test1234 View Post
    Also, is there a global structure that shows where one can build and where one can't over the whole map ?
    It must exist somewhere in some form, I would give this a try:

    make a small custom SC2 map, goto the pathing and select the smallest paintbrush that you can,
    then paint on a checkerboard pattern of pathable/buildable and non-buildable

    you might then be able to use those values you found:
    BuildGridValidSquares = 168
    BuildGridInvalidSquares = 184

    to search for a byte array within the memory that alternates those two values.

    You might sadly have to open up the map file and grab the information from there, but you want a live representation via the memory.
    It may just use the base map pathing data + units/buildings to populate/test the buildable grid.
    So that would probably be your worst case scenario, being that you would have to read the pathing from the map and then iterate through the units to generate your own data set.

  7. #7
    test1234 is offline Wannabe Member
    Array
    Join Date
    Nov 2009
    Posts
    22
    Rep Power
    4
    Reputation
    1
    Ok, i didn't check this yet but mischa seems to have this:
    https://github.com/Mischanix/Reaper/...r/MapHelper.cs
    https://github.com/Mischanix/Reaper/...ter/Offsets.cs
    which has a SomethingIsPresent function that checks the same datastructure that also has Creep in it and another GetCliffHeight function giving cliff? elevation from a structure he calls MapCliffData.

    still no idea about the production queue, anyone got any info about that at all ?

  8. #8
    UserNamex32's Avatar
    UserNamex32 is offline Moderator


    Array
    Join Date
    Jan 2011
    Posts
    638
    Rep Power
    4
    Reputation
    366
    I haven't yet seen that project, thanks for sharing : )

  9. #9
    Mr Nukealizer's Avatar
    Mr Nukealizer is offline I ♥ ¡ǝʞɐↄǝZǝǝчƆ

    Array
    Join Date
    Jan 2011
    Posts
    860
    Rep Power
    5
    Reputation
    496
    Quote Originally Posted by test1234 View Post
    I still wonder about the Unit Build/Train queue. Mr Nukealizer, i see that your code has some stuff regarding abilities and was wondering if you also did some work regarding the queues, as they seem similar.

    thanks, UserNamex32, most of the stuff for the active building grid works. The offset you gave me on irc was for 1.4.2. For 1.4.3, some offsets in the struct changed to:
    BuildGridValidSquares = 168
    BuildGridInvalidSquares = 184
    BuildGridSideLength = 0xa4 # new, for ex. 5 for cc, 2 for supply depot
    with the struct offset beeing:
    BuildGrid = 0x0177CDE0
    as a pattern for 1.4.2 and 1.4.3 this seems to work: 74 0F 8D 4D D8 51 8B 0D ?? ?? ?? ?? E8
    What i still wonder about is the structure type. As a candidate i found a pointer at 0x9C, but i don't have an idea how to get a clear building id or something from that.


    Also, is there a global structure that shows where one can build and where one can't over the whole map ?
    I haven't touched the abilities or build queues. I was planning on doing that when I started working on an AI, but then a bunch of stuff happened and I didn't have time to start the project.

    I don't know what structure you're trying to get a building type from, but if you look at unit_s.cs and the ParseUnit function in GameData.cs, you can see how I read from the unit array and get many different things that can identify the unit type:
    1. The model pointer, which is unique for that unit type, but changes every game.
    2. Some kind of model ID thing which Qazzy used to keep track of the different unit types. This is mostly the same between games, but is very likely to be messed up by patches, and will give unexpected values for new units on custom maps.
    3. The text ID used in the map to keep track of the unit type. While the method for getting it will likely change between patches, the actual values assigned to unit types are not likely to change. This will also work in custom maps, but the unit with a given ID may changed a great deal from what it is in ladder. Also note that at least twice, somebody has had a crash related to my method for getting this, so my system is not quite perfect.
    4. The name you see on the screen. This is not totally reliable for knowing exactly what you're looking at, because there can be many different units and buildings with the same display name, and it is likely to be different for people using other languages. This can be useful if you want the user to enter the name of something and work with that. Also note that my method of getting it feels like a total hack and is most likely very flawed.

    Quote Originally Posted by UserNamex32 View Post
    It must exist somewhere in some form, I would give this a try:

    make a small custom SC2 map, goto the pathing and select the smallest paintbrush that you can,
    then paint on a checkerboard pattern of pathable/buildable and non-buildable

    you might then be able to use those values you found:
    BuildGridValidSquares = 168
    BuildGridInvalidSquares = 184

    to search for a byte array within the memory that alternates those two values.

    You might sadly have to open up the map file and grab the information from there, but you want a live representation via the memory.
    It may just use the base map pathing data + units/buildings to populate/test the buildable grid.
    So that would probably be your worst case scenario, being that you would have to read the pathing from the map and then iterate through the units to generate your own data set.
    Another thing is to look at the data in one of the files in the map, I think it is T3Terrain or t3HardTile, and then try to find something similar in the game. Hopefully the realtime version is in a similar format.
    Last edited by Mr Nukealizer; 05-18-2012 at 01:36 AM.
    I'm here to learn, have fun, and help others learn and have fun.

  10. #10
    test1234 is offline Wannabe Member
    Array
    Join Date
    Nov 2009
    Posts
    22
    Rep Power
    4
    Reputation
    1
    ok, what i know about the unit training queue so far:
    it is an ability as can be seen in mischas code once again (CAbilQueue = 0x19).
    additionally, the number of units queued up are at "offset"+0x24 (you can see mischas code for how to get this offset from the abilities_pointer in the unit struct, not that simple :/)
    and, there is a array of 5 4 byte values (pointers) at the pointer at "offset"+0x30 that change when something is built, but i have no idea what those point to...

Page 1 of 2 12 LastLast

Similar Threads

  1. Looking for auto queue addon for 4.0.6a
    By primaverto in forum WoW forum
    Replies: 0
    Last Post: 03-05-2012, 09:25 PM
  2. [VIDEO]Queue for Exp-on BG as an Exp-off twinker
    By foxdodo in forum WoW Exploits
    Replies: 1
    Last Post: 12-10-2011, 08:31 PM
  3. Replies: 5
    Last Post: 10-08-2011, 05:41 PM
  4. how to get past a wow queue?
    By Dstrat33 in forum WoW Hacks
    Replies: 17
    Last Post: 08-11-2011, 02:28 PM
  5. Queue Matches Based On IP?
    By Idbjorn in forum Starcraft 2 Bots
    Replies: 7
    Last Post: 04-25-2011, 04:02 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •