Placeholder Image

字幕列表 影片播放

  • what is going on?

  • Everybody.

  • And welcome to part eight of the A I and Starcraft two with python tutorial syriza where we're now applying deep learning.

  • Um, and really just finding out that we have to build data first s as we often do in tutorials.

  • So, uh, what we're gonna be doing now is just kind of building on the last tutorial where we're trying to get this picture to be a good representation of what's going on in the game right now.

  • I hope you're hungry because there's gonna be some pasta.

  • So So, um, in bad jokes to go with it.

  • So, um, so this is fine for the nexus, but we want a lot of buildings.

  • You know, ideally, we'd like to see our nexus.

  • Our probes or assimilate er's are gateways are star Gates, all that stuff.

  • We want to see all of those.

  • And then we'd also probably like to see our workers in our, um, avoid race.

  • So with that, um, I'm gonna replace this code, and again you go to the text based version of the suit Auriol and grab the coat.

  • Uh, it's in the description.

  • And so I think I'll do is I'm gonna copy.

  • Actually just copied it.

  • Here, There.

  • Okay, so now I've changed this slightly.

  • We've got the draw dictionary, which contains the objects that we might want to draw.

  • This will be the size of those objects, basically the diameter of the circle.

  • And then these are the colors.

  • So we're gonna kind of color code things because, you know, continent in theory, you could, like, change these by like one value, and the confident should understand it just the same.

  • But really, for yourself, it's probably useful toe to change them.

  • But you could just do, like, full green do like to 55 g and then to 54 g for a different thing in 2 53 for a different thing.

  • I wouldn't recommend it, but you could do that.

  • The only other thing you probably want to think about is maybe drawing things in proper order, like so, from largest to smallest.

  • That way you can see things over other things.

  • You also could throw in like some sort of Alfa or something.

  • But I have to do that.

  • So anyway, then we just iterating over that draw addict and for the unit a CZ long as that unit is ready.

  • S o.

  • I talked about that last one as long as it's actually produced.

  • It's like a thing that's actual, um, we'll grab the position and then we'll draw it based on the things so the diameter and then the color.

  • So that's the visualization for the rest of everything.

  • I'm just gonna run that to make sure that the copy and pasta worked as intended.

  • And if that works, the next thing I'm gonna have us do is, um I think we're gonna do is Scout.

  • So since we're drawing it and just really in the game in general, it's really beneficial to be able to see your enemies.

  • So maybe initially you might send one of your worker units just to their death basically over to the enemy area, just to see, see what they're doing.

  • Um, and then later you can actually build like pro Toss has a scout.

  • I'm sorry.

  • It's called an observer.

  • Um, and you can send over the observer to the enemy and just kind of flowed over there and see what they're up to.

  • So So that's what we're gonna add, Should this work and bring it up.

  • So yes.

  • And now you can see it's a much more interesting result we've got.

  • Our nexus is here.

  • We've got what I believe these big blues are Star Gates.

  • Um I don't think we're actually are redrawing.

  • I forget if we draw these.

  • Yeah, we are drawing the simulator.

  • Um oh, we don't really have to import those cause we're hardly imported.

  • Those left build them.

  • Okay, so, um great.

  • But now we don't see the enemy either.

  • So that's the next thing that we want to do is we do want to draw the enemy.

  • But we also need to scout the enemy because just simply drawing like the enemy when they come to our base isn't really informative enough.

  • We want to know what's up with the enemy.

  • What are they doing?

  • What are they building?

  • How big is their base?

  • How many units do they have?

  • And we can know all this if we just send a scout to them.

  • So that's the next thing that we want to do.

  • So, um, I'm gonna just pop over here and let's add that in.

  • So, um, let me I think I'll close this?

  • Yes.

  • Now we want to do is goes that come up here And just like everything else, we want to add the method.

  • So I'm actually gonna have a way.

  • Self dot scout.

  • We're gonna do Scout as the primary objective.

  • So, um, now what we'll do is we'll come down to I guess we'll just write it up here.

  • Uh, and I think a copy pasta.

  • This one, too.

  • We'll save some time.

  • We're gonna knock out a bunch of stuff.

  • I know most people just really want to get to the deep learning part, and this is all logic that should be legible and understandable again.

  • This was all I don't remember.

  • But there's a perfect example of me just printing out the dirt of something so I could see what what it do.

  • I think I was trying to figure out how to move the dang scout.

  • Um, move to some turn.

  • Oh, we'll have to build this, um, print moved.

  • Yeah, but the the actual move coordinates have it has to be.

  • You can just pass a coordinate scummy an object, so we'll talk about that in a second.

  • But, um, that actually was really difficult to figure out.

  • I'm sure for the expert out there, you could have figured it out.

  • But anyway, all our scout method is gonna do.

  • So This is gonna take this is because it's the first thing called.

  • It'll take priority over these other things you wouldn't want.

  • You.

  • Scout is like the most important thing because the our network is working completely off of what we can see.

  • So the most important thing that we can do is make sure we can see So we want this scout to be numeral uno and importance.

  • So, um so if we have an observer, which is our scout, and then don't forget to import, it's gonna observer.

  • If we have one, we're gonna rename it to be our scout or zero with observer will be our scout should be our only one.

  • If the scout is idle, I eat.

  • It's not doing anything.

  • Um, first, we want to know what's the enemy's location, and then we want to move to that location.

  • But you could just do this like you could just move to enemy location.

  • That is a point location that could be passed.

  • But I was really curious to get it to, like, move around like so you could hopefully discover.

  • At least the two closest nexus is a CZ.

  • Well, so if you just go straight to the enemy start location, you're probably going to see the single nexus.

  • Um, and I think that you kind of want to move around to see if you could spot the other ones, too.

  • So what I wanted to do is have some variants to that, but it turns out that's not a simple as one might hope so.

  • So, uh, what you can see here is okay, we're doing random location variant, so we need to add that method.

  • So I'm just gonna come here again.

  • It's all in the text based version of senatorial.

  • You don't need to, like, pause the video and write this all out.

  • There's a link in the description.

  • Go there.

  • If I forget to put it there, let me know.

  • So this is our random location variance.

  • There was probably a better way to do this.

  • This is a lot of code for what I was trying to achieve, but this is how I figured it out so you can do the enemy start location, Which, to me, appears to be point values.

  • You can reference them at zero thing first.

  • But if you just simply return exit Why?

  • Like if you tried to return after we do this, like little modification here, just a random variance.

  • Either plus 20 or minus 20 um, up to plus 20 or minus 20.

  • Um, if you try to return, X y doesn't work.

  • It's got to be a special position thing.

  • So So it actually needs to be a two d point.

  • Um, and I guess the game is actually in three dimensions, like you've got this elevation.

  • So you really it's stress that it's a to a point, and it's like a position point like then X y So rather than just return X Y, you gotta return this big old thing for coordinates.

  • But that's gonna be super useful, especially if you wanted, like, later on down the road, to use some sort of regression to determine the perfect placement for, like, a pylon, for example, for pro toss, um, you'd want to know, like, how do I send is that perfect position or if you want to, like structure your your attack in some sort of formation.

  • You're gonna need coordinates.

  • So wow, that was really complicated.

  • But I figured it out.

  • I priced men like I don't even I even know Probably two hours or three hours trying to trying to figure out why that wasn't working.

  • Um, anyways, Lisa felt like that long.

  • So, um OK, so that's our scout.

  • And I think that's everything.

  • We just need to draw the scout at this point.

  • Um, And then we have a bunch of the enemy things.

  • So this could actually got super long, um, trying to think it looks like it cut some stuff out.

  • So I'm gonna repast in the intel, and then we'll go over that one.

  • Thanks for whoever it was that said you could just hit escape in there.

  • That's really useful.

  • So anyways, we draw our things, and then we're gonna come down here, and then we're gonna draw the enemy stuff now, because you might not.

  • You'll be fighting a different Um, yeah, there's a legit comment under that one because you don't know the enemy's, um you could do it like by enemies like name or something like that, But I just wanted to keep it as simple as possible.

  • So if it's in excess supply, Depot were hatchery.

  • We want to draw it with importance.

  • So, um so, basically, what we're gonna say is, if, um if it's not in one of these, like main base names, will draw it with the size of five.

  • But if it is, we're in a draught as a 15.

  • Just like we draw ours with a 15.

  • And then we're gonna iterated over the known enemy units.

  • So that was just the known enemy buildings.

  • And then we go over the enemy units and again, just a little workers.

  • We want to draw those pretty small.

  • Otherwise, we're gonna draw them like size three.

  • You could go into it and you could draw all of them.

  • You know, with the perfect sizes and stuff.

  • I don't think it's gonna matter At the end of the day, it might matter at the end of the day, especially if your enemy is producing, like good units or really bad units like you might actually want to dig a little deeper into that again.

  • I'm just I'm just trying to see it.

  • Is this even gonna work so, um, not too worried about it.

  • And then finally, I want to draw the observer or caps, um, sort of way to inform the neural network where the observer is.

  • Because again, if we don't have an observer that matters if we have an observer and like where that observer is and there's it's like not reporting a lot of enemy data or something like that, Um, the position of the observer matters like, maybe it's on its away or something like that.

  • So again, we want to draw the observer, and we're drawing the observer so small that we're gonna draw that last so we can again, the most important thing.

  • It's on top of everything else.

  • Okay?

  • And then we draw it.

  • Now, um, trying to think if there's oh, we need to build.

  • Are we building it up here, Let me look here.

  • So Okay, so we need to definitely build the robotics facility.

  • So, um, so we're gonna go down to offensive force buildings and add that code.

  • Basically, we're underneath the gateway times pasting it in here.

  • So if we have a cybernetics core, um, and it's ready, and we have less than one robotics facility.

  • If we can afford a robotics facility and we're not already building one, let's build one near a pylon so we can build it easy enough.

  • Okay, Uh, and I think that should be it.

  • And let's run this thing and see what we get.

  • An error right away.

  • Indentation.

  • What's the deal?

  • Don't do that to me.

  • Ah, really?

  • Is it?

  • Not sure.

  • Looks pretty pretty good to me so much.

  • You guys, let me do this.

  • Our Ooh, that looks like Oh, no.

  • Uh uh.

  • Well, they're all this.

  • What am I missing?

  • It's just that function that's angry about to find random himself can be the problem with copy pasta.

  • Um, there's no reason that we need to make that a synchronous um man.

  • Oh, that's so frustrating.

  • Uh, I really don't know.

  • Let me just do this.

  • Four.

  • Wow.

  • Okay, a copy and paste it again.

  • Suddenly, magically.

  • That worked.

  • What was the problem?

  • It's loading up.

  • We'll see what owes space.

  • Just one space over.

  • I just couldn't see it, I guess.

  • Anyway, that was the problem.

  • Okay?

  • Okay.

  • I figured we might hit an area.

  • That's why I let that one continue going.

  • All right, so we need to import the robotics facility.

  • Save that one.

  • Uh, let's run that one again.

  • Again while we wait.

  • Thank you for my most recent sponsors slash members of being off Robert Kevin.

  • See Mike Ox Long, James Howard, Another Mike Suzanne Williams, Newcastle Geek and Cigar.

  • Or is it so eager?

  • Probably.

  • Sucker, It's my guess.

  • Let me know if you're watching.

  • We're neither of those anyways.

  • Thanks again.

  • Sponsor slash members.

  • At some point, they will change the name.

  • All right, so we're building things.

  • We're still waiting on our We can at least see an enemy floating about their Oh, my gosh.

  • Ah, position not defined.

  • Ah, really?

  • So from SC to import, we want also import position.

  • Since we're using a position, I forgot to refill that.

  • Almost dump that on my face.

  • And then, hopefully if we build our observer and it appears to observe correctly, I'll probably cut it here.

  • And then in the next tutorial, we're gonna finish this up and work on, you know, saving this data, um, and then also the attack method.

  • So we're gonna have to change the attack method to currently just choose a random of the four choices.

  • And then once we start training, neural network will use the neural network to choose one of those.

  • There goes our observer.

  • It's off to a good start.

  • Um, we have the neural network choose one of those four.

  • But also, if we are victorious, we need to save that data.

  • And to my knowledge, there's no really great way to do that inside the box class.

  • Um, so we'll get to that in a little bit, but anyways, so we can see our observer is just kind of floating around.

  • Looks like he was just destroyed.

  • Hopefully, we're gonna make another one, which should be popping another one out any moment now.

  • There he is.

  • He's back on his way, actually, have no idea.

  • Like, I wonder if there's, like, a way to research like a bigger radius for our observer.

  • And then also, um, like, how are they spotting the observer?

  • How would we spot there?

  • Observer if they have one, Um, that kind of thing.

  • I'd be curious anyway.

  • So in this case, um, we're just, like, totally ignored these guys.

  • Um, do we die or what?

  • No.

  • Also probably if we send our units to the enemy base.

  • It probably a good idea to toe let our units draw above them so we can see them.

  • So our network would know.

  • Oh, we've got three units there already.

  • Like, what are the Oh, is that what?

  • Our scouts?

  • It must be what your scout sees, but they spotted my scout immediately.

  • Interesting.

  • They're just destroying us.

  • We're not gonna make it, fellas.

  • All right, so anyway, um and that's my point.

  • I don't think that you're gonna beat the hard.

  • Aye, aye.

  • And right now, we're not what?

  • We're making silly decisions, but, um, later, we're gonna make even sillier decisions.

  • Um, anyways, in the next video, yeah, we're gonna work on saving that data coming up with random choices that will save if we are successful.

  • Um, and then we'll build up a big old data set, and then we'll see if using that day said training a network.

  • Is it, um Does it tend to beat the hard, eh?

  • Aye.

  • Or no.

  • Basically, doesn't do better than random verse hard.

  • I yes or no.

  • Um, and that will tell us whether or not we can learn with this And if we can, How much better is it then, like Rando?

  • And then if it's significantly better than we can start adding more and more complex and see what we can get away with with our little generative are not generative evolutionary algorithm.

  • OK, it's almost bedtime for Harrison.

  • Okay, so if you've got questions, comments, concerns, suggestions, whatever feel free, leave them below.

  • Otherwise I will see you in the next video.

what is going on?

字幕與單字

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

B1 中級

偵察和更多的視覺輸入--《星際爭霸II》中的Python AI教程第8頁。 (Scouting and more Visual inputs - Python AI in StarCraft II tutorial p.8)

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