Placeholder Image

字幕列表 影片播放

  • What's going on?

  • Everybody.

  • And welcome to part four of our Starcraft.

  • Aye, aye, tutorial.

  • Siri's in this part.

  • What we're gonna be doing now is we've got all the resource is that we need to create some sort of army, and now we're gonna go ahead and do that.

  • So first of all, like I said before, there are tons of units that we could create.

  • And probably the best case scenario would be to create dynamic ones, like some ground units, flight units of different ones with different abilities.

  • But for now, we're gonna keep it as simple as possible and go with a decent, all around unit.

  • And that's gonna be this stalker.

  • So the stalker is going to require us to first build a gateway, which is kind of like your barracks.

  • This is where you're gonna produce all your units.

  • But then we have to produce another building called the Cybernetics Core to produce the stalker or like, unlock the stalker unit.

  • So that's what we're gonna be working on here.

  • So let me hide that panel, and we're gonna come up here and we're going to just add some more methods, so await self dot Um, and I'm gonna call this offensive force buildings and then other than just building the buildings, I feel like we might as well await self dot build offensive force.

  • So the two things that we're gonna go ahead and add into here hand we will start with our offensive force building.

  • So come down here and a sing deaf, and we're gonna do offensive force buildings will pass in self and here we go.

  • So, uh, first of all, what we need to do is like I was saying while ago I think it's the psionic core, a scion IQ matrix.

  • I forget all the terms, But anyways, there's that kind like matrix field that goes around all of the pylons and you have to build buildings inside of that matrix.

  • So the first thing we have to do is we gotta find a suitable build location.

  • So we're gonna say if self units, um, pylon dot ready dot exists.

  • So as long as we've got some sort of pylon, um, let's just choose a random one.

  • So we're just going to say, um, pylon equals self doubt.

  • Units pylon dot ready dot random.

  • So we're gonna pick one of them.

  • And then we're gonna say if self doubt units gave way dot ready dot Exist.

  • So if we have a gateway that is ready and it already exists, we then want to either build a ah stalker.

  • Or if we can't build a stalker, it means we don't have a cybernetics core.

  • So we have to build the cybernetics core now again, we could have multiple gateways, but we really want to probably limit ourselves and just have one cyber.

  • An escort is no reason to build a bunch of cybernetics course anyway, self dot units Gateway ready exists now, if not self doubt units, cybernetics, core.

  • And in fact, we probably we need to bring both of these in.

  • So it's do gateway, um, cybernetics core, and then eventually it's yes, got angry at us.

  • So, uh, we need to do that.

  • Like, let's do, uh I think it's just backslash enter.

  • Do you not want the come in there?

  • Oh, it should be.

  • Never know how to properly do this.

  • Okay, there we go.

  • Okay.

  • So now we've got gateway Cybernetics core will come on down here.

  • So, um, if if we have one or if we don't have one, but we need to do is build it.

  • So if we don't have a cybernetic score, then we need to say if self dot can't if self dot can afford a cybernetics core, Um, we only need one of these.

  • So then we're gonna say and not dude and not self dot already pending a cybernetic score.

  • Then what we want to dio is away self dot Build a cybernetic score near, said Pilon.

  • So from very beginning that random Pilon that we're just gonna select.

  • Okay, so that's that.

  • If now, if a gateway doesn't exist, we need else If, um, self dot can afford if self can't afford a gateway.

  • So if we can't afford a gateway and not self dot already pending a gateway.

  • So if we can afford a gateway and we're not already pending on a gateway, then what we want to go ahead and do is a weight poops away, self dot build gateway.

  • Um, and again, we want to build a gateway near a pylon or the pilot, the rain and pylon that we found.

  • OK, so that's our offensive force buildings.

  • Now we actually want to build the offensive force itself.

  • So a sink a sink?

  • Uh um offensive bill.

  • Defensive force again.

  • Don't forget to pass self.

  • And now here.

  • What we want to dio is, um we need to make sure that, um we're not like you don't want to wind up building way too many units.

  • Um, and for now, we're just gonna We're gonna try to build some units, but workers air probably gonna get in the way.

  • We'll see how it goes, at least initially.

  • Will have a few.

  • I just want to build them and then in the next one will talk in the next tutorial will talk more about howto logically split these about.

  • I think we'll get away with this, but we'll see.

  • So what we're just gonna say is four.

  • Um, in this case, we're gonna try to build, um, we're gonna try to build thes stalkers from our gateway.

  • So what we're gonna say is four gateway early.

  • See, we'll call it G w for G w in self dot units gateway.

  • And then this should be dot ready dot note you.

  • So for each gateway inn are ready gateways.

  • Um, if self dot can afford a Z lot.

  • We're not a Z a lot, um, wanted to stalk her.

  • And that's come up here sometimes a stalker.

  • Zilla is the most basic unit.

  • I want to go with stalker instead.

  • Um, Stocker.

  • Um well, we'll see what happens.

  • We're probably hitting air on that one, too.

  • Um, well, we'll go ahead and build the stalker anyway, Um, early.

  • So if we can afford the stalker and self dot supply left is greater than zero.

  • What we're gonna do is await, self dot do.

  • And then we're gonna train G w dot train a stalker.

  • Okay, so this one, we're gonna definitely want to not be a real time.

  • And let's go ahead and run it and see what's see how that goes.

  • Hopefully no air.

  • We'll see.

  • Though we've added a lot of code, something's probably gonna throw in air.

  • So we've got our pylons up.

  • What's this coming?

  • And we got a gateway coming in.

  • Um, looks like we got there.

  • Cybernetics core is coming in, and then hopefully at this point, Yeah, we're already warping in a stalker so that actually that logic worked out for us.

  • We're definitely going to be competing stalkers against our little workers.

  • Um, but that's good enough.

  • Cool.

  • Okay, so now we have our little offensive force is incoming.

  • Um, and what we need to do next is probably be build in a little more reasonable types of strategy.

  • Here.

  • Let's go ahead and highlight these And like, we wantto first of all, like when this stuff's happening, I wanna be able to send him over here like I can right click him over and bring him in and just annihilate those amateurs.

  • But we'd like that to happen automatically.

  • The next thing is ah, we're at least right now.

  • I mean, we're our supplies constantly, way ahead of you know how many of our like fighters we have.

  • But we probably don't need that to be happening Eventually, we don't need to keep producing these little workers.

  • There's not much point because eventually to we're just gonna run a space.

  • And really, we want more of our little fighter units.

  • Also, it be probably advantageous to, rather than just having one gateway have many gateways.

  • So anyways, in the next tutorial, that's what we're gonna cover is how we're gonna actually build our strategy to create our units.

  • How many units do we want and then possibly, um, go ahead and attack the enemy with some decent logic and hopefully come up with our first victory.

  • So that's what you guys have to look forward to.

  • If you have questions, comments, concerns, whatever.

  • Feel free to leave them below.

  • Otherwise, I'll see you in the next tutorial.

What's going on?

字幕與單字

單字即點即查 點擊單字可以查詢單字解釋

B1 中級

構建AI軍隊--《星際爭霸II》中的Python人工智能教程第4頁。 (Building an AI Army - Python AI in StarCraft II tutorial p.4)

  • 3 0
    林宜悉 發佈於 2021 年 01 月 14 日
影片單字