字幕列表 影片播放
-
what's going on?
-
Everybody.
-
And welcome to a highlight 2018 tutorial.
-
Siri's in this video.
-
We're gonna be introducing you to the highlight competition as well as writing a very, very simple bought.
-
So if you're not familiar with how light, basically it's just a competition where it's like you versus one or you versus three other players in a sort of environment and the ideas who can write the best.
-
Aye, aye.
-
And by I I mean anything from rule based II to ML or Deep learning bots in general, at least historically, the last two, the winners don't know.
-
Sure about the 1st 1 I'm pretty sure the winners in the first Hala as well we're rule based.
-
But I might actually be running that I can't remember anyways.
-
But how light to definitely rule based one.
-
Um, so anyways, um, what we're gonna be doing here is just making, like, a really basic body.
-
But first, I just want to talk briefly about the rules, or like how it's done.
-
So this, at least this is like a visual ization of, um, you know, I get a single game frame, but basically you've got a bunch of frames, and then you start off with just a shipyard.
-
Like this green thing here is the Green Player shipyard.
-
You can create some ships, the's like turtles or your ships, and then you run around and try to collect this Hal I TTE and from you know, each ship could hold up to 1000 how light goes to the the drop off, which is either a unique drop off location or, in this case, the shipyard.
-
You can also drop off at, um and then you just kind of repeat that process.
-
You build more ships, you can get more.
-
How light you could build more drop offs.
-
But ships cost and drop offs cost and so on, so it gets fairly dynamic.
-
But most of this task boils down to micro and padding.
-
It's all about the path.
-
So, um, anyways, I I think that's enough for us to just kind of jump in and run through some information.
-
Now, just a case I forget to mention.
-
And at the end, there is plenty of let's see here, learn documentation here.
-
You'll also maybe go to downloads and download the python version for your operating system.
-
so, Yeah, the python three version for let's say, Windows 64 boom.
-
You might want to grab that and look through.
-
Um, otherwise, I'm just gonna go ahead and jump in.
-
Also, one more thing.
-
The AP, I documentation.
-
So, uh, this just contains information about your game, various commands that you have at your disposal and so on.
-
But if you do download the highlight three, I do want to just point it now, Where did I put it?
-
Still may be in down.
-
Yeah, So you could open up my bought.
-
Most of what we're gonna run through here is gonna be very similar.
-
At least most bought starting off are going to look pretty identical.
-
They're gonna have all the same kind of start information.
-
Ah, but you can also go into H l t, which is kind of the a p I.
-
So to speak for python, and you can get more information about what's available to you keep going to open with, uh, on my main computer.
-
I have sublime.
-
That's what I use anyways.
-
And you can kind of see here what various attributes are.
-
You can make drop off.
-
And like all that stuff.
-
It's probably just a good idea to go through here and read these, but I'm not gonna do that together with you guys.
-
I think you can do that on your own time.
-
So now let's go ahead and run through some code.
-
So I'm gonna hit this play here, and then go to the editor If you want to develop locally, you can, um, in probably in one of the future ones.
-
We will.
-
Definitely.
-
If we do the, uh, get to, like, ml on deep learning bots, we'll definitely need to do local development, cause we'll have toe training stuff locally, get a model, then we need to be able to upload that model.
-
And at least right now, or at least last time I looked to see V two wasn't included, so we'd have to do some other fancy stuff to get that working.
-
But for now, we can click on the editor.
-
Uh, we will go with Python three.
-
Let's see what we start with here.
-
Okay, so we start with basically, um Let's see if I can zoom in it all without destroying everything.
-
Good enough.
-
Okay.
-
Um, So this is just that that package that I was just showing you.
-
If you download it locally, you can see there are various constant values.
-
Things like your How much does a ship cost and so on?
-
Ah, you can download er not down there, but you can get the directional, uh, basically just the directions from hlt dot position ALS.
-
So any ship can move either up, down left, right.
-
And these air referred to as north, South, West, east.
-
Um, so that's those and random.
-
I think that's just to pick a random movement in a moment.
-
Logging.
-
This is your best friend right now, because basically, the entire game is gonna happen.
-
You've got multiple players playing against each other and many ships.
-
Everything's kind of happening all at the same time.
-
So later on, when things don't go well, you're gonna wanna have been using logging.
-
Kind of like you might use, you know, print statements.
-
Our print functions in your actual code.
-
Now it's gonna be a little harder to use prints.
-
So and so we're going to use logging and save it to a log file.
-
And then when the game's over, we can go into that log file and make sure things were happening the way we intended.
-
So here the game is initialized, and then you send in your, um, whatever name you want for your bought.
-
Now, at this point, it's important to note that the two second per turn timer starts so you have 2000 milliseconds per turn to make all of your your movements.
-
So again, with like a deep learning by, it might take longer than two seconds to load in your model, so you would want to have loaded in a model prior to game dot ready.
-
You might also grab some certain initial game state variables, make some calculations or whatever, and maybe for whatever reason, those take longer than two seconds.
-
You would want to do that before you said game dot ready.
-
So here there's just a simple example of a logging logging string and then begins the game loop.
-
This is just a simple while.
-
True loop.
-
This updates every frame.
-
You're gonna have this every single time.
-
This gives you some basic data about the game.
-
What's going on?
-
This has some basic data about the game map itself.
-
A little bit later, we'll get a little more deeper into into how that works and stuff.
-
But for now, simple stuff.
-
Command HQ.
-
You basically here As you generate through your ships, you can only, you know, send your command Q one time.
-
So first you take your command.
-
Qu build, you fill it with all your commands.
-
Like if you got five ships, each of those five ships could have a certain command that it's going to do.
-
So we send each of those ships, you know, one command per ship into the command.
-
Q.
-
Now, here is basically they're just asking Hey, um, if the ship positions So where is the ship?
-
So if we check the game map so the ship position is gonna be a coordinate if that ship positions.
-
So if those coordinates on the game map and then we can check at those coordinates, what's the hal?
-
I'd amount if that Hal I'd amount is less than the Max Hallett, which is 1000 divided by 10.
-
Or if the ship is full, meaning the ship has 1000.
-
Hal, I TTE, we want to move that ship now.
-
If that's not true, then we want that ship to go ahead and just eight.
-
Still continue collecting, Hal.
-
I'd So, um, so this pretty basic logic.
-
Now, if we want that ship to move at the moment, it's just gonna randomly move, and it's just gonna move, you know, north, south, east, her west Just simply randomly.
-
No, no riel logic associated with it.
-
It's just kind of move.
-
Um, then we come down here if if you're in the 1st 200 turns and you have enough How Light Spanish ship Don't spawn a ship if you have a ship at port because the ships will collide.
-
Now, if two ships collide, they both sink to the bottom of the ocean, and their Hallett is just kind of released s so you would want to go when two ships collide, chances are there's a big pile of how light there.
-
So you want to go collect it, But you'd rather your chips don't collide.
-
So, um okay, so with that, let's go ahead.
-
And we could just run this real quick.
-
Possibly my zoom might have screwed some things up.
-
Was right.
-
You have my eyes and messed it up.
-
Uh, so when we run it Ah, here is the replay.
-
Basically, you're just playing yourself in this little replay, and then you can also click down here and move up to 10 X just so you can kind of see how things went.
-
Now you can see up here.
-
Green has, um somehow 5 62 I'm not quite sure how that could have occurred.
-
We must have accidentally, uh, gone over the depot and deposited some just by chance.
-
You can also see year two of our ships definitely collided there.
-
Okay, so this is just some, like, super super basic, and it's just gonna be by chance whether or not one of these ships actually goes and deposited deposits somehow light.
-
Now, when you are ready, Um, if you've built everything in here, you can just go in hit submit, and that's totally fine.
-
Um, and you'll basically start playing, but you'll probably want to do something a little more complex than this before you submit.
-
So in the next tutorial we're gonna talk about is, you know, doing things like intentionally making drop offs and maybe moving around slightly more logically.
-
So anyways, if you have any questions, comments, concerns, whatever, up to this point.
-
Feel free to leave them below.
-
Otherwise, I'm gonna see you guys in the next tutorial where hopefully we do a little better than we have here till next time.