 Selamat pagi, semua. Hari ini, pekerjaan selanjutnya akan berbicara tentang keperluan-bicara untuk pengalaman Salka di Baiten. Dan pekerjaan selanjutnya akan digunakan oleh Mr. Chan, Ms. Yeh, dan Mr. Lam. Mereka semua JC student. Jadi, untuk pekerjaan selanjutnya, kamu akan perlu mempunyai PIDEN 3 dan mempunyai pemeriksaan. Kami bekerja dengan PIDEN 3.6, tetapi, dengan keperluan-bicaraan selanjutnya, kamu akan membuat pemeriksaan. Ini adalah sebuah pemeriksaan yang tidak terkenal oleh pemeriksaan dengan PIDEN 2.6. Jadi, sebelum kita memperkenalkan pemeriksaan, kami akan membuat pemeriksaan dengan PIDEN 3.6. Pemeriksaan adalah pemeriksaan menggunakan IPC untuk pembinaan pakaian platform, dan membuat pemeriksaan untuk pemeriksaan keperluan-bicaraan. Ia adalah pemeriksaan yang paling keperluan untuk pemeriksaan. Dan menurut pemeriksaan yang banyak yang boleh dilakukan untuk pemeriksaan. Ada banyak pemeriksaan yang membuat pemeriksaan menggunakan pemeriksaan sepenuhnya. Selain pemeriksaan yang tidak terkenal, seperti PIDEN 4 dan PIDEN 5, tetapi membuat pemeriksaan seperti PIDEN 4 dan PIDEN 5, dan PIDEN 5, seperti PIDEN 6 dan PIDEN 10. Ada banyak pemeriksaan yang dapat diluncurkan oleh pemeriksaan dengan pemeriksaan. Selain pemeriksaan, tetapi membuat pemeriksaan untuk pemeriksaan. Ada banyak pemeriksaan seperti PIDEN 6 dan PIDEN 10. Ini adalah pemeriksaan basikal dari pemeriksaan yang dapat diluncurkan di pakaian PIDEN 12. Sebelum hari ini, kita akan mencari pemeriksaan pemeriksaan. Jadi pemeriksaan pemeriksaan yang berlaku dengan pakaian PIDEN 12 menggunakan pemeriksaan yang sama untuk mengawasi pemeriksaan dan pemeriksaan untuk menggunakan pemeriksaan. Pemeriksaan adalah menggunakan pemeriksaan. Memberi untuk pemeriksaan yang baik, seperti pemeriksaan bergelak, berkeluaran, dan pemeriksaan yang tidak berlaku tidak teruk. Di merada di pemeriksaan, setiap pemeriksaan tersebut перевarkan pemeriksaan, kemudian akan dimanusingkan oleh pemeriksaan yang dapat dipaduk dengan pemeriksaan dengan pemeriksaan yang berlaku. Selepas memadukan pemeriksaan, pemeriksaan yang diberikan dengan pemeriksaan, Pada IP Address, saya menerima mana yang menjadikan penggunaan penyelesaian yang berlainan. Pertentangan berada dari 0-65,535. Tetapi jika hanya 1,000 penyelesaian yang berlainan, itu menjadikan penggunaan penyelesaian yang berlainan dan tidak berlainan. Pada IP Address, sebenarnya ada dua penyelesaian yang berlainan hari ini. IPv4 dan IPv6. IPv4 menggunakan penggunaan yang tidak akan berlainan. Berlainan untuk menggunakan penggunaan penyelesaian yang berlainan hari ini. Pada IPv6 menggunakan penggunaan 128. Pada IPv6, adalah pilihan yang terbaik untuk menggunakan penggunaan penyelesaian. IPv4 menggunakan penggunaan yang lebih berlainan sekarang. Pada 10 negara, kami berpengalaman mengenai penggunaan IP yang berlainan hari ini. Jadi, jika kita berlainan, yang baik adalah keyakan bagi bahawa.. bagi bayi specially bayi dengan strict pun muncul dalam expressing peninginannya seperti yang fungplain jawapan son Gren meuk advocates.. Segak menjadikan perluntu IPv4 akan berlainan penderitaan zeggen suatu kawasan agar toleransi dan cerita dan semula. Ok. Kita sekarang membantu untuk menggunakan penggunaan penggunaan penggunaan yang lebih berlainan hari ini. IA-Socket Next We will allow the client-Socket to connect to the server-Socket using its IA-JSF protocol Next, we will set the connection on the server program Using server-Socket We will return the connected-Socket to the address So we will store them in the variable-Cop-Connected Connected-Socket and address So now the program will be connected to the IA-Socket connection Next, we will try to send a message from the server to the client and do this using the send-off function If you're usually in front of a screen you can close the message To receive the message we will use the receive function in this client program Next However, we need to store the message in the variable-Cop-Message Next, we will display the message using the screen function Now we will run the program As you can see we receive a message from Hollywood in the client program showing that the connection is established between the server and the client Remember to close the sockets So far, I have returned the connected-Socket to the IA-JSF protocol So, IA-JSF protocol is connected to the IA-JSF and the IA-JSF protocol is connected to the IA-JSF protocol So, we will run the program using the send-off function Next, we will run the server So, we will run the program that we have in the connection and the IA-JSF protocol The IA-JSF protocol is connected to the IA-JSF protocol Now, we will run the connection sockets to the protocol sockets to the IA-JSF protocol and the client for 24-5 So, we will run the sockets to the IA-JSF protocol for IA-JSF protocol all from IA-JSF and then we will find an connection once connected and it will run the send-off socket the socket for our jack you can take the time to send a jack for the socket jack you want to know how to so how to you you you will ask for the data you you want to tell the client so you put the network and you want to send the data to the client so first you have to call the check the send-off function and the check-off function call the data so you have to input it to the client so it's called just input just let go to A for client because once you send it or you want the client to reply so you just wait for client to reply so you you need some data check-off jack you call the monitor you see and inside you put one here to follow that it might not affect the check-off jack easy so once in time that you can print out the data so you can transfer it to the dog format to put the data into the script so you remember that all messengers send a call to the client so you want to call to the client so they can decode the message to the client so now you have to send one to the client to the client so first I want to do this input then check and check okay one to dog format and you connect to one to the client so you can send the call to the dog format and one to the dog format and follow to the screen to the dog format and follow to so you have to make sure to send input to the dog so the data is first to check okay dog input dog input dog input dog input dog format dog format to send so you must send data to the dog format so you have to send a call to the client send the data to the dog format dog send to the dog and call so now let's run the call so first run the call of the client so now let's run the call so that the client the client call can send you to the client so you can send and you can type type and then on the client type you can send and you send type and so you can you can send type or you can and you can send it back so you can send it back to the client but what happens next thing you want to call to this person call away what do you call it? you can only call the text by call to the client but that is not the way to send a line so how do you call this person call away so what you want to do let's text the client you can call send me a call to the client so how do you call the client so the client has to send you to the client but also what you're going to do send it to the client so so so so so so so so so so so so and then so jika anda telah mengunggini tutorial, kemudian anda akan mengambil keputusan tawar yang bagi mempunyai Wieja dos, tapi anda superb surat atas jika anda ingin mengambil keputusan tawar, anda tahu yang melepaskan ia betul untuk mengambil keputusan tawar jadi anda dapat mengambil keputusan tawar sehingga anda boleh datang ke bahagian Okay, but soon, the sound is a way, right? So, I almost encode, but in your buildable, the sound is a way to be able to receive multiple texts from multiple files. And so, we don't actually want the sound to stop, to stop everything encode sound when I'm at the tree. So, all you want to do here is to add a file to your code, and then you put all these in the file to load. So, what happens is that, file to the listener and accept any collection of files. And that once the time you type it has enough to click, then the text will start to load, but the file will keep releasing for any collection of files. So that it can keep running, and the file will need to run one time. So, let's see in action, you want the file.tli file first, and you want the file.tli file. And you just can't handle it. I will add. But, if that's in the file, you type it to click. Or, the file type will click but the file type will click. So, if you want the file encode again, you can really connect to the file.tli, and then you can say hi and then, you will hear hear say hi. So, what I do here is that the server code will need to run fast. It is not available for all the client, multiple types, connected, but after it will click, or not send to the project. So, it will say to me, how do you guys have program that you need from that project? Hello. Before I, you want to take picture? Oh, by the way, and I also uploaded the code to Github. I will share my Github link like that, y'all can see, all the workshop materials is there. And because the audio for here is very shaky, so I want to set any questions or I will re-explain the code a bit because, ya, the audio is very shaky. So, do y'all have any questions about it? If not, I will go through the code again. Server.py file, you want to call socket.socket, and then you bind it to a server which is like localhost address and port number 12345. You have a bar tru loop, so you run forever. Then, after that, you will first listen for active socket and if there's socket, if the client wants to connect to you, then you will set the socket and then you will get back a chat socket which is the socket to communicate with the client. Then, you will have a quit equal to false. So, while the client does not want to quit, you'll keep running, then you'll just have the data input and you'll just communicate with the server and client. Until one, then it's like a quit. Ya, let's basically move on to the better shift data. Ya, it's possible how we block the problem like running with the client. Ya, it's possible. Ya, this is false because this server and client automatically on Python, we can only connect from on one, like from one. Okay, so basically, if you want to try running this code on two computers, you can, but the thing is because firewall has disabled like connecting directly from port to port, so in real world you can't actually, it's not actually feasible to connect to another computer using this socket. This is just a demonstration of one computer. So like if you want, but this is like demonstration of what real world sockets are. Basically, you have a client and server, then you connect with each other on a secure port. Ya, so basically now there will be game showcase on battleship. How can you socket to play again on battleship between two player? Ya, you all want to take out your laptop to follow along on just what? Okay. Thank you for the talk. Ya, thank you. Can you take show to me? Thank you. Better ship. The server generate a 3x3 grid and determine a random location for the ship to be in. The client will then have three attempts to guess when the ship is in. We have prepared templates for the server and client program. You can download them at the link shown below. These are the templates. You can pause the video to attempt the challenge. Alright, now I will go through the solution. The three functions here serve different purposes and can be used multiple times in the main program. In the grid creates the game grid while display functions display the grid to the client. GetUser input prompts the client for input and receives input from client for both row and column. I made that is kind of relevant to socket. Kind of not. You all can go and experiment. Okay, back to the video. In getUser input, there are four missing lines. Alright. So first, we have to send instructions to the client or user to input their row guess. Then we will have to receive their input in a variable like so. Then, we will repeat the process to get column input. Next, we have to create a server socket. First, we have to create a socket using the dot socket function. Secondly, we will bind it to a local host and upon number of our choice. Then, we will allow the socket to listen for incoming connections using dot listen. Lastly, we will have to send a request to the client or user to input to the client. So, we will have to create the client socket and connect it to a server socket as such. Back in the server program, these two lines of code is used to generate a random row and column whether ship will exist. So, we will send a request column whether ship will exist. We will use a while loop and that loop will loop as long as the number of times gas does not reach 3. It will also loop as long as client has not made a correct gas indicated by the Boolean called 1. Inside the while loop, these two variables It is good to take note that we increment times gas by 1 every time the client makes a gas. After every gas we will be updating and displaying the grid using this code. Lastly, we have to let the user know if he wins or lose. To do this, we will use the send or function under the condition which client want a client lost. Now, let me explain the client program code. Using an infinite while loop, the client socket continuously receive data from the server. It receives the code using the dot receive command as such. Once data is received, it prints the decoded data. If enter is detected in the data received, this means that it is prompting the client for input. Task we have to send the user input back to the server. If you won or you lost, it will break. It is a good practice to close the socket as we use. This concludes the online workshop. We hope you have learnt something. Thank you. Since there is still time, let me go through a game.py that I wrote for this workshop. Ya. So basically this game.py let me open it IDE. It looks something like this. Basically, one it is like an RPG game. So this is the map. The C is your character. Dots are nothing spaces. E is the enemy. And T is the treasure which you have to go to. So you can input up, down, left or right to go. And if you input the wrong thing, you will say false move and ask you to try again. So let me just put down. Let me just move down. Ya. Okay. So what happens when you meet your enemy, right? So I'm just going to meet your enemy right here. You print out this and you have two of shirts. You either attack or you run away from this enemy. So let's try attack first. Once you press attack, you print out this stat and then so basically from here you can see that the enemy has 15 health. You have 20 health. You attack it for 7 damage. It has 8 health left. 5.5 damage. So you have 14.5 health left. So since it has 8 health left, let's just attack again. And now it has 1 health left. But I have 11 health remaining. Let's just attack one more time and yes, we defeated the enemy. So as we defeat the enemy, the map will get updated and there will be less enemies. So what happens is every 7 turns there will even more enemies updated. Right. I'm just going to go through my game here. Okay, so what happens if you try to run away from the enemy? There's a 50% chance you'll get it. Hey, I ran away. That's good. So let me just keep moving to the treasure. Oh no, there are even more enemies. Scary. So As you can see, the game is not very polished because you can just run past all the enemies and you can just reach the treasure. Ta-ta, I win. Right. But okay, so you might be wondering how does this relate to socket programming? Yes, this is my answer. So basically, right, what happens is you know this kind of game, the majority of your game code will not stop on your client's side because that might be too heavy on your computer and you want the people to have you don't want so much code on your client's computer. So basically most of this code can be placed on a server and then the client just need to interact with the server. The server, this is called back-end logic. The server will do back-end logic and return something to the client. So what if let's say you don't want to have so much code on the client's side. So let me show you what it might look like. This will be what potentially looks like for a client code for this kind of game. This will still work in conjunction with a server code. But look here, up from 200 plus lines it's cut down to 59 lines of code. It's taken up by this enemy sprite which is really cool. I like it a lot. Ya and you can see here it actually cut down a lot and this is how some games they basically let you download your client. They let you download some client code but it's not very large even though the game is very expensive and has lots of functions. That's because most of the back-end logic is actually placed inside the server game.py so let me just go to the server game.py you see world you see so much code again it's even more code it's around 300 lines of code that I wrote myself yay so what so basically what did I change from the original code so first I copy basted all the code here by added import socket so basically for all the code that I needed input let's see basically all the code that needed input let's say you had input up down left or right inside the move function e right this it's all this is all changed because I added where is it hang on let me try find okay so yeah you can see here instead of just asking for input calling the python input function where do you want to go left up down left right instead I send this over to the client where you'll receive it the client game yeah so basically I added a special thing here called input at the front of the string and then every time there is input inside the string then it will ask the client to input the data so it can send send it over to the server basically the server only and for the stuff that the server prints out it will just send it over to the client the client will print out the everything so let's try running this game first when the client connects to the server the server will generate a map and then data will print here and you can see there is reinforcement things will look at this later so basically you want to go right it goes right right basically these functions just as a normal game except that the client code is so much smaller so you can actually you don't have to write so much code and the client won't have to spend so much time downloading it so as you can see write write i'm always write nah jk ya see it is always the same then you can attack attack oh no i might die oh no i have 8.5 help remaining enemy has 7 help okay so ya this here is a problem of me not adding slash n it's okay i'll do that later i'll attack oh no i have i have 4 help left but the enemy also have 4 help so you're low yes i defeated the enemy oh ya i'll show you what happens if you actually get defeated by the enemy that's the only way you can fail this game okay so basically here i talk basically here i talk that if you have a game code and you have server and client code but it will be very boring for the server side to just watch the client play game so what i added is reinforcements so basically every 7 every 7 turns the server can choose whether they want to send reinforcements basically add more enemies or they can don't do that this will essentially like add animal strategy for the server side even though it's a B it's still an animal strategy like for example if you see that the character it's like oh you want to save your reinforcements perhaps then you can type n and then you you can don't send in your reinforcements and the character can choose where to go if you decide to send in reinforcements then the character will suddenly swarm with enemies and ya it might be unexpected for them so since my characters on one health let's just die anyways wait no i one-shotted the enemy cool okay so so basically every time you get to send reinforcements maybe this time i want to kill this character already so boring then i send ya why then immediately the map gets updated and suddenly so much more enemies for me to suicide okay so then you just die again oh nevermind the enemy hit me for 0.5 damage the enemy is so weak ya by the way the enemy generation is all random and oh my character is so OP defeated another enemy i feel like i can just start a gaming stream right now let's just die i have 1.5 health left oh then my look here the enemy hit me for 0 damage why am i so lucky at the wrong time okay eh i defeated the enemy let's try again oh shit i defeated another okay nevermind okay so you can send reinforcements again i want to do so so i can kill myself ya so basically this game lacks quite a lot of functions like items like XP stuff you will find normally in RPG but this is just a proof of concept that a large chunk of code can actually be lesson so you can actually have the client oh i finally die see game over so basically the client code does not have to download as much code on their site to be able to play the game for 2 so basically let's look at the code again the only reason why sprite is here is cause you cannot send this over so get because the socket does not allow you to encode this so there will be some stuff that you cannot send over sockets or there will be some stuff where if you put in the socket if you put on the back end then it will be too slow like some game sleep reaction time so a lot of stuff of this stuff still have to be on client side but generally the logic behind the game cannot be condensed and so ya socket basically made the code for the client to download since we have more time let me just go through what I've been doing for this game so kind of a map map class here so when initialise when I initialise initialise the map class where which I do here MP equals to map so when I initialise it will call random integer anywhere from 1 to 18 that is because the first and the last ones of the list will always have to be the walls as you can see here as you can see here the first and the last lines will always be these walls and you can't go into it so for this I use random generation and many such that I use a 2D array basically so and I use nested for loop so for 20 times I will create each line of this and I make sure that only on the 13th line and then j equals to any random number then there will be a treasure so the treasure will always be on the 13th line but the number will be random then else right I will just have a random from 1 to 10 like basically there is 10% possibility that an enemy will be on that space and then else if it's not a treasure spot or if it's not an enemy spot you just append a dot then this will run for 18 times and then you will finally append back of the wall and then this will the self dot map will append this list so basically self dot map is a list of 20 lists 2D matrix of this entire map I hope that's not a bit that's a bit too complicated because this is deviating from socket and going into object oriented programming but sometimes this python ya this python concepts match together to create something so you will have to understand this so I just have there I have some basic functions like get map and change map like if I want to change this particular location from enemy like say the enemy is defeated so now you will become dot and then here's the show function I basically use some if loops in one statement because to make it neater right of course this is same as me just writing ya this is same as me just writing if half X bigger than 0 so basically this code is the same as this code except that I write it all in one line because for large scale projects like this I want people to understand the code but not like have it too long so this is equal to this and I just realized that was a contradiction because I should also add comments and documentation which I didn't have time to add in but if I did then it will be it will be easier to understand ya I think documentation in your code is really important because if not you won't people won't understand what you are writing and you have to explain to them which waste a lot of time so for this show function I basically just have a nested for loop and then if and then I check back with the self.map function and then after that I will just print it like this and then showmap is the same thing but showmap is the same thing but it's just a smaller map because if you input the whole map every time it is unnecessary and it takes a longer time so I just have it around the character 5 spaces 5 spaces around the character it will show the map then this the enemy encounter one basically if there is enemy encounter it will return true else it will return false same thing for treasure encounter and then this the add enemy so basically it will run the enemy generation code again to add reinforcements ya so getting to the enemy one where you initialize there will be random variable difficulty and the difficulty will set the health and the attack which can so what happens is if there's every time look at this code every time there is enemy right then you call the add enemy no no no this code no it's in the move function yes so if mp.enemy encounter equals to true it will bring fighting enemy then it will create a random integer of 1 to 4 then it will bring all the enemy strides it will bring all the attack all the attack and stuff then after that it will call the enemy.attack so oh my god i need water so basically these codes are just like like like the most important function here is the move function because that's where everything happens all the checks happen so if you are wondering how they code games here you go this is how you code games basically every movement you make firstly this is just to make sure that you are inputting up down left or right else you will just put no thank you we want a right input so for here every time you a game runs you will check if you first get a treasure if not you check if you first have enemies if really you don't have then you just move you so basically games are like that doing real life every time you do something they will conduct a check to make sure any environment or variables have been moved if they have then they will accurately show it in game so for the treasure encounter run you just print you found the treasure and then return false this is to signal the code to stop running the loop i feel we are holding a mic and there is no one to talk to speak louder in that case i will get some water test test 1 okay hi so i use mic from now on okay where was i okay so for enemy generation when there is enemy encountered which means the mp.enemy encounter returns true then you will print fighting enemy to the socket this is just a way of printing things then you will generate a random enemy so while this is while true is that means like while the enemy is still alive then you will print the sprite and you send the sprite over then after that you will print the options you have and then you can input either 1 or 2 then you will receive a message from the client now and then basically if it's not 1 or not 2 you will ask you to go again if it is if it this is a while loop so you keep running this until the client sends out 1 or 2 so if if it does send out 1 or 2 then you will print out the status you will print out your health and then after that if it's 1 then you will attack and you see here my attack generation is basically using a base attack then there is a plus minus from negative 3 to 3 so basically your attack range will be anywhere from negative 3 to 3 then you will hit the enemy for this amount of damage they will print how much you attack for then after that your enemy if enemy the health is greater than 0 then it's smaller than 0 then you will print enemy defeated and you will stop running the code because a dead enemy can't attack you so you run the same thing if A is equal to 2 if then you have 50% chance of running away this is just my random generation code I have 1 here and then I call random.ranin 1 or 2 so there is a 50% chance it will be 1 50% chance there will be 2 so if it's the 50% chance there is 1 then you will print run away successfully and you will stop running else it will print fail to run away so why why didn't I add the enemy attack code yet because the thing is if you fail to run away the enemy will get a free hit on you and then if you didn't defeat the enemy the enemy will also get a hit on you so since those 2 outcomes are the same you don't need to write the enemy attack code twice you just need to write it after the if which is here so because they both share the same outcome so if they don't break then they will have to get damage by the enemy so for the damage I call enemy.damage function if you go up here the.damage function is just the same thing self attack and then plus minus 3 then your damage yourself self.health minus equals damage and if it's smaller than 0 small of equals to 0 you'll print you have been killed and then this time.slip here is to ensure that the people have time to actually read what you send before they repeating the while loop and because when you repeat the while loop you will print the sprite as you see here this not a sprite so you take out the whole screen so you can like read this code again so I will print let it sleep for like 2 seconds so you can actually read the code before it moves on and then once basically once it has been difficult this loop will break and then so you will change change map this is the position of your character so basically if your character is on this position and then you meet your enemy then you defeat the enemy or run away from the enemy then the enemy will be changed from an E to a dot so the enemy won't appear again then you can continue on your merry way to call the move function again so then this code are pretty typical of socket programming you will call socket dot socket you bind it and then you listen for 80 connections and so like this I just you print out like the menu like yeah then to that you have a while true loop that keeps running until the person dies basically this is the reinforcement code and then this is the charge code this is basically like you can choose whether to send reinforcements or don't send reinforcements and then for here it's just the same movement code they ask you to send in up down left right then after that you will call into the function dot move and then if if not if it return if this boolean function returns false it means that the character has died from our earlier part of the code so you print out game over and then it will break the function else it will keep running this code for those that just join in we are looking at this game code using socket programming so basically I'm demonstrating that even such a huge chunk of bad end code can be simply start using socket if no this is the shell just close the shell so basically the original code looks something like this so this is the game code and it looks very long it looks very tedious and then if you are bringing it up on industry level standards it will be even longer and it will be probably a few gigabytes if not terabyte of code to work with so but if you are if you want game to work you want your client to download the least amount of bytes possible for your code to run so basically utilizing socket I cut down or the number of code the client has from around 300 lines to just 50 lines so they only need to download 50 lines of code but of course you have to connect to the server where the server will have about 300 lines of code but it doesn't matter because the server is on your side and so by doing this you cut down on the basic requirements that the client need to have to run a game so for the game side it's not that there won't be any code there will be some code that can't be sent over through socket like for example in my example this sprite and on me sprite it can't be sent over through socket because it can't be encoded and then there's also some stuff that let's say like your game is asked for reflexes so if you send it from server to client and your internet speed is especially slow it might not be so good for like those kind of games so there are some games that still has to be written in the front end but mostly games operate by putting majority of their code in the back end so the client doesn't need to do so much with it so basically for back end code it looks similar to all the code you just receive the data but I have this part here so basically if the server wants you to input something you put input inside the data that you receive so if the input while input not in data so that means it will keep receiving data until input not in data so if the data send by the server is sprite that means the server wants us to print the sprite so we'll print a sprite if the data equals to game over then we will know that the game is over then we'll close the client socket if not we'll print the data so basically this will print data continuously until we receive something from the server that has input in it once we do we will quit out of the we will quit out of this loop since input is not in data so we will stop running the loop then we will ask the client to input the data and then after that you can send the data back over to the server then after that you will repeat this voucher loop again so basically it will keep receiving input from the server so for those that come in you all haven't seen how the game runs so let me just show you you run the server code first then you run the client code the server will generate a map a random map and then you will send to the client then the client can input for reference this is the map these are the walls the dots are nothing E is the enemy and C is your character and you want to go to T a randomly generated treasure point so like you can win the game so you can input left you can go left but you can't because left beside it is like a gate it's like the wall so you can input right and then you update the map and your C will move right you can move right again but you have to spell right correctly it's harder to type with one hand as you realise then you can go down and down and this is the enemy attack sequence form bigger ok no I'm not making it make sense but I will make the form bigger other zero oh no but my game maybe too big never mind so basically you have two options when you come into a character you can attack or run and these are code that I just explained just now so I won't go too deep but basically we can attack and see you will deal a random damage based on random generated damage that's not so random because we still want we still want to have like a base attack ok so basically every time enemy gets defeated the enemy on the map will disappear ok so as I was writing this code I thought oh maybe the people on the server side is not having fun what if this is what you want this to be a two player game like the battleship game so like what if this side is very boring so I added this reinforcements so as you go about defeating enemies on your server side there will be lesser and lesser enemies look at this map there's only one enemy beside me and I can just easily avoid it so like where's the challenge in this game now so like for here right then you will so every time you there will be a countdown timer on the server side that the client does not know of then every time reaches zero you can choose to send reinforcements so let me demonstrate by typing yes then suddenly your map just added so much more enemies so this adds a strategic element to the game on the server side also because the server side can choose whether they want to send it or maybe they can hold it off so they can send like two or three reinforcements at the same time just overwhelm the character this can yeah this adds like an element of strategy and like two and the server won't be actually be bought because without this code the server is just watching the client play and not playing themselves obviously in industry standard the server doesn't have to do anything it's not up to the client but since this is just on my local address I wanted to have some fun so I just added this honestly this code is still lacking a lot of things and it can be barely be considered a game but this is just a proof of concept that you can actually diminish all the code from server like if you have so much base code for the game you can just not you don't have to let the client download everything so now I'll just win the game because I explain around everything there is then hang on I need to type okay so I I've been killed by the enemy so now I ended the game and yes I think that it from my game showcase there is nothing else any questions yeah yeah basically yeah this is direct connection to the computer which is why the five wall actually blocks any like outside connections on the port but this is a simulation of internet sockets are there any more questions all this code can be found on my github page let me shamelessly part my big github page here so basically you can go to this website you can find all the socket programming workshop materials including all the code that we have just mentioned so maybe like if you are interested in learning socket programming you can copy paste some code here as like your base to start you off doing socket programming yeah are there any other questions if not I think yes basically every computer if you want to connect to the internet it has sockets let me show you let me go to my command prompt I can go to net stat wait no what is the exact command so basically if you go it will show all the ports and then you can see it's connected to like youtube all the firefox stuff basically if you want to connect to the internet you will have to connect it using ports let me just dash n okay so basically these are all the ports here you can see 127.0.0.1 this is localhost these are all the localhost ports that I have running and then these are all the external ports which means all the website that I'm connected to and then so you see this is yeah basically yeah if you want to connect and transmit data you have to do it using sockets yeah and then you can see here all the port numbers which are the thing behind the address these port numbers are unique that's because no two sockets can connect to the same port at the same time so your computer has a lot of ports 65,000 to be sure so that you can connect to a lot of things yeah so if there are no further questions I think we can end this talk right okay thank you very much for your kind attention and see you soon at 4CR yeah