[User] Please transcribe this text

[Assistant] We want to fill out a helper function called drawPlayer, which will essentially be used to draw all of the circles on the canvas to represent all of the users.


[User] Please transcribe this text

[Assistant] You'll notice there's like this line right here, uh, which we call ConvertCord on the x and y, and we get some new values out.


[User] Please transcribe this text

[Assistant] And this is essentially the conversion between like that real coordinate system we were talking about and the inverted, uh, canvas manager or canvas HTML coordinate system with the downwards facing the wild.


[User] Please transcribe this text

[Assistant] So this actually handles all that for us, and we don't need to think about that when we're using the HTML canvas. So we can just directly use, uhm,


[User] Please transcribe this text

[Assistant] This other helper function we've written for you called fillCircle, which will draw a circle on the campus. So if we say fillCircle and look at like what arguments this takes, this takes in something called the context.


[User] Please transcribe this text

[Assistant] And remember, like, we want to use these converted coordinates to do that. So we'll say this should be drawn x, and this should be drawn y.


[User] Please transcribe this text

[Assistant] Finally, the circle, the fill circle function will take in a few other parameters like the radius of the player, as well as the color of the player.


[User] Please transcribe this text

[Assistant] Uhm, in line 32, we have this drawCanvas function. Remember that this drawCanvas function was what we called from game.js. And within that drawCanvas function, we want to, uhm,


[User] Please transcribe this text

[Assistant] Use this drawPlayer function for every single player in our game stage.


[User] Please transcribe this text

[Assistant] And what we can do is we can actually use that forEach function, or that forEach syntax that I was talking about before, where we want to apply a function for every single value of an array.


[User] Please transcribe this text

[Assistant] So in this case, we want to apply a function for every single value, uhm, every single player in our players, alright?


[User] Please transcribe this text

[Assistant] And what we're going to want to do for every player is we're going to want to draw that player with that function we've just defined.


[User] Please transcribe this text

[Assistant] Which is again not super important, just a reference to like this HTML canvas element.


[User] Please transcribe this text

[Assistant] The radius of the player. Uhm, and finally the color of the player's look.


[User] Please transcribe this text

[Assistant] So again, what we did here in these past two steps was to kind of draw out some infrastructure for displaying the canvas. And this started by listening for socket updates on the client side.


[User] Please transcribe this text

[Assistant] One more thing that I forgot to do here, but again, we should do for good practice, is that we should write a cleanup function to close our softkit whenever we disconnect.


[User] Please transcribe this text

[Assistant] So yeah, just make sure all your variables are typed correctly, or else you'll get like some weird behavior due to undefineds.


[User] Please transcribe this text

[Assistant] I noticed that TypeScript might actually help fix this, so if that's something you're interested in, definitely check that out.


[User] Please transcribe this text

[Assistant] We, we want to turn off the socket, uh, in this cleanup function, just like we would do with every other socket, just to prevent us from having extra sockets open when we don't need them.


[User] Please transcribe this text

[Assistant] Cool, so if all of this is done correctly, now when we navigate to our localhost 5050, and we log in, we should be able to see that


[User] Please transcribe this text

[Assistant] Our player spawns in at a random location and it's displayed on this canvas object on our game page. And if you want to kind of try this out on your local computer


[User] Please transcribe this text

[Assistant] Feel free to check out Workshop 9, Step 2. This should run and display everything as this.


[User] Please transcribe this text

[Assistant] Are there any questions about what we just went through or any of that control flow? I know it was like pretty fast, but like...


[User] Please transcribe this text

[Assistant] As mentioned before, we definitely recommend you going back and watching this lecture and then like trying every step by yourselves, especially if you are planning to make a game for your project.


[User] Please transcribe this text

[Assistant] Okay, cool. So the next step we're going to walk through is...


[User] Please transcribe this text

[Assistant] A kind of like a way to let the player move around the screen. So to do that, let's go to our VS code and then check out step two.


[User] Please transcribe this text

[Assistant] And the first thing we're going to be doing in this step is to set up some socket functions to facilitate the server client communication. And we'll begin by looking at client socket.js. And again, I'm going to speed up a bit here just cause we're running a little bit behind, but remember that like


[User] Please transcribe this text

[Assistant] This recording will be posted and it's not super important to like follow all this live at this moment.


[User] Please transcribe this text

[Assistant] So the first thing we want to do is, as this kind of to-do states, we want to be able to send client updates, uh, specifically move data to the server.


[User] Please transcribe this text

[Assistant] I'm just gonna type this out first and then explain what each one does. So this function will be called move and it will take in a direction.


[User] Please transcribe this text

[Assistant] And when it hears this, or when this function is called, it will emit a soft event called move, and pass along the direction of that movement.


[User] Please transcribe this text

[Assistant] Then if we navigate to input.js, we'll actually want to call this move function to have these socket events. So in input.js, you'll see


[User] Please transcribe this text

[Assistant] We have this function called handleInput. What this will do is it will list, it will essentially be what's called whenever we hear keypress.


[User] Please transcribe this text

[Assistant] And depending on what the key is pressed, or which key is pressed, we will execute something slightly different.


[User] Please transcribe this text

[Assistant] So if we are pressing arrow up, we'll move up. If we're pressing arrow down, we'll move down. And similarly for left and right.


[User] Please transcribe this text

[Assistant] If we hear left, we'll want to move left, and if we hear right, we'll want to move right.


[User] Please transcribe this text

[Assistant] Also at the top, we should import this function move that we defined here just so that we're able to actually call it. So this will be at the top.


[User] Please transcribe this text

[Assistant] So again, what this handle input does is it will respond to each key press and call this move function accordingly, depending on which direction was pressed.


[User] Please transcribe this text

[Assistant] The next step would be to actually add a way for us to listen for these key presses and this will be done in game.js.


[User] Please transcribe this text

[Assistant] And it turns out that like, browsers have this very handy thing called, uhm, window.addEventsListener.


[User] Please transcribe this text

[Assistant] And what this does is it defines a way for us to listen for certain, uh, as the name suggests, events in a way that's like very similar to sockets. So we'll listen for a particular event. In this case, the event is called key down because anytime a key is pressed on your keyboard, this key on the event will be emitted. And we'll want to call a callback function whenever we, uh, actually like see that.


[User] Please transcribe this text

[Assistant] So whenever we hear a key press, we're going to call this handleInput function.


[User] Please transcribe this text

[Assistant] Which, depending on which key will press, was pressed, call a move function that will emit a socket event to the server.


[User] Please transcribe this text

[Assistant] Similarly to sockets, we'll also want to clean up this listener when we...


[User] Please transcribe this text

[Assistant] Leave this page, and we can do that with just this very...


[User] Please transcribe this text

[Assistant] Cool, so now whenever we, uhm, like press inputs, we should be, uh,


[User] Please transcribe this text

[Assistant] We should see that when we press the arrow key, uhm, as the console.


[User] Please transcribe this text

[Assistant] Might be a little small, but you can see in the console that like whenever I press an arrow key, we're logging the direction that I press.


[User] Please transcribe this text

[Assistant] So now as with all of our sci- like socket communications, the next step would be to add a listener for this event that we're meeting. And this time we want to add the listener on the server side.


[User] Please transcribe this text

[Assistant] So again, this event was called move, and we'll want to pass in a callback function that will be executed on move. Specifically, what we want to do is we want to get the user that sent this socket emission. And we can do that with this get user from socket ID function.


[User] Please transcribe this text

[Assistant] So we'll call this movePlayer function that we haven't defined yet, but we'll define that in a second.


[User] Please transcribe this text

[Assistant] But essentially what this is saying is every time we get a socket event called move from our clients, we're going to want to move the user that sent that with this move player function in the direction that they pressed.


[User] Please transcribe this text

[Assistant] So finally, if we navigate to gamelogic.js, which is where we'll actually define this move player.


[User] Please transcribe this text

[Assistant] You'll see kind of there's this to do here, which is to actually move the player in our game state that we're holding. So.


[User] Please transcribe this text

[Assistant] This is going to be a little bit repetitive, but essentially we're just going to check like whether the direction is any of the ones we're expecting. So if it's up.


[User] Please transcribe this text

[Assistant] We're going to want to modify our game state so that the player


[User] Please transcribe this text

[Assistant] Uh, we want their position to increase. Let's just say like in this example by 10, this would probably be some parameter that you experiment to make your game look smooth.


[User] Please transcribe this text

[Assistant] Uh, yes. Well, specifically once we move to the y position. Uh, of the position. Similarly for down.


[User] Please transcribe this text

[Assistant] If the player is pressing down, it wants to decrease the y position. If they are...


[User] Please transcribe this text

[Assistant] Pressing right will want to increase the expedition.


[User] Please transcribe this text

[Assistant] And then, if we're moving left, we want to decrease the x position. So this will modify our game states.


[User] Please transcribe this text

[Assistant] And that modified game stage will be broadcast to all the users.


[User] Please transcribe this text

[Assistant] In which, right here, uhm, in this set interval function. So every, again, like 60 times a second we'll be broadcasting this updated game state to all the users.


[User] Please transcribe this text

[Assistant] So remember that when we emit this socket event from our client, we're also passing a direction along with it, and that direction will need to be passed to the game logic function to move.


[User] Please transcribe this text

[Assistant] Okay, cool. So now when we press our arrow keys, we should see that we're able to move our, uh, user. Remember what's happening is...


[User] Please transcribe this text

[Assistant] On the client side, we're listening for some inputs. This is in, uh,


[User] Please transcribe this text

[Assistant] Game.js, which will then call this handleInput function.


[User] Please transcribe this text

[Assistant] Which will eventually downstream through a bunch of socket calls or function calls amid this socket event called moog. We'll listen for this socket event on the server.


[User] Please transcribe this text

[Assistant] This will update the game state on the server and that new updated game state


[User] Please transcribe this text

[Assistant] Will be broadcast to every single connected client with this function again that we've written earlier.


[User] Please transcribe this text

[Assistant] And finally, that updated game state will be displayed on our client, uhm, in the canvas manager file with this draw state.


[User] Please transcribe this text

[Assistant] Didn't we say that the inverted, uhm, like canvas coordinate system was inverted into y?


[User] Please transcribe this text

[Assistant] And that is true, but if you look like in our drawPlayer function,


[User] Please transcribe this text

[Assistant] There's this thing called Convert Cord here that we call, and what this will do is it will convert between those two coordinate systems for us. That's a good question though, like,


[User] Please transcribe this text

[Assistant] It's kind of a design choice, but the way we've chosen to implement this is like to use all real coordinates on the server in the game state and to only transmit, uh, translate those to canvas coordinates when we're about to draw the player.


[User] Please transcribe this text

[Assistant] Okay cool, so that should be the end of step two. We're now able to successfully move our character around the screen. Uhm, are there any questions high level over here?


[User] Please transcribe this text

[Assistant] And again, like, we know it's very fast, but feel free to either come to office hours or post on Piazza if you're working through this workshop on your own and you come up with something.


[User] Please transcribe this text

[Assistant] Okay, cool. So I guess I'll pass it off to Kenneth to walk through adding food and eating other players.


[User] Please transcribe this text

[Assistant] Song Song by Cisco. I believe the genre is R&B.


[User] Please transcribe this text

[Assistant] Howdy, nice car. What seems to be the problem?


[User] Please transcribe this text

[Assistant] Howdy, nice car. What seems to be the problem?


[User] Please transcribe this text

[Assistant] Hello. Welcome to 6 Minute English. I'm Neil. And joining me is Rob. Hello. Today we'll be discussing whether wearing high heeled shoes is a fashion statement or a sign of oppression. And by that I mean something you have to wear because someone has told you to.


[User] Please transcribe this text

[Assistant] Studies have suggested wearing high heels can lead to damage to the muscles and skeleton. But despite this, they are worn to look professional in the workplace or for glamour, a word to describe the quality of looking fashionable and attractive.


[User] Please transcribe this text

[Assistant] So, he describes high heels as having a magical quality. He uses the word transformative, meaning a great improvement or positive change, so they transform or improve how someone


[User] Please transcribe this text

[Assistant] Uuhs do sound otherworldly, but Tim also mentioned that wearing high heels could be seen as an act of subordination. That's making someone do something to give them less authority or power.


[User] Please transcribe this text

[Assistant] Yes, it's just sandals for you and sports trainers for me. In fact, Tim Edwards says it's difficult to draw parallels with men's shoes. When you draw parallels between two distinct things, it means you highlight the similarities. But here he's saying it's difficult to find similarities. Men have nothing


[User] Please transcribe this text

[Assistant] He says that if you don't wear a regular, ordinary black, brown or flat style of shoe, you might be viewed with suspicion. Men who wear shoes that are flamboyant, that's brightly coloured and that attract attention, have their sexuality or their attitude to


[User] Please transcribe this text

[Assistant] It does. And let's hope people don't judge you when you go out wearing your sandals and socks. But now, how about giving us the answer to the question you said earlier?


[User] Please transcribe this text

[Assistant] Right. Let's polish up some of our English vocabulary and remind ourselves of some of the words we've discussed today, starting with oppression.


[User] Please transcribe this text

[Assistant] Worldly is an adjective to describe belonging to an imaginary world rather than the real world.


[User] Please transcribe this text

[Assistant] And we mentioned flamboyant. That describes someone or something brightly coloured and that attracts attention


[User] Please transcribe this text

[Assistant] And that brings us to the end of the programme. Don't forget to visit our website bbclearningenglish.com. Bye for now!


[User] Please transcribe this text

[Assistant] Yes, of course. Can't you tell by the way I'm smiling?


[User] Please transcribe this text

[Assistant] Well, that's a coincidence because this programme is all about how computers may be able to tell real smiles from fake smiles better than humans can. Before we get into that, though, a question. The expressions we can make with our face are controlled by muscles. How many muscles do we have in our face? Is it a…


[User] Please transcribe this text

[Assistant] Okay, well, we'll see if you'll be smiling or crying later in the programme.


[User] Please transcribe this text

[Assistant] Hassan Ugail is a professor of visual computing at the University of Bradford. He's been working on getting computers to be able to recognise human emotions from the expressions on our face.


[User] Please transcribe this text

[Assistant] Here he is speaking on the BBC Inside Science radio programme. How successful does he say they have been?


[User] Please transcribe this text

[Assistant] So, have they been successful in getting computers to identify emotions?


[User] Please transcribe this text

[Assistant] The system uses video to analyse a person's expressions and can then infer the emotions. To infer something means to get an understanding of something without actually being told directly. So you look at available information and use your understanding and knowledge to work out the meaning.


[User] Please transcribe this text

[Assistant] Yes, and in this case the computer looks at how the movement of muscles in the face, or facial muscles, show different emotions. Here's Professor Ugell again.


[User] Please transcribe this text

[Assistant] So how do the computers know what is a real or a fake smile? The computers have to learn that first.


[User] Please transcribe this text

[Assistant] Here's Professor Ugell again talking about how they do that.


[User] Please transcribe this text

[Assistant] So how do they get the data that the computers use to see if your smile is fake or genuine, which is another word which means real?


[User] Please transcribe this text

[Assistant] And then they ask the people to pretend to smile and the computer programme now has a database of real and fake smiles and is able to figure out which is which.


[User] Please transcribe this text

[Assistant] Yes, and apparently the system gets it right 90% of the time, which is much higher than we humans can.


[User] Please transcribe this text

[Assistant] Right. Well, before we remind ourselves of our vocabulary, let's get the answer to the question. How many muscles do we have in our face? Is it A, 26, B, 43 or C, 62? Sam, are you going to be smiling? What did you say?


[User] Please transcribe this text

[Assistant] Sadly, you are not. You're using different muscles for that sort of sad look.


[User] Please transcribe this text

[Assistant] Actually, the answer is 42. Congratulations to anyone who got that right. Now, our vocabulary.


[User] Please transcribe this text

[Assistant] Then we had infer. This verb means to understand something even when you don't have all the information and you come to this understanding based on your experience and knowledge, or in the case of a computer, the programming.


[User] Please transcribe this text

[Assistant] They made people smile, or as the professor said, they induced smiles by showing funny films.


[User] Please transcribe this text

[Assistant] Okay, thank you, Sam. That's all from 6 Minute English today. We look forward to your company next time and if you can't wait, you can find lots more from BBC Learning English online, on social media and on our app. Goodbye!


[User] Please transcribe this text

[Assistant] Does this sound familiar? You get up to grab your phone or a cup of tea or something else in the other room, but once you're there you have absolutely no idea why. Were you distracted? Sure.


[User] Please transcribe this text

[Assistant] Maybe. But it could also be because you walked through a doorway. Yep.


[User] Please transcribe this text

[Assistant] According to psychologists at the University of Notre Dame, something as simple as walking through a doorway can make you forget things. They found this out by testing undergrads in the lab. They asked students to place six blocks of various shapes and colors in a shoebox.


[User] Please transcribe this text

[Assistant] But when participants had walked through doorways, their performance was consistently worse. Something about doorways seemed to make them forget. This happens not only with real doors, but in virtual environments, too. And even when people are asked simply to imagine crossing a threshold. It's called the location-updating effect, or more simply,


[User] Please transcribe this text

[Assistant] You might think this is just a case of context. Like, if you walk back into the original room, maybe that can help you remember. But the Notre Dame scientists tested this, and that didn't make participants any less forgetful. The forgetting wasn't just about being in a different room.


[User] Please transcribe this text

[Assistant] The best explanation has to do with how our brains process events. After all, you can only think about so many things at once. Working memory.


[User] Please transcribe this text

[Assistant] So the best way for our brains to deal with everything is to break it into chunks. According to this theory, known as the event segmentation theory,


[User] Please transcribe this text

[Assistant] Our brains create representations of events called event models, which let us predict what might come next at any given moment. Like, if you see someone tie one shoe, it's a pretty safe bet that the next thing they're gonna do is tie the other one. But these event models need to be updated as the circumstances around you change.


[User] Please transcribe this text

[Assistant] The problem is that when your brain updates the status report, that old information isn't as accessible, even if you still need it. Psychologists also think people might have a hard time remembering things,


[User] Please transcribe this text

[Assistant] Like those colored blocks in the experiments, because they create two event models with those objects, one for each room. So when it comes time to retrieve the information about what's in the box, or what you went into the other room to find, the two models compete and interfere with each other. But this whole system that your brain has for processing things still is useful.


[User] Please transcribe this text

[Assistant] Even if it sometimes leaves you in the kitchen, wondering why you're there. That's because, more often than not, passing through a door does mean that a new event is beginning.


[User] Please transcribe this text

[Assistant] Which means that it's okay to dump all the information about the old events. So this kind of forgetting might be annoying, but isn't really a bad thing. And it's not a sign that you're getting old or developing dementia. Scientists actually checked this, and the doorway effect was just as strong in college students as it was in a group of older people. In fact,


[User] Please transcribe this text

[Assistant] The test subjects remembered more of the words when they crossed through a doorway than when they just moved to another part of the room. Here, the doorway was beneficial.


[User] Please transcribe this text

[Assistant] By divvying up the words in two separate event models, the brain can structure the information better and take more of it in. So if you end up in your kitchen baffled by a wire there,


[User] Please transcribe this text

[Assistant] Don't worry, your brain made a tiny mistake. In the grand scheme of things, it's doing things just right.