Staredit Network > Forums > Modding Assistance > Topic: Dumb AI Questions.
Dumb AI Questions.
Jul 15 2019, 4:49 am
By: Blackbirdx661  

Jul 15 2019, 4:49 am Blackbirdx661 Post #1



Dumb Questions.

I've been taking a good look at the Terran Custom Script, as I've been mucking about with a lot of TvP lately I'm thinking my first try will to be make a Quick mod to make the Script more Protoss focused, so maybe more Goliaths and Firebats, cut down on the BCs try to provide a little better air-cover for the ground army.

So I would like to bounce a few Questions off you all. Please feel free to Answer or Iggy; I'm not looking for super detailed answers here, Y/N will likely do alot of the time, just seeing if my intuition is on point here or not.

Ok I've noticed Multiple blocks that look like this,

--TMCu 0115--
wait(1500)

goto(TMCu 0115)

Now to my mind that should loop indefinitely; so I am thinking that

TMCu X Code goto(TMCu X) acts as a JSR/Return Structure;

So --TMCu 0115
Wait(1500)
Return(TMCu 0115)

while other blocks clearly goto a different block of code.* Which is a little confusing to me.
But I've never touched Python, (almost conversant in VB).

This is much less obvious to me,

--TMCu 0002--
define_max(255, Terran Siege Tank<0>Tank Mode)
define_max(255, Terran Vulture)
define_max(24, Terran Marine)
... Seriously clipped.
define_max(30, Terran SCV)
define_max(6, Terran Battlecruiser)
define_max(4, Terran Science Vessel)
define_max(10, Terran Goliath)
define_max(2, Nuclear Missile)
defenseuse_gg(1, Terran Siege Tank<0>Tank Mode)
defenseuse_gg(3, Terran Marine)
defenseuse_gg(1, Terran Goliath)
defenseuse_gg(1, Terran Vulture)

--TMCu 0088--
define_max(16, Terran Marine)
define_max(4, Terran Firebat)
define_max(12, Terran Ghost)
define_max(30, Terran SCV)
define_max(12, Terran Goliath)
define_max(4, Terran Dropship)
define_max(3, Terran Siege Tank<0>Tank Mode)
define_max(3, Terran Science Vessel)

Ok so TMCu seems to be declaring an Array with with 255 Object holders for Siege Tanks
Vultures, (Which I find odd as Supply cap is 200;) 30 Marines, ... So if I am right thats the Max the AI can have in play at any one time; but then once I've done that what is TMCu 0088 doing? It appears to be redefining existing Variables? but I suppose it could be done; say at Gametime 60Sec you want a Different Army composition than when you start. Not sure I quite see the need to redefine these variables. I could see it if we have 200 slots to fill, but 255 Siege tanks would blow right through any normal supply cap.

NextQ: Ok seems we have some multitasking going on here,

attack_do()
attack_clear()
rush(7, TMCu 0008)
attack_add(12, Terran Marine)
attack_add(3, Terran Siege Tank<0>Tank Mode)
attack_prepare()

--TMCu 0008--
build(1, Terran Starport, 80)
wait_buildstart(1, Terran Starport)
multirun(TMCu 0009)
train(4, Terran Siege Tank<0>Tank Mode)
build(1, Terran Control Tower, 80)attack_do()
.... Clipped.
race_jump(TMCu 0011, TMCu 0012, TMCu 0011)

while the AI is gathering 12 Marines, 3 Tanks, et all. It is also performing all these Base/Army building tasks under Label TMCu 0008 but instead of returning it has this race_Jump(X, Y, X) Command?

--TMCu 0011--
tech(Lockdown, 80)

--TMCu 0012--
expand(2, TMCu 0007)
race_jump(TMCu 0013, TMCu 0013, TMCu 0014)

--TMCu 0014--
tech(EMP Shockwave, 80)
goto(TMCu 0015)

But once Lockdown is researched there seems to be no reason to return to it; and these don't appear to be functions so their output could be used as a value/variable? This Race_Jump Thing is just very odd looking to me; If what I read is correct it might have something to do with Mulithread programming and "Race" trapping so the 3 Labels would apply to different threads, but still why include TMCu 0011 Twice. Quite sure I am not groking that one.

Ok thats a lot for one day, Still here? I probably owe you a beer; Thanks for your time, and in advance for any replies.

BB.

----------------
*(I thought goto was banned from all programming Languages; your program was brilliant, it worked beautifully, but you used 5 Goto Statements -1 Letter grade each your Lab score for the course is an F. )



It is better to live one day as a Lion,
than 100 Years as a Lamb.

Jul 15 2019, 5:37 am Voyager7456 Post #2

Responsible for my own happiness? I can't even be responsible for my own breakfast

Quote from Blackbirdx661
So if I am right thats the Max the AI can have in play at any one time; but then once I've done that what is TMCu 0088 doing? It appears to be redefining existing Variables? but I suppose it could be done; say at Gametime 60Sec you want a Different Army composition than when you start. Not sure I quite see the need to redefine these variables.
Yes, it's changing the max composition. 255 is treated as zero.

Quote from Blackbirdx661

But once Lockdown is researched there seems to be no reason to return to it; and these don't appear to be functions so their output could be used as a value/variable? This Race_Jump Thing is just very odd looking to me; If what I read is correct it might have something to do with Mulithread programming and "Race" trapping so the 3 Labels would apply to different threads, but still why include TMCu 0011 Twice. Quite sure I am not groking that one.

race_jump doesn't have to do with race conditions, but rather the race of the nearest enemy player. It jumps to the first parameter if the enemy is Terran, second parameter if it's Zerg and third parameter if it's Protoss. So the script will jump to research Lockdown if the closest enemy is Terran or Protoss, but skip that research because it's obviously useless against Zerg.


You'll probably find Nekron's AI command guide useful, it'll tell you pretty much anything you want to know about the usage and syntax of these commands.



all i am is a contrary canary
but i'm crazy for you
i watched you cradling a tissue box
sneezing and sniffling, you were still a fox


Modding Resources: The Necromodicon [WIP] | Mod Night
My Projects: SCFC | ARAI | Excision [WIP] | SCFC2 [BETA] | Robots vs. Humans | Leviathan Wakes [BETA]


Jul 15 2019, 5:51 am Pr0nogo Post #3



There is no simple 'loop' command in aiscript, so goto (sourceblock) is the closest you'll get. Also I recommend writing in ASC3 as opposed to the Python-supported version as it's cleaner, simpler, and faster to read and to write.

If you need more complicated scripts to take apart, Hydra's 2018 and 2019 scripts are available. The techniques aren't foolproof (especially in 2018 as it's quite dated) but you should be able to reverse engineer the reason behind the code even if it's not the most sensible or simple way to get the job done. Since all my work uses the new aiscript extender commands, you'll want to reference that guide in addition to Nekron's.




Jul 15 2019, 6:05 am Blackbirdx661 Post #4



Quote from Voyager7456
[quote=name:Blackbirdx661]


race_jump doesn't have to do with race conditions, but rather the race of the nearest enemy player. It jumps to the first parameter if the enemy is Terran, second parameter if it's Zerg and third parameter if it's Protoss. So the script will jump to research Lockdown if the closest enemy is Terran or Protoss, but skip that research because it's obviously useless against Zerg.


You'll probably find Nekron's AI command guide useful, it'll tell you pretty much anything you want to know about the usage and syntax of these commands.

Ah like an old As if command if I remember that Syntax right, been years, but Cool makes perfect sense now.
And 255=0 Would have never guessed that, but I've seen something like that in Electric measurement; so now that makes perfect sense. I will check out that link, TY Much Voyager. : ) BB

Post has been edited 2 time(s), last time on Jul 15 2019, 6:18 am by Blackbirdx661.



It is better to live one day as a Lion,
than 100 Years as a Lamb.

Jul 15 2019, 6:13 am Blackbirdx661 Post #5



Quote from Pr0nogo
There is no simple 'loop' command in aiscript, so goto (sourceblock) is the closest you'll get. Also I recommend writing in ASC3 as opposed to the Python-supported version as it's cleaner, simpler, and faster to read and to write.

If you need more complicated scripts to take apart, Hydra's 2018 and 2019 scripts are available. The techniques aren't foolproof (especially in 2018 as it's quite dated) but you should be able to reverse engineer the reason behind the code even if it's not the most sensible or simple way to get the job done. Since all my work uses the new aiscript extender commands, you'll want to reference that guide in addition to Nekron's.

Thanks PrOnogo I'll take a good look at those scripts. And will look at the ASC3 as well, I kind of like that feel of the Python, its a little off for me as an old VB guy mostly, but It looks and feels like code. I tend to prefer a pretty structured Syntax, (and I know with Python thats not really necessary.) Still very good stuff TY both again for the insights and taking the time to answer BB.



It is better to live one day as a Lion,
than 100 Years as a Lamb.

Jul 19 2019, 4:31 pm IlyaSnopchenko Post #6

The Curious

Wow, a bunch of new AISE commands are incoming, never woulda thought you guys would keep on churning them out. :)



Who am I, and why should I care?

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[11:39 pm]
Corbo -- I wouldn't go to say it's unbelieveable but silly it definitely is
[11:39 pm]
Corbo -- but yes, the plot is silly
[11:38 pm]
Corbo -- don't hate
[11:38 pm]
Corbo -- Salazar was great
[11:25 pm]
KrayZee -- The President of the United States only sending only 1 man equipped with a pistol to rescue his daughter? Then Leon has to deal with midget Napoleon, how can you take that seriously? :P
[11:23 pm]
KrayZee -- The plot in Resident Evil 4? It's just too silly.
[11:07 pm]
Corbo -- You don't find that believeable?
[07:38 pm]
Wing Zero -- I played 6 for a bit but wasn't too happy with it. Haven't played another one since then though.
[2019-12-14. : 8:18 am]
KrayZee -- If Resident Evil 4 is getting a remake, they better make the plot believable. Like actually send an entire team to rescue the President's daughter but the team was ambushed and all equipment were lost. Leon is the only survivor and only kept a handgun. Later he would hitchhike and get picked up. He then asked to be dropped off the nearest town.
[2019-12-14. : 4:01 am]
RIVE -- The significance is lessened by the probability of future RE titles ignoring either conclusion in favor of a rewrite anyway.
Please log in to shout.


Members Online: Roy, UEDCommander, Excalibur, Nekron, Doodan