PDA

View Full Version : [Medium] [Teams] 12/06/06 - Competition - Rebuild Base Macro



TheTempest
12-06-2006, 08:49 PM
Hello,

Hack (Idea from - gamepin126):
Rebuild Base Macro.



Say you press a button at the beginning, build a base, and press the button again to stop recording. Then you do a button/command it'll rebuild the base exactly.


The way I thought it would work, would you could have a saved script, per build. So... /loadscript FastestUpperLeft and then you'd build a base, for the top left base. You could repeat for each base position.

Inthis light, issue a command:
/save <script name>. Then simply start saving the cmds. Then, have another command, /load <script name>, and finaly an /execute (or something along those lines).

Extra Credit:
N/a

Time Limit:
3 weeks.

Additional Requirements:
As usual, you must provide full documentation on how you came up with it. Tutorial format would be ideal.

Good luck.
TT

Zephyrix
12-07-2006, 11:04 PM
Not that hard, press a hotkey, do a full command log on yourself (store it in a buffer), and when another hotkey is pressed, resend the commands. The most difficult part would be finding the time elapsed between each command issued, and also waiting that long, but that's about as hard as it gets. The problem with this though, is the required resources - minerals, gas, supply.

White Tiger
12-08-2006, 07:32 AM
Be more useful if someone could make simply a recording macro that actually works T.T

as in, i press F6 or something then 4sd5sd6sz7sz8sh then F6 again and then when you press F7 it will automatically do this. I've tried several like it(yes omg i wanted savior macro) but none worked. something like this ould be really fun to toy around with! =]

LAWL IM A LEECHER!?

TheTempest
12-08-2006, 09:33 AM
Not that hard, press a hotkey, do a full command log on yourself (store it in a buffer), and when another hotkey is pressed, resend the commands. The most difficult part would be finding the time elapsed between each command issued, and also waiting that long, but that's about as hard as it gets. The problem with this though, is the required resources - minerals, gas, supply.
Thus the medium difficulty :smile:, unless you believe it should be something else.

Actually, it's a little more complicated than that. You have to also keep the UNITIDs that were in the selection buffer at the time the cmd's where issued, and then match the selection buffer to the unit that should get the cmd.

To solve the time delay issue, simply store the current time in a congruent array. Then, when you go to re-issue the cmds, take the time differences, sleep that duration, then send cmd.

Does this mean you are entering?

Zephyrix
12-08-2006, 07:24 PM
Thus the medium difficulty :smile:, unless you believe it should be something else.

Actually, it's a little more complicated than that. You have to also keep the UNITIDs that were in the selection buffer at the time the cmd's where issued, and then match the selection buffer to the unit that should get the cmd.

To solve the time delay issue, simply store the current time in a congruent array. Then, when you go to re-issue the cmds, take the time differences, sleep that duration, then send cmd.

Does this mean you are entering?

No, I'm not entering. Also, the units that are in selection buffer doesn't have to be kept, except for the first command issued. I believe an 0x09 selunit command is already sent when you click on a unit, so you don't need to reselect it again.

Megaz
12-08-2006, 08:37 PM
I'd love to learn to create hacks, I only simple java from school though.

TheTempest
12-09-2006, 04:30 PM
No, I'm not entering. Also, the units that are in selection buffer doesn't have to be kept, except for the first command issued. I believe an 0x09 selunit command is already sent when you click on a unit, so you don't need to reselect it again.

Ah, I forgot about that, if your logging, your also logging the select commands. Good point.

Zephyrix
12-09-2006, 10:03 PM
That is, except for the CURRENTLY selected units, because you already issued the select unit command, so you still have to craft a command for that, and send it first, then the recording.

badman1
12-10-2006, 06:25 PM
would be awesome if you could do this like right when you got in game and it would rebuild the base you had last game

if money was no object

gamepin126
12-10-2006, 06:43 PM
would be awesome if you could do this like right when you got in game and it would rebuild the base you had last game

if money was no object

If you start building as soon as you start the map, you'll have to take time to gather resources before building, if whoever makes this does it correctly, then minerals shouldn't be an issue.

badman1
12-10-2006, 11:33 PM
im just saying, it would be great if one setup from a previous game worked well if you could like save it and use it again in another game if you started in the same place and had the money etc.

gamepin126
12-11-2006, 02:19 AM
im just saying, it would be great if one setup from a previous game worked well if you could like save it and use it again in another game if you started in the same place and had the money etc.

The way I thought it would work, would you could have a saved script, per build. So... /loadscript FastestUpperLeft and then you'd build a base, for the top left base. You could repeat for each base position.

StarCrap
12-11-2006, 03:49 AM
Yes, I would expect this hack to be able to load whichever script you desired, given the map and position. Maybe more in-depth scripts could compensate for every position on a particular map. Going even further, maybe the script dll could have a few global "api-style variables" such as map, and position, that the script could use as a reference, in order to best choose the actions to take.

I feel this hack wouldn't be extremely impossible, but would take a lot of work to perfect. This would be something interesting to see, and is almost borderline artificial inteligence scripting. Maybe in the future, provided many additions were made to this script hack, there could be one macro that would play entirely on its own and have a chance at winning. :)

badman1
12-11-2006, 10:54 AM
The way I thought it would work, would you could have a saved script, per build. So... /loadscript FastestUpperLeft and then you'd build a base, for the top left base. You could repeat for each base position.

exactly, oh man thatd be awesome.

TheTempest
12-12-2006, 07:12 AM
The way I thought it would work, would you could have a saved script, per build. So... /loadscript FastestUpperLeft and then you'd build a base, for the top left base. You could repeat for each base position.

Very nice. Change reflected in competition.

OverFlow636
12-12-2006, 12:23 PM
ima enter

if anyone wants to join me in a team say so it will speed the hack up a bit

[edit]
my status on this hack is almost finished, i have the /record and /domacro done, just need to save to file and load from file
the macros somewhat work, issueing the command is done and waiting before doing the next on the list is also finished

all i have left is to parse my command buffer for the different selects and make sure a unit gets selected, like a drone that dosent exist anymore will have to have an idle one take its place which is proly the hardest part of this hack

heres an example of how the human readable scripts will be for my plugin at least


Time:23CF1F62 Length:10 Data: 14 A5 08 E7 00 A1 0E E4 00 00
Time:23CFD44B Length:4 Data: 09 01 BB 0C
Time:23CFD9F8 Length:8 Data: 0C 19 44 00 0E 00 8F 00
Time:23D0C497 Length:8 Data: 0C 19 40 00 0F 00 83 00
Time:23D0C736 Length:4 Data: 09 01 BB 0C
Time:23D0CE7A Length:8 Data: 0C 19 45 00 0F 00 83 00
Time:23D0D158 Length:4 Data: 09 01 AE 0C
Time:23D0DC07 Length:8 Data: 0C 19 44 00 0D 00 8F 00
Time:23D27F76 Length:8 Data: 0C 19 3F 00 0D 00 8F 00
Time:23D281D7 Length:4 Data: 09 01 A6 0C
Time:23D2888E Length:8 Data: 0C 19 45 00 12 00 8F 00
Time:23D28CA5 Length:4 Data: 09 01 A8 0C
Time:23D28E6A Length:8 Data: 0C 19 4B 00 0E 00 8F 00
Time:23D329BF Length:8 Data: 0C 19 3D 00 0D 00 8F 00
Time:23D344AA Length:1 Data: 18
Time:23D3496D Length:10 Data: 14 95 09 9B 01 00 00 E4 00 00
Time:23D497F5 Length:4 Data: 09 01 BB 0C
Time:23D49A47 Length:8 Data: 09 03 8B 0C 87 0C 89 0C
Time:23D49CF7 Length:3 Data: 23 29 00
Time:23D4A013 Length:4 Data: 09 01 BC 0C
Time:23D4A2C3 Length:8 Data: 09 03 8C 0C 8A 0C 88 0C
Time:23D4A4B7 Length:3 Data: 23 29 00
Time:23D4AC97 Length:4 Data: 09 01 87 0C
Time:23D4B011 Length:1 Data: 19
Time:23D4B532 Length:4 Data: 09 01 89 0C
Time:23D4B8CC Length:1 Data: 19
Time:23D4BB9A Length:4 Data: 09 01 8B 0C
Time:23D4BE3A Length:1 Data: 19
Time:23D4C157 Length:4 Data: 09 01 8A 0C
Time:23D4C426 Length:1 Data: 19
Time:23D4C733 Length:4 Data: 09 01 88 0C
Time:23D4CACD Length:1 Data: 19
Time:23D5D8D2 Length:8 Data: 09 03 86 0C 89 14 8A 14
Time:23D5E371 Length:3 Data: 23 29 00


i say human readable one because it will dump 2 files per script one like above and a 'compiled' version of it so that i dont have to parse text at all.

im also gona see how much extra work it would be to make the scripts a lil easier to edit outside of sc but that could get pretty bad pretty fast

badman1
12-15-2006, 09:30 PM
I keep checking this thread, I cant wait this is gonna be one of the funnest hacks.

OverFlow636
12-15-2006, 11:34 PM
I keep checking this thread, I cant wait this is gonna be one of the funnest hacks.

yea almost done, currently it works for terran and tos if you know how to use but ill make it work for zerg soon and finish up the saving of scripts to file then its done

badman1
12-16-2006, 12:01 AM
Ill beta it :-)

And I never use zerg so more good news :-)

Lets do this. Cant freakin wait!

K? Pŕo?ćtiόnŹ
12-16-2006, 08:48 AM
I dont see how this is going to work if the conditions of the maps differ. Like say your in a game all by yourself and you record a macro and the select command will select the unit ids and blah blah blah. Now lets say you join a game with 5 people, those unit ids are going to change so youll be selecting someone elses units, or no units at all. The unit ids will change (Im pretty sure) and that will render it all just useless.

Zynastor
12-16-2006, 09:55 AM
I think there will be all sorts of problems with this competition but still looks fun.

TheTempest
12-16-2006, 10:42 AM
The simple solution to that is when you are executing the macro, check the unitID before the "selectUnit" cmd is issued, if the unitID is either not yours or not avaiable, then pass it a different unit, one that is yours and is available.

Zephyrix
12-16-2006, 11:28 AM
The problem with that is it will mess up the timing. For example, say the unit was a SCV, and it needs to move to the destination build spot before it starts building, and after x amount of time, it will be issued another command before it finishes building.

OverFlow636
12-16-2006, 11:32 AM
I dont see how this is going to work if the conditions of the maps differ. Like say your in a game all by yourself and you record a macro and the select command will select the unit ids and blah blah blah. Now lets say you join a game with 5 people, those unit ids are going to change so youll be selecting someone elses units, or no units at all. The unit ids will change (Im pretty sure) and that will render it all just useless.

exactly correct, but what im doing now with p00nu is modifying his idle worker function to use for this, after i issue a select ima check if anything is selected , if not then i select an idle one of whatever type was suposed to be selected and then continue with the commands



so like right now if i select a probe and then do my /record and build a base then /save, i can go into another game and hope im in the right spot and do my /load command and it will work fine because i selected the probe before starting my command logger, when i finish it wont matter if you start /record and then select the units you want to build stuff.

K? Pŕo?ćtiόnŹ
12-16-2006, 11:33 AM
zyz just posted why that wont work =-\.

OverFlow636
12-16-2006, 11:38 AM
i have added time to every command just for lag and other reaons

Zephyrix
12-16-2006, 11:42 AM
Instead of a static timeline, use a dynamic one, which makes it that much more difficult.. you could make it conditional, like when x building is built, wait x ms then build something else, or mine, or when x unit reaches (x,y), issue next commands, etc..

and just so you know, I made the IdleWorker function a while ago.. ;p

OverFlow636
12-16-2006, 11:47 AM
ah yea, im trying to stay away from ai stuff.

i think that as long as people dont expect way too much from it and they only use it at the start of games for bulding initial base it should be ok 70% of the time. the longer the scripts get the more time this thing has to fuc kup and stuff.

another way i was thinking to fix the problem was kind of half assed because it would only be ok for protos prettymuch, it was designate a probe to be main builder and all commands logged will be sent to him to do. but terrian and zerg couldnt use that because terrans take long to build buildings and zerg builders dont survive

K? Pŕo?ćtiόnŹ
12-16-2006, 11:50 AM
I just got an idea, why dont you have it so the users designates the units he wants to do the script, like have the user set which unit is which so its perfect.

Zephyrix
12-16-2006, 11:54 AM
That's going to be a pain in the ass.

K? Pŕo?ćtiόnŹ
12-16-2006, 12:00 PM
But it would work for sure =O

OverFlow636
12-16-2006, 12:11 PM
would eithery of you want to join the team :)

Zephyrix
12-16-2006, 12:12 PM
Or the other way around, ftw?

StarCrap
12-16-2006, 02:00 PM
I haven't read the entire post, but I noticed that a few of you are trying to base when certain actions are to be taken on a 'timeline' of sorts.

If I were to do this, myself, I'd probably (depending on how long you intend for a recording to be) choose between using GetTickCount, or QueryPerformanceCounter/Frequency. Then, constantly checking every click, unit selection, command, etc, against the current value returned from either counter method, using the times as an offset from the original time. This would eliminate the need for timers, or a variable large enough to hold the values that could potentially drift towards infinity (we all know the end user isn't as smart as the maker).

Anyways, this is what I'd probably do. This was just something I was thinking about while reading this topic.

gamepin126
12-16-2006, 07:32 PM
Perhaps instead of making it a time line, you could make it when do the action when you have the appropriate amount of resources. Best speed possible ftw

Zynastor
12-16-2006, 09:23 PM
Thats probably how I would do it pinner, because if something went wrong and you didn't have enough resource to build then it would screw the entire thing up and this way will give you the fastest speed possible as pinner said.

Zephyrix
12-17-2006, 01:47 AM
That makes it more and more like an ai script.

gamepin126
12-17-2006, 02:21 AM
That makes it more and more like an ai script.

No, that makes it more like an improved macro.

OverFlow636
12-17-2006, 05:21 AM
That makes it more and more like an ai script.

totally aggree with ya and i dont really want to turn this into an ai, way too much code for what its worth

StarCrap
12-17-2006, 08:50 AM
Well, in all reality the end product of this specific challenge will probably be a waste of time. It'll be cool to watch once or twice, but if it's not going to become AI-similar, what's the point? It's dumb to use the same strategy every game - the opposition changes every game, so should your strategy.

What I had in mind while reading this, was something that would keep track of what the opponent is building, and your AI hack would just counter it with the best available option, given your current minerals, gas, etc. This way you could have a chance of winning every game. This could still be made into different AI scripts.. say maybe one that strongly opposes the use of air, or one that favors the use of air over ground, etc. These scripts would know the ratio of minerals to gas that would be most efficient for mining, and so on. This way of going about things would be much more intense. :)

K? Pŕo?ćtiόnŹ
12-17-2006, 10:37 AM
Or how bout in a fastest game, you mimic someone else =D

OverFlow636
12-17-2006, 06:21 PM
Well, in all reality the end product of this specific challenge will probably be a waste of time. It'll be cool to watch once or twice, but if it's not going to become AI-similar, what's the point? It's dumb to use the same strategy every game - the opposition changes every game, so should your strategy.

What I had in mind while reading this, was something that would keep track of what the opponent is building, and your AI hack would just counter it with the best available option, given your current minerals, gas, etc. This way you could have a chance of winning every game. This could still be made into different AI scripts.. say maybe one that strongly opposes the use of air, or one that favors the use of air over ground, etc. These scripts would know the ratio of minerals to gas that would be most efficient for mining, and so on. This way of going about things would be much more intense. :)


that would be so huge its not worth making

StarCrap
12-20-2006, 04:26 PM
You're right, but anything less isn't worth making either, if you ask me.

Also, I was brainstorming about this for a little bit. I don't think it'd be insanely hard, or even insanely huge, either. It's an individual player stat hack, arrayed for every player in the game. Certain events the stat hack receives "player is building a unit", "player is moving here", "player is going air", "player is going ground", etc, would trigger your local events, such as "counter by building best unit for countering opponents air unit", "counter by building best unit for countering opponents ground unit", etc. Then, all you would have to do is extend an "auto base defense" hack to protect your base against enemy attacks, or respond to one of the incoming opponent events related to "player is moving to X, Y" and attack accordingly.

All of these things would just be wrappers around already available in-game functions, provided by starcraft of course.

Now, obviously I simplified this process a little but, but you can see it's not an impossible thing to create. Taking this one step further, and allowing user created AI scripts could sway the personality of the scripts by building an air unit more often in response to the opponent building ground, and so on.

TheTempest
12-22-2006, 09:38 PM
You're talking about AI scripting, I wonder if you couldn't write a script and have SC execute it...

Perma
12-23-2006, 11:41 AM
I was working on something sort of like what StarCrap is suggesting, except for attacking an enemy base. How you used it was simple - you selected units, and right-clicked into an enemy base.

How it worked was all enemy units within a certain range of your click would be saved to a linked list sort of like Starcraft's, and from there the hack would determine what targets to destroy and the order to destroy them depending on what units you had selected. This meant the best possible strategical targets were selected and destroyed first. It was pretty easy, just a lot of code. The only part that I found difficult was how to know when to assign a new target. At the time, I didn't know that there was an idle command.

But for what StarCrap is suggesting, you'd have to have your hack monitoring the actions and positions of players at all times, all over the map. That'd be painstaking at best, but possible.

badman1
01-01-2007, 11:27 PM
overflow died :-(

K? Pŕo?ćtiόnŹ
01-01-2007, 11:34 PM
how so?

punture
01-02-2007, 12:01 AM
Wasn't Inhale first designed to carry out a similar function? AI Script?
dt should explain a little then..

OverFlow636
01-02-2007, 09:04 AM
theres no one good way to do this hack for every race to use it the best, therefore ima proly open source this project up and just finish the protos one ive been doing. someone will be able to understand my source and finish it up for the other races however they think it would be best done for them.

badman1
01-02-2007, 10:44 AM
Argg... I was hoping for terran. Thanks for even trtying though, maybe I'll still be able to manage.

badman1
01-16-2007, 08:08 PM
been bout 14 days, just thought id casually mention this...

not trying to rush/beg/ etc

just mentioning, you made it sound like you were about finished...

laocoon
01-22-2007, 01:44 PM
so, did anyone think of using the replay features... It saves the times the selections, and executes them all legally. It makes an exact replica of the game. Also while /domacro is working, you should take any actions done by the player and cancel the macro if they are used... that way if you get attacked it doesn't ruin your whole day by messing with selecting units while you are trying to defend... (I'm a bit late, but just throwing out thoughts!)

Squid
01-28-2007, 12:34 AM
I haven't played Starcraft in months and I don't know what an AI script is, but anyways it sounds like you guys are just making yourself a Computer. lol... Just make yourself a really good computer that counters every unit created by an opponent depending upon resources and space.

Also from however you guys are making this are the buildings going to have any strategic order or is it going to be an exact replica of your previous game?

Kitten
01-29-2007, 06:28 AM
if someone were to make the AI do that (create the exact strategical unit to counter the oppositions') then the AI would technically be unbeatable, because for everything you created to try to trick it, it would know and create the bane of it... no one could win, it's be like playing Halo 2 on SWAT, while your enemy is in Juggernaut mode.... lol

K? Pŕo?ćtiόnŹ
01-29-2007, 01:10 PM
if someone were to make the AI do that (create the exact strategical unit to counter the oppositions') then the AI would technically be unbeatable, because for everything you created to try to trick it, it would know and create the bane of it... no one could win, it's be like playing Halo 2 on SWAT, while your enemy is in Juggernaut mode.... lol
Lol? Not funny?

laocoon
02-01-2007, 01:08 AM
if someone were to make the AI do that (create the exact strategical unit to counter the oppositions') then the AI would technically be unbeatable, because for everything you created to try to trick it, it would know and create the bane of it... no one could win,

Apparently someone didn't think that ai scripts will never completely beat out the competition. Max out on zergling... they get a bunch of mutalisks so you can't hit their mutalisks. i guarentee that if you max out your zerglings both population and upgrades, you'll kill the enemy before they kill all your zergling... how hard is it to build more zergling to reinforce? ok, so lets say they go for lurkers instead of mutalisks, then you send your zergling in to just die, you are left to start over and they still have all the lurkers. I guarentee you'll always find some weakness because of the logistics behind ai scripts.