what's going on everybody welcome to
part three of our AI building in
StarCraft two with Python tutorial
series in the previous video we got to
the point where we're creating more
workers creating more pylons so we can
create more workers and now we want to
do is kind of two things one is at least
we want to start collecting the other
resource that we're going to need which
is like this best being gasps and then
we also because eventually we're going
to exhaust our little area we need to
expand to new areas and we need to at
least get this stuff out of the way
before we get into the kind of offensive
types of strategies and stuff like how
are we actually going to attack our
enemy
so because up to this point we're just
trying to get our resources under
control
and then we can go on in to actually
building an army so let's go ahead and
get started so once we've got workers
and pylons the next thing that we need
is so like the workers will automatic
like distribute workers when we call
this it's just gonna automatically
distribute them across you know mining
the minerals and grabbing the gas from
the the geysers so really all we need to
do is just build the buildings on top of
the geysers and the rest is kind of
handled for us anyways so the things
that we build on top of these geysers
are called assimilators so we're gonna
go ahead and oh wait self-build
oops Oh self build underscore a
simulator and maybe we'll call this
build yeah we'll go with the simulator I
guess so then we need to along with
pylon we need to also import simulators
and and then actually it should be
assimilate tour and then we're ready to
actually build the the function or the
method rather to build the ax simulator
so what we're gonna do is come down here
and we scroll up a little
so async the build
assimilators don't forget to past self
otherwise we'll hit that error again and
then again we we want to build the
assimilators wherever we can or need to
so we want to iterate over our nexus
building so for Nexus in self dönitz of
Nexus type that are ready so the Nexus
is built what we want to do is build
we're gonna say well first we have to
find the actual like vespene geysers so
vast peen so vast beans we're gonna say
a self dot state dot vespene underscore
got geyser dot closer underscore than so
we're looking for any geysers that are
within 25 units of our individual nexus
that we're like iterating through so
that's gonna tell us where the best
beans actually are then what we want to
say is for vast peen I guess its vast
bang I don't know vespene vast mean
anyway for vast being in vast beans uh
what we want to do is if if we can't
afford one so if not self dot can afford
a simulator we just want to break not
all caps just simply break so if we
can't afford we're gonna go ahead and
break and then if not self dot units a
simulator dot cloak closer than 1.0 so
if we don't basically if we don't have
an ax simulator built on top of that
specific vest Bastien okay so as long as
if not this dot exists so this is a
really long statement but basically it's
just saying that if there's not an ax
simulator that exists
really close to that vas beam already if
so if that's not already the case we're
going to await self dot do and then
we're going to call one of our workers
to build and in fact so what we actually
need to do is if we can't afford if we
can't afford we need to break then what
we actually want to do is grab a worker
so we're gonna say worker equals self
dot select build worker and then we want
to select a build worker near here so
fast being dot position so we might find
that we don't have a worker that's like
close to that that position for whatever
reason
so if worker is none so if we just can't
find one we need to go ahead and break
otherwise as long as there's not already
a vest being there we want to wait self
dot do use that worker to build what do
they want what do we want them to build
well Ana simulator where do we want to
build it that vast peen so on this vast
this vast beam location so that should
give us our assimilators oh let's see
this is just a pair yeah so let's go
ahead and run this and see how we've
done hopefully we don't hit any errors
we are running a real time it should it
should pop it up pretty quickly so then
besides this the other thing we need to
do is we're gonna go ahead and expand
our forces in this in this tutorial and
then that way in the neck oh yeah we
definitely hit an error what was the
issue sent day but has no no attribute
unit build assimilators
for self Oh is he I think it might be
units with an s units let's try that
again
[Music]
so while we wait on that the next thing
we want to do is expand to new areas and
again
this is kind of like a low-hanging fruit
because we can just actually just call
expand now now obviously you don't want
to just expand infinitely that was just
by the way from from bought a eye right
that's just an included method let's see
if we're gonna build on top of one of
these geysers soon it should happen
relatively quickly I'm not really sure
what's gonna be required so if probably
first we're gonna make these workers and
then we're gonna build on top of the gun
SC there's one going right now
okay so we're building the ax simulator
here and then again the distribute
workers should automatically kind of
distribute workers to this simulator so
the next thing there goes another one so
the next thing that we're gonna do is go
ahead and run this expansion so I'm
gonna yes and I'm gonna come down here
I'm gonna set real time to false now so
we can just get things going a little
quicker and so after we do the build the
simulators the next thing we're going to
do is a weight self dot expand so even
though in theory we actually could do
self dot and we could just call this
expand now method that would be probably
not the greatest idea because you don't
want to just expand to all the resource
areas because especially as you get
closer to your enemy they're gonna
they're gonna it's gonna be a lot easier
for them to attack those positions
rather than then for you to defend those
positions so you probably only want to
expand and then also you're gonna have
to create the workers you only have a
limited number of workers that you can
so your supply your total population
doesn't get to exceed 200 so at some
point you're probably gonna have too
many workers anyways if you just try to
expand to all the resource areas so you
you only want to expand when it makes
sense when like you're you're really
prepared to expand now again this just
like some of the other things that we've
seen
this you know when should you expand is
actually a very very complicated
decision that you have to make but for
now we're gonna keep it really really
simple and just expand to either two or
three nexus points like a resource areas
so anyways we're gonna await self dot
expand and then we'll just come down
under here async def expand don't forget
to pass self and what we're gonna do or
how we're gonna do this is we're just
gonna say if self dot units so if self
units nexus dot amount so we don't
actually care if the nexus is it's ready
or it's being built or whatever if Nexus
dot amount is less than we'll go I'll
say three for now that's probably a
healthy expansion number any less than
that it might not be enough any more
than that it might not be enough but
again if your enemy decides to just
immediately rush you this is probably
too many to just build immediately right
out of the gate you're really stretching
yourself pretty thin but anyways so if
let's just say three for now so you're
gonna have a goal of hitting three
resource areas if self dot units nexus
amount is less than three and self dot
can afford a nexus let's go ahead and
wait self dot
expand now so the rest of the logic has
already handled for us it's a pretty
easy operation for us to make so let's
go ahead and save that run that and
again this is real time false so she it
should be like super quick okay the
whole game unless we hit like some sort
of error or something which is totally
possible
okay no air yet and actually you can
already see that we went ahead and
expanded down here immediately
and then probably relatively soon will
have expanded yep we're expanding here
and actually building a nexus here it
looks like we went down to here and
built on a geyser but there's actually
no nexus there and it looks like here
we're building on the geysers and we've
put up our Nexus and all that so anyway
as you can see this is super fast
already at the 4-minute mark we've also
put up some some assimilators here
probably not the wisest decision in the
entire world
you probably want these to be maybe a
little closer to your to where you are
so like maybe what we should do is let's
just exit we're gonna get attacked any
moment now and lose because we don't
have any fighting units
you know may-maybe rather than 25 we go
with save 15 that might be a little more
smart that way you have them just a
little closer to where we're trying to
because it's not in your favor to have
them outside of areas that you can
really protect otherwise you've just
wasted resources most likely on them I
just want to see how this does real
quick to make sure that's a little more
reasonable as long as we get something
built on these yeah that'll make sense
so then yeah once we've got those got
our pylons this guy's navigated over
here we're building our Nexus up
beautiful beautiful what about down here
also just building a Nexus here so this
looks like it's making a little more
sense we should probably keep our and
let's see if we get yes so we're
building on top of those geysers already
here again we've built on top okay so I
think probably 15 is a smarter number to
go with than 25 okay so alright I think
that's a good stopping point um guys in
my mouth now right so the next thing
that we're going to do before I finished
chewing on his ice is in the next
tutorial I think what we're going to do
is build our offensive types of
buildings so like barracks basically
only here it's a gateway and then after
the gateway is produced you want to
build this
burn annex core and then we can build
the stalker that we're gonna build but
there's so much that goes in you don't
have to you don't have to build those
same things as me if you don't want if
you want to go to like a different
entity or something like that have at it
so we're already under attack by by the
guy so we're not gonna do very well
because these guys are just gonna keep
coming after us so yeah we definitely
are our next thing here is we've got
tons of resources actually you can't
really see the resources there ya go
we've got tons of resources but we don't
have any any we're not producing any
units or anything like that and we
totally could so that's what we're gonna
do in the next tutorial if you got
questions comments concerns whatever
feel free to leave them below as always
thank you for your support your
sponsorships and your subscriptions and
all that jazz and I will see you in
another tutorial