Coding Livestream - Come Play Online Chess with Python & Pygame

Tech With Tim · Beginner ·🧠 Large Language Models ·7y ago

Key Takeaways

The video demonstrates the development of an online multiplayer chess game using Pygame, with features such as spectator mode, automatic pip installation, and server-side implementation. The game is developed and tested during a 24-hour coding stream, with the creator troubleshooting and fixing issues with server connections, code updates, and syntax errors.

Full Transcript

if you're playing game of chess and the server goes down or you get disconnected or something like that um but yeah so anyway slip I'll be live right now okay so I'm sorry I just had an issue with the stream I don't know what you guys heard or what you didn't hear let me know but again online multiplayer chess we're gonna be playing this today there's a bunch of bugs we need to figure out we're gonna be doing that for the first 15 20 minutes please don't get too frustrated if we go through stuff and I've already repeated this I'm sorry but um I don't know if you guys can see me or not again this is always a bit buggy alright so first of all before I get too far into the stream I need to give a massive shout-out to cherry servers for hooking me up with a really awesome server for today's stream I'm gonna be using the server for a few videos in future series as well and anyways just massive shout out to cherry servers definitely go check out their website here you can rent servers for like 10 15 cents an hour they're really good they have an awesome support team and they've just been a pleasure to work with so massive shout to them definitely check out their website there's a link in the description and again just thank you guys so much from cherry servers because without you this would not have been paulus have been possible alright so now let me show you guys how you can actually connect and start playing this game so a little tutorial first so that everyone knows how to kind of get set up here so if you're tuning into the stream later just I guess rewind back and see this but anyways if you go to my github link in the description link in the pinned comment you should see a page that looks like this now there's a readme file here and it literally just goes through exactly how to do everything so what you need to do is download this repository and run the game dot PI file now I tried to make this as intuitive as possible and when you run the game top high file I wrote a script that should automatically install PI game and pip for you if this doesn't work you're gonna have to mess with installing pip and PI game yourself again let me know if there's any issues use the stream chat use the github chat for issues I'm gonna be checking and we're kind of just gonna be tweaking things to the first 15-20 minutes so please you know bear with me on that guys but anyways follow this instructions try to connect the servers live right now if you double click the game top high file you should actually get hooked up I can see a few people joining on the server right now and before we you know go too far I will kind of walk through some of the code and how this works but if you guys want to go in the background and kind of be listening to this while I go through the instructions feel free we've already got 4 people connected to games going and yeah we'll just be going through all that so do this get this working github link in the description I'm just repeating this because everyone is like just joining in the stream so I want to make sure people see it if they're just coming on now but remind people in the stream chat and all of that so the server specs that I actually got I got a 4 core or starting out 4 core 4 Xeon processors to 1080 TI's the one i have is actually only 16 gigabytes of ram but i was supposed to get 64 but like something messed up with that and then i think i have like what do you call it some i don't know how much space at like 250 gigabyte SSD or something uh alright let me just see what's going on here i'm running into a few issues on the server again guys i gotta fix a bunch of stuff as we go through but that's what I'm gonna be doing now just fixing some of the stuff on the server side and just bear with me keep connecting the server try to play the games if you run into bugs please let me know inside because I'm relying on you guys to help me test this out and then I also implemented a spectator mode into this because it we're getting key errors here yeah you guys can't connect Kay I'm gonna shut down the server right now guys I'll be back on in one second oh just there's a key error I know how to fix this it just gonna take a second because when you guys are connecting to the games it's just it's a little buggy here I'm so Len of games ok I see here so if connections watches 2 equals 0 yeah so again guys just get that stuff going and then we'll we'll get this all working here I just gotta figure out this issue because I have something where like each game is represented by a key in the dictionary if you join the key era can sometimes be off um and and only that so we'll have to fix and work with this what I might actually do is just get it so that this is gonna be a little bit difficult G equals zero let's see here I think I'm just gonna pick a game that doesn't have two connections on it and add you on that how big is the foot you guys asked me all these questions I'll get to them in a second I just really want to get this working with the key areas I haven't had many people on it at once so again we're gonna have some issues going as we get through here is the line of games minus zero is this open source yeah guys this is open source you can go look at everything on github okay so let's just get a list of all the keys and then we'll assign a player based on the amount of connections oh we shouldn't do it based on connections because then connections are just 2 equals equals zero yeah so this was an issue I knew I was gonna run into creating new games so this is gonna be difficult to create new games and assign people into the games I haven't had this many people connect and even with you guys like 10 20 people connecting it um it just broke here so we'll have to see how to fix this so what I was trying to do right now is say after every 2 people connect it um creates a new game but what was happening was if people are connecting and they're just instantly leaving and then it wasn't working okay let's just do it we'll do one more test run with this server running and then see if we can get this to to work ok guys to try to connect to the game connection reset by P try to connect I'm gonna be monitoring this server here and I might even connect in a second as you might get my spectator mode to work but I need you guys to connect before I can see if everything is actually working or not again if you're unfamiliar with how to do this this should be the repo that you download should look like this except you want to have this server file most likely and then just double click on game and it should load you up into the chess game I'm gonna show you guys what it looks like in a second but I need enough people to connect it I can get in what's called spectator mode let me see what I can do this now other player left spectator mode is not working so I gotta fix that too Oh a bunch of people are leaving new player connected connection reset by pier number of connections through a number of games to let me know if this is working for you guys or not if you're in games or not because again I don't know game one ended player none left game one kierra player left yeah okay I don't think this is working yet guys so we gotta give it a second here if you're in the game please let me know in the chat guys I haven't heard set had anyone tell me about any issues or not in the chat yet so I gotta see okay I'm gonna stop the server and we're just gonna get this this fixed currently because this is a bit of an issue so I was having this thing where I was like deleting games I think I'm just gonna stop deleting games and just add more keys into the dictionary so when I create a new game so game connections but oh that's why it's not working okay so we'll say current underscore game underscore ID again guys just give me a minute or two let me know if you have any bugs please I really do care if you have the bugs because I need to fix them yeah I know the server's offline is going online in a second okay so we'll say G equals current underscore game underscore ID and we'll just say after every two connections so it'll say like yeah if connections modules two equals zero then we'll just create a new game with current game ID so current current underscore game ID underscore game underscore ID and then we'll add one to that okay so that needs to be incremented plus equals one and then G equals current game ID and then Ralad we won't delete any games which is what I was doing at some point here F Dell yeah we don't need to do this game ended get rid of that okay so let's try this now I just got to push this code over to the server and then we should be able to actually run that desktop chess game server I'm hoping this is as easy as the fixes because if it's not then you know we're gonna be run into some issues here I'm also just gonna modify this specs file all right okay run that no it's not what I want to do same thing again okay there we go all right let's go guys connect now and see if this is working I've already have two games new player connected number of connections 1 number of games oh yeah the number of games output here is gonna be wrong but that's fine let me try to connect now I had this all working before I don't know what's going on I think it's just you guys are flooding me with games and I don't know I didn't code the server well enough to handle this let's run a game name there we go so I'm waiting for player let's see if someone else joins in if I can get in the game with someone here so whoever's gonna join next is gonna be in my game oh there we go I'm in a game ok let's select let me play ok um his turn holy crap a lot of you guys are joining oh my god ok well I did not expect this to happen I did not expect this many people to have to join the game immediately Jesus okay yeah this will be interesting to see if this works if you guys can see my this is my server screen right now oh my god okay people are leaving people are joining yeah oh this is gonna be really interesting okay whoever's playing against me needs to make a move because I'm waiting for them right now I'm gonna have to leave the game if they take too long holy crap Jesus yeah if you guys can't tell us a little bit some guy named himself hey Tim Tims time oh I'm waiting player to left this game clearly block is winner okay let me just do this again um oh my god okay I'll run through all this code works but I want to see if this is gonna work Tim let's run a game here okay I'm with blue jay all right blue jay your turn buddy let's go what's okay he moved there on black alright let's see if he can play with me by the way guys you see this mug available for purchase you can go right underneath he wears it underneath the description you should be able to see that so I'm just testing out the game this is what it looks like I'm in a game right now with blue jay it seems to be working but yeah let me know if you guys what's going on with you ran out of input on pickling stack under flow service server offline okay that's an issue there's gonna be a lot of stuff that I'm gonna need to fix here and by the way I'm just gonna like don't get too attached to your chess game because I'm gonna have to shut down the server at random times and fix stuff but I don't know I think this is pretty interesting and you guys can see the kind of I look at my server code right now look what's happening look how many people are connected I have these connections are wrong we have 40 not that's wrong for games to like people are just joining leaving you can see this guy left game 48 alright see I just keep joining in guys we'll keep testing this and this probably is about like 24 hours worth of coding because the stream that I did it in I only went for 18 hours did I not move what is happening here yeah this is not correct I'm trying to join a game but I'm still waiting server offline yeah this is gonna be a little bit of fixing so the stream might go longer than I expected um okay let me quit this game he can be the winner of that one and let's get in a new one and see what I can get going here there's some latency issues here um oh my god okay join all right I am block there turn who's going here Sahil is playing that right now joins time oh my god okay yeah so clearly this this is not working at the same level that I I thought it would well we'll see if we can get this going soon oh my god okay guys let me know your your errors please send them in the chat because I need to know what is going on here Tim see player one time Tim time okay I can move but it still says player one I don't even know if I'm in a game with someone oh my god okay he is going so I heated messages named himself thought so when you guys load up it should ask you to input like a name Adam at some point but yeah let me know how this is going for you guys for me this seems to be working like okay obviously there's some bugs I got a tune out here oh hey Reb you thank you for the $1 super chat man appreciate that but yeah I mean we'll see if we can get this going and these seems like the naming thing seems to have some issues too yeah I was trying to add some castling in here as well after but I was getting some kind of issues with the castling so we'll see like if you guys try to castle and see if your castling works and let me know so I'm using a bun - I cannot resize window it's bigger on my laptop screen oh god sorry about that I can't really help you with that um well why wouldn't he take my that's an interesting decision ok let's take that I'm not very good at chess either by the way guys I don't know why I decided to create chess but I did let's see here okay how many guys have we got in here right now seven connections 71 games that's because we're not clearing games I'm just incrementing IDs of games when will you continue the tower game at some point I'll continue the tower game where's my pie game script my turn hmm okay so this is working for me guys let me know if this is working for you again people are gonna be leaving joining all that kind of stuff and showed it to review thank you for the super chat 5 bucks again loving your videos and helped me so much in my programming journey appreciate you mate thank you man I appreciate you that super chats awesome means a lot man thank you okay guys I'm gonna do I'm gonna start writing some more code so I apologize whoever I'm playing right now playing against right now I'm gonna write some code to hopefully fix the server a little bit but again I need you guys to let me know in the chat if it's working or if it's not because that's gonna be like that I need I need to know that otherwise this is not gonna go very well you guys need to tell me what's going wrong with all these videos try to castle as well because castling is like a huge thing that I was trying to work on earlier and I want to see if that's working if you don't know what castle is it's like when you switch the king with the rook and the way that I did is you have to click the rook to go to the king so what I want to do now is number of games should really just be equal to number of connections over to I don't even know I don't even think I could show the number of games running pickle Dada was truncated load key 8 server offline Oh God okay um pickle Dada was truncated that one's it I have to change that now take a look okay let's just do that um alright so for those of you that don't know how this works essentially I have these these are all my scripts okay and what happens is I have this server code running on this external linux server it is this one right here that you guys can see and it's handling all the connections in and out of this game now what it's doing is it's storing the games on the server and then it's sending those games like the data for those games to each player so what happens is when someone moves in one game it will move like in the other game that they're connected with now the issue that I'm having right now is having all these different games running at once I obviously haven't programmed the server to work well enough to do this so you can see like people just keep disconnecting and reconnecting but I was in a game and it was working fine for me so I mean I don't know what like is wrong with other people unless people just keep leaving immediately and playing against other people and if you want to post like formal issues code whatever on the issue page on the github then I can look on that as well and I'm gonna be updating that get up if I make changes to the code here so I just want to print the number of connections when people connect now and when people disconnect I'm - saying the connections let's see here oh okay so keeping track of the connections is something that I need to do better now - because if you for some reason like if you got this exception does it break when you get this exception no it doesn't break hmm hmm if not gaming games okay all right I think the server codes fine we're just gonna keep testing this running server with two connections we got two games going right now try to stay in the game if you guys can for like a fair amount of time just to test out if this is working now I have this spectator mode that I had implemented but for some reason the spectator mode wasn't working I'm gonna try to fix that and also this is the main game script and what I did at the top here is I did all this jazz so that if you don't have pip or you don't have PI game installed what happens is it automatically installs it for you so it just implements this thing there's actually a script called get pip and it has the bytecode for pip you can see it's like 21,000 lines or something and so you don't actually have to install pip because I have the actual pip in the file and then what happens is it imports that file and then it tries to use that to install pion how can I talk to it maybe working because you're running the server on your network no no the server's no guys this server is sorry this server is running on like an external server like this servers in like Lithuania or something I don't even know where it is but it's um it's not working it's not running on my network so you guys will be able to join the game and I can see like hey - left game J bros left game number of connections - number of games that should be changed I'm gonna restart the server guys because I just need to change one thing here and modify so we don't I don't get this weird game output anymore because that game output is not correct now I had this really cool spectator mode that I coded and it was working and then now it's not working so that's great but we'll see if I can get it to work I just want to comment out this comment save X okay so I'm gonna try to work on getting this what do you call it's the spectator mode to work from my end you guys just keep playing and let me know again if you have issues and we're just gonna peace through this and hopefully by the time we hit like in the next 10-15 minutes everything will be working and I can just play against some of you guys and just chat with you on the live stream you if you guys are new here to join the game link in the description go to the Hubb I think I'd probably still have it up and there's instructions on how to get the game running on your thing you can skip step 1 as it should just install PI game for you automatically this is the repo and I haven't modified anything from the game end so it should just work for you guys now I'm gonna try to get the spectator thing working because for me it's having this spectator thing this spectator issue hey guys left game 7 hey Tim left game 8 J Bros so guys oh you guys hate Tim J Bros 2 are you guys leaving the game or is it kicking you from the game that's something that I need to know and like connection reset by Pierre I don't know what issue that is there's a ton of stuff that I don't know so we have to see like if this is working or not J Bros I see you in the chat are you leaving the games or are you being kicked from the game and thank you for congratulations on 30 K um okay so let's upload update this file you guys can't know it's a nut so I'm gonna have to hide that C this year I'm just gonna have someone just send me a message on discord here so I'm just gonna have to grab this here so keep going guys I'm reading the chat if you have any questions let me know but if you have the errors please send them because we get we're just going through the debugging stage I know it's kind of boring right now but that's all we can really do until I figure out what these issues are but it does look to be working like fairly well to be quite honest with you so we'll see you know if we can get this going alright hey Tim left game eights number of connections for its kicking me kicked me out a game it's kicking me okay um how is it kicking you guys out of the game is it just randomly are you just randomly being kicked or what's going on is it like disconnect disconnect disconnect what would what will happen in some instances is you'll be kicked if the other player leaves so that could be the instance but you should see a message that says like you've you've been kicked from the game if once I get this spectator mode going I'll be able to do it a bit easier like looking through the games okay here a bunch of people just joined and a bunch of people got kicked connection reset player W wanting game 9 Xen burr left game 9 okay let me run a script here and let's see if we can get this going randomly kicked yeah um okay one second guys holy crap people are just disconnecting connecting left game 17 player none left game 17 hmm okay let me print out the errors from the server side and then I'll try to fix some of them I'm just gonna restart the script guys sorry about that okay so server should be printing these exceptions so I have this try here if it's a server end issue it should just print them if it's not hmm let's see cuz when you disconnect that either men's means you left or it means that you know something happens so let's see here if not game okay let's run the server again okay - so it seems to work like at the beginning somewhat players end bar left game one right like I don't know if that's randomly kicking him or if he's joining in the game um let's see here let me get in the game here hmm so my spectator mode thing isn't working expected your luck game zero let's see if I can get this in here yeah I know it's giving me all this um spectator left game zero oh it's cuz it's okay that'd probably be why let's see your game yeah okay I'm gonna have to reset the server one more time guys sorry about that just delete that alright see if I can get in one here Tim okay there we go there turn I'm playing against this guy now let's see how long I can get this to go for and then I'll see what's going on with your guys games but for me when I do this it seems to be working fairly well to be honest for like my game end but I don't know also these times are messed up p1p2 so I oh this just changed hey Tim's time Zen bars game so the names are getting messed up that's it make a kickin tag on server I don't I don't randomly kick people that's the thing I don't know why people people are getting kicked out he's moving that okay so there's some latency issues here as well hmm okay but like I'm playing against someone here whoever's playing against me let me know if any of you guys are like successfully playing a game of chest against someone um let me know that and that would be helpful to know yeah see now I can't like I can't move right now it just seems frozen connection reset hey Tim's okay I'm gonna quit that and let him go if you want to quit the game it's better if you click Q to quit um hmm disconnect disconnect player to connection reset I don't know what this connection reset by peer means I'm gonna look that up okay keyboard interrupt let's run this again you guys can keep messing with that let me know the errors I'm gonna look up some stuff here connection reset by peer high amount of traffic okay so it may actually be a traffic issue that's that's causing this I'm just gonna make a modification in here and see if I can can fix this by just getting rid of I have like a timers yeah I don't know if that's gonna work I don't know if this is a traffic issue or what's wrong here I'm the winner tag on the server yeah okay connection reset by peer let's see air 404 hmm seems a server-side limits the amount of requests per time out as a security issue you need to guess how many maybe using the script with a counter and adjust your script to surpass the limit okay so what the issue I'm having apparently and why you guys are getting kicked is because there's too much traffic going on right now there's too many games running at once which is something I anticipated so what I'm gonna need to do is just make it so that the refresh rate to the server is slower but that means that it's gonna be like whale a gear when you guys are running this so I'm gonna increase it um what you guys are gonna have to do is read download this github repo just redownload it and just run game 2 up high again I I just made the change so just redownload and try to it you can see like people are just getting holy crap Jesus okay umm redownload the repo I'm shutting the server down right now if you see you guys have a chance to do this and we'll see if this fixes it a little bit if it doesn't honestly I don't really know what's going on but I what I really want to get the spectator mode thing working so I wanted to go through and see this in my mind this was gonna work a lot smoother than it has but I mean you know not everything works perfectly I also need why not my ask you with the server on the web so the traffic's better no man I'm not gonna recode a server right now I'm just like messing with it as we speak games zero board okay so we need to get rid of this first of all okay so first thing we should do if connections modulus to equals it with zero current underscore game ID plus equals one game's current ID okay but then connections goes down with someone else joins which means current game ID hmm there's got to be a better way to connect people into games because what's happening is like someone will connect and someone will leave and the connections will be lower and then you're gonna get in a different game based on your connections which we don't want so create a new game know that current game ID plus equals 1 if connections by just 2 equals 0 okay let's see here make a server handler for games yeah I have I have oh yeah print create new game I could do that but redownload that guy's for right now I'm gonna modify it on my end too and see if all I did is just add a timer essentially so that it doesn't it goes slower and when it's grabbing information which means it's gonna be kind of annoying but yeah you guys you guys will see how it works invalid game okay disconnect spectator left game that's spectator mode let's see an exception so if you leave while the peer is reset okay this does Python a private and public instances no I'm just trying to find a better way to assign people into games so that we keep hmm like you should really be deleting the old games keep so the current game ID is like that makes sense you add to the current game ID I can delete the other game which will kick someone out I don't know how exactly to go about doing this um let's see so what I had before I want to look at what I had before on the server actually let me go to the github and have a look at this and maybe I can just redownload that code and try again here from server okay let's go to chess game that's fine server okay so what I had essentially was let's see here oh no I didn't have the tries and except though if like for some reason something didn't work like you got disconnected it would delete that instance of the game which would cause the other person to get disconnected that worked for me when I just had like two or three people going at once so I don't know why it's not working now let's let me download this new cept exception okay and commit that all right I'm just gonna literally copy that it's got our raw okay we're gonna just try what I had last time again I said I'm gonna get rid of this address cuz I don't want you guys to see people's IP addresses new connection connection we'll get rid of this data as well because we don't actually we can print the line of games I think you need a lobby than a cube games yeah you'd be correct that I've put people into a lobby first and then IQ I just like right the plan of the car so you guys are aware the plan of this dream was not to write very much code at all like I was just planning on just releasing this and being like go play have fun I wasn't honestly expecting this many people to be playing so that's why maybe I can limit the amount of connections okay look I'm gonna try with the limit and it'll cue you like it'll if I do limit then it won't actually that'll just break you out okay let me try one let me try with the limit so if the connections I will only run like three games at once and see if I can get that working maybe let's see you know what let's just try this connections minus equals one really what's wrong with that that is except oh I forgot to comment out that and I don't need to go back in that nano watch a bit server okay let's try this yeah this is not going as smoothly as I was hoping okay someone's connected let's let's try this I'm really scared to keep running the server because then you guys just overload it like immediately I have it's a good server but I just I just my programming right there's nothing wrong with the server let's run a game it's gonna be I'm gonna be spectator mode right now aren't I oh there we go okay I'm playing against blue jays holy crap okay um so server's going down one more time I'm gonna fix it again I thought I remember that was the issue I ran into we're just gonna loop through the keys and just assign you into the next game if that doesn't work so say if G is less than all right if G not in games then we'll just add a new game so we'll say games say games and then zero was bored 8 comma 8 will do games G actually that should work should I be using a VPN no no you don't need a VPN I'm not stealing your IP don't worry um okay let's fix this No yeah whoever it's someone said in the chat cool idea brave project you're correct a very brave project I already had like I address already in use oh great that's gonna be an issue yeah you guys can see here like this is what the server is that's 8 as 8 cores tasks to 37 through 1 running ok let's let's close out any Python tasks I have right now I feel like the firewall on the server might be blocking all these connections back that's a very possible issue I'm just gonna monitor this server tab you guys go ahead and try to connect her we got one connection let's see what's going on alright guys try to connect I want to see if I can get this going or not we got one connection right now let me run one no I forgot I have two connection reset by peer Connect connect holy crap disconnect player none left game 0 number connections to so works with 2 games what happens when we have three games because right now there's two games running and I don't see any issues with three connections so it means someone's waiting to queue for game so if I try to go in now and now it's just work anymore oh wait okay your block their turn okay I'm playing against someone see if they can move like I don't seem to get kicked right away when I do this but a lot of people seem to just be like instantly being disconnected oh now I'm playing against someone else so what's actually happening here is other people are joining my game like when someone leaves this game someone else actually gets put into this game which is not obviously what you want what you want when someone leaves it it deletes that game um so you get kicked you can see this is this guy's turn he's not going so I'm just gonna quit and then play again um see if I can get in a game here I've had a few decent ones going waiting for player so that's me I'm the third connection see if someone else comes in here and see if this works um yeah trace my module named name era name Jake is not to find so someone else left ok guys someone joint okay now it's my turn all right sweet I'm playing against someone playing against bluejay this guy's can shout out to bluejay he has consistently been joining these games I've seen him in it like all the time do this ok so I'm playing I'm playing a civil game of chess right now and this seems to be working and this is against again one of the viewers right now blue jay and nothing's going on with our game like at least that I'm noticing there's nothing happening so we'll see here you have to put your name in quotations no you don't have to put your name the quotation your name should just be like text if you type numbers and stuff you might like run into an issue Oh connection so bluej either left that hmm connection reset by pierre blur none left game to get guys options right now we can keep I can keep trying I can set a limit on the amount of connections and see if that fixes things like just set it some max like 10 games running at once or something like that or I can try to program to fix it so infinite people can connect you guys can let me know what you want to see in the stream again I'm just doing this for fun I want to chat with some of you guys I'm not really too bothered that it's not working as well as I was hoping it would because I kind of expected that to be honest with you but um again you guys have to let me know what you want to see from that number of games oh ok let's get rid of this spectator thing the spectator of code is just not working if G not in games games G or what I think I should do is loop through all the games see if they're ready and if they're not ready then just put that player in the game so maybe that's what I'll do to determine the games so we don't get these weird connection issues so yeah ok so let's try that so let's say for game and games keys if game I guess oh it's gonna be keys will say if games game dot ready equals it goes false then we'll just throw someone in that game so I'll just say game say G equals game um with this new bytes object has no attribute ready oh that would have not unpick olden time holy crap okay I didn't miss any Super chats here tonight cuz someone gave me oh it's okay says I have eight dollars in revenue but it's because of its like us to get to Canadian conversion alright let me rerun the server guys again I apologize for all this mess I really wish this was working a bit better but you know we'll see server let's see if I can get this going now override okay so by the way in case you're confused this is win SCP or something which is just allowing me to FTP to the server so that I don't have to like do like I don't know edit the code on the server could you not compile this into an exe I could but I'd like then I'd have to you guys I'd have to keep working with stuff so just easier to do this okay let's try this now I'm game Tim connect all right waiting for player player B 1 in game 0 so I mean someone quits hey Tim left game 0 okay I'm waiting for someone enjoy my game right now there we go in so someone joined they got put in my game that's blue J sweet let's run it I've been playing against this guy like the whole time this is this is funny alright connection reset by peer I can't I don't know how to fix that issue so if the connection resets like how do you get a too much traffic to the socket holy I could set a time so there's too much traffic that's the issue I'm too much traffic on the server that's that's what we've figured out is the issue so it's working sometimes but then we just get randomly kicked because there's too much traffic all right so let's say socket Python too much traffic let's see if I can fix that you guys can keep messing with it what is the name cache when you set by peer it's fatal the remote server has sent you an rst packet which indicates an immediate dropping in the connection this means is disconnect connect yeah so connection reset by peer is the issue oh I can raise the socket time out issue okay let's try that and then that way okay socket time out raise Python let's see here that's all I want to raise that okay I want to raise the socket time out let's see this so you got eliminate yeah I have to limit like how this is low level networking socket how to catch socket time out set default timeout let me see what sockets default timeout is and then set it higher default timeout Python so what I've determined is happening I don't know if this is correct or not is um that it just there's so much traffic then it's not sending back in time and then it's just dropping the connection be the same well you cannot connecting I'm just gonna disconnect so I want to raise that socket timeout if so if I can do that then hopefully this will be work better timeout curses socket timeout okay so subclass socket time a note I don't know what the default socket timeout is I don't know what the thing is that it takes set timeout value set a time and I'm blocking socket operations the value may be non-native floating-point number expressed seconds okay so if that's seconds then let's just set that timeout to like five seconds and five seconds should be plenty of time for that at it socket default timeout five okay so let's run that now and see if I gets to work almost work install pie game for the impressive stuff man yeah then the script that I wrote to install pie game was um I was pretty impressed by that to be quite honest with you guys I'd show you one but like it just makes sure that if you have don't have pie game it automatically I'm oh god it's still not working very well if you're wondering what I'm doing I'm just pouring water into my mug um connect/disconnect Game one ended connections okay uh Pierre okay I don't think it's working guys let's see this server offline try again yeah yeah yeah that's yeah um kierra zero Pierre Pierre here connection reset Pierre so I need to handle that key err what line is that happening on 49 from threaded client oh hey Terry how you doing um okay so let's let's fix that Keir now so I'm getting this I mean this Kiera four games game which means a game clearly it's just not but that it should be a key cuz for game and game stock keys if games game got ready equals equals false G equals game past game that should just work that's not working we need to just try accept that done um bo games games try except when you don't know what to do just put in a try and accept just break that um alright let's try this print error game does not exist maybe we might have to do a like part two to the stream where Tim actually like fixes this and makes it work properly I thought the most common issue was just the timeout issue which I thought I could fix by just setting it bigger but also I'm wondering now where are most of you guys that are connecting let me know in the chat like are you guys in India are you in like Canada are you in Europe because that's probably gonna influence how this works with the timeout issue yeah that's probably gonna have some effect on the timeout again I don't know but let's break outside oh my god okay you fixed that break how do I do this is past okay so if that's the issue then bo games game let's just pick one that's do we use game any rails game if game not in games break so it should do that here Bo games game Bo to start user Bo games game so it'll just it's just crashes I okay try I don't know what's wrong with this I'm in Canada I'm in u.s. sorry wow I'm in I'm in Brazil you drink water from mug yes I do Ottawa sweet okay so we got people from all over USA Indonesia yeah I don't know I don't really know what the issue is to be honest I think it's also a thing like I'm sending a crazy amount of bytes like a lot of information like you can see this is how much it's sending every time so that could be an issue too maybe I'd like at some point you know I can have a look at this when I'm more focused not on stream and try to fix this um we'll keep going with it though okay so connections plus equal one con dot send out a string vo equals games game that doesn't work let's just pick another game so we already have the script to do that so if games game dot ready okay let's try this let's say bo equals games game check Instagram DM great proposition Tim alright let's check well I'll check through my stuff in a second guys okay let's try to run this again I know the server's offline right now so you guys won't be seeing anything I'm server yes but like this works for two-player I might just max the connections at two and play against some of you guys and like if this doesn't work if you guys are interested in doing that let me know or maybe make it like two games running at once and then hopefully that can like make things a bit better cuz again I don't really know what's going wrong with this Tim yeah it's hilarious the second that I start it like a ton of people join in so I know you guys are just like waiting to queue in the game when was this I hear new connections who's keeps naming themself hi Tim okay I'm playing now against someone see how long this can see how long this works I'm playing against blue Jeff why I always play against blue J I think it just me Blue Jay left game hey Tim left game connection reset by Pierre I still I don't get I'm from Greece I still cannot connect oh so I tried ping server's IP and has a hundred milliseconds latency is not too long maybe some thing other is the problem Poland dude yeah you're Bo reference before assignment that's an issue game does not exist okay let's try this again try accept print err game does not exist okay let's not do that just go and so pass well vo equals games games Bo is here though so this should be fun um you know reference before assignment where's that issue be able to start user current ID line sixty-three that shouldn't be an issue should have Bo should be defined Oh if so otherwise so you say if you notice it Bo equals none if not Bo then create a new game some will say I need to global current game I will just do it by connections I guess we'll just create a new game set games connection over to hmm okay I'm gonna leave this running you guys can still try messing with it I think I'm just gonna focus dial in here and try to fix this with this it just it has to be something with just the game queuing and just something like that unless people are quitting from like the client side but I don't think there's something wrong with the client side and if there was then it should be spitting out the error to you guys when the game crashes so if you see those errors let me know but um let's just try to get this working if try bo games game so I want to have a unique ID for each game but I'm doing it based on connections but I can't do it based on connections because if I do it based on connections then it just like that doesn't work okay so deleting games try Dell games games connections - it was one game game ended disconnected player okay that should work get rid of this say Pio eCos games games I got a 56 number a few times and running it oh my I don't even know what's up at that I'll run the game side and see what's up about to you it's funny because this works so well like I've run I'd had like four games running um like on my computer and like my brother's computer and they was working fine but now it's just not working at all let's just do this let's not go based on connections what I think I'm gonna do is just loop through all the games that exist see if first of all those get whole hmm I could just set rather than creating all these new games I could just set like five games have people join I don't know if want to do that either so many different ways to possibly do this if connections modules to equals equals zero games connections over to or eight I don't think I'm even I think I'm just gonna loop through and see if there's any games that aren't ready yet ABB's someone into that game and if there's no games then just create a new one okay so for game and game dog keys if game game to already equals false G equals game okay perfect will say if I will just say G equals negative one here if G equals negative one then we'll say games zero equals and in this case games not ready game zero but how are we ever gonna have game one then G equals equals negative one games and then lists games dot keys plus one game Ducky's negative one plus one equals board eighty I also ran out of input ran on input by subjects not you ready server offline what does that mean it's what I've got in CMD David that means that like you received a bytes object it did an unpick 'el and then the server offline so just like something happened with the server there I know the issue but it's kind of hard to like explain how that works we're getting this this issue with bo2 saying local variable Bo reference for assignment which means that the try/except up here wasn't working properly so Bo goos games if not spec okay Pio goes games game that should just always work if that doesn't then we should just quit the threaded client um pickled Dada was truncated pickled Dada was truncated you shouldn't be getting pickled data truncated I really tried so hard to fix that issue okay let's try this again okay let's send more data I don't think it's a timeout anymore I used to think it was the timeout let's receive this times eight so we don't get truncated pickled Dada anymore and let's see if the server runs a bit better now if we get multiple games going so say for game and game about keys there's nothing I won't do anything obviously so if G equals negative one games list games dog keys negative 1 which is the n plus one he was bored eight eight and then just say me equals madness so gee who's that and then G hates anyone who's new if you guys want to try this out I'm just having some issues getting a server running properly probably go for like another hour something we'll see you know how this works number of connections number of games equals the land of games that should be correct actually should delete game when you leave I almost want to max it to for connections and just say don't accept the connect in case so I'm gonna max the four connections or now I'm gonna say if connections is less than four otherwise break and we'll see it like I'll slowly increment what do you do it I'll slowly increment the amount of games that we have and then you know we'll see how this goes so we'll start with four and then we'll go up from there okay so let me go server yes okay let's run this now invalid syntax yep really okay yeah no server doc hi actually I don't want to edit it like that spend it here server it up high so equal isn't equal equals such a silly mistake that's fine I better fix that in here too so I forget if G equals equals negative one run that no run that okay connections first for people get in the game go list index out of range new fix one second this is actually easy fix I can't believe I didn't think of that um try because there's obviously gonna be no games so you have to create a new one except game 0 equals board so say G is zero games equals board okay try that now this is so stressful because usually I can just test it on my own computer and then like if it doesn't work it's just an issue for me but you guys are all like trying to connect constantly so we like I can get as frustrating for you guys especially because you're just trying to help me out ah all right I gotta be fast yeah otherwise I'm not even gonna get in the game get game Tim server offline if address already in use that that's an issue H top whoever's told me to do it concurrently um that's it that's a problem for another day what is this network manager thing doing I don't know what that's doing I don't think I have any more Python processes running should be at the top if they are oh people just like instantly connect server offline oh I'm not even gonna get in connection reset by Pierre let's see this Tim your block their turn okay what happened here it just stopped running oh my god I'm an idiot so what I did oh no this is that yeah don't do that yeah that's just yeah I essentially made it so once a hits for connection service stops running I don't you don't want that uh me Gayle fishing was ok it was kind of cold but you know it was alright connection reset can actually set it can actually reset connection number of connections three number of connections I want to reach for connections and then that way we can just like chill Johnny left game one come on Johnny Tim your block there turn all right for connections if no one leaves then you should be okay we should see if this works FIFA lover I'm doing good man how are you doing alright come on man let's go Zinberg it's your turn if you don't go see what I'm gonna have to quit okay there we go alright I'm gonna play a casual game of chess if you guys have any questions you just want to chat ask me anything feel free in the chat if you have any tips what I like if this works with four games then we've kind of fixed some of the stuff oh he's going Queen out alright I'm waiting to see if it tells me that I left 'game okay so let's go like hmm I also like very bad at chess so this is gonna be an interesting game I want to protect that pawn you guys have any chest tips here help me out please it's an it is cheating but you know it's fun okay ooh it's going for the pawn oh damn it now he's gonna take that takes the take that to go that um okay so this game is working I don't know what like everything else is having I'm gonna get my music going quickly here you're still watching yes I am knew he's gonna take that this guy's killing me right now this is your old chess game this is my old chess game this is my old chess game faithful lover I wasn't connected when it said I disconnected Oh God this is just okay this game is working though like I'm playing a nice game of chess against this guy although he's absolutely like mopping the floor with me but I mean other than that nice civil game also guys I'm working on this really cool machine learning model it's uh it's a chat bot that talks like me I've got it like kind of working like there's so much more I need to do with it but like it's really it's pretty exciting so if you guys are excited about that let me know I'm planning like what I'm doing is I trained it off all my previous iMessage history and I got all my responses like any given text and I forgot that you can go diagonal oh my god this guy's killing me um I Jesus can't go there do this sorry I got distracted off train it off all my iMessage history and then um what did I do from there sure we got the like responses based on what I've said oh my god this guy's killing I can't focus when I'm getting destroyed in chests now he's gonna take my rook isn't he let's see and right now I'm just working on the model that essentially can like take any string of text and give you a response that sounds like me but it's pretty interesting it's actually like I don't know he's kind of blowing my mind how it actually works I've been following like a few tutorials online on how to figure it out this this video will be saved so you guys can look at it it's kind of just been a mess I've just been trying to figure stuff out and get people connected a few people I think we're playing games but I don't really know I don't know if someone else is playing a game currently I don't know if that's happening all I know is I'm getting killed in this game of chess and it just not is not going great I really wanted to try castling but then he kind of ruined my approach on that alright we got a piece there now he's gonna take it with the rook looks like that one black mirror episode yeah it works okay so his in bars playing against me yeah so I don't know you guys were all saying it wasn't working but as soon as I start playing it works for me and it's nothing to do with my network so I don't know hmm it's coming in a bit of a pickle right here is not really much way to catch up could you guys would think I'd be good at chess but I'm really it's just I'm really just not I'm definitely gonna play around with the server stuff I've seen it done foreign python so thanks man no worries got ya the end of the day you know if it doesn't work you can just steal the code I have on github it's completely open-source right and try to mess with it there what is he going for here Oh Zen bar left the game I don't know if he left or or not if we ran into an issue so yeah that's a question okay guys try to connect see if you can get your games running I'm gonna bump the games up to like six I think so that more people can connect so I'm gonna quit that now and then yeah let's just we'll keep bumping up and see if we get this working properly six I feel like I should be printing out like what game it's putting you in what game it's not putting in but again we don't really not that advanced here um okay so let's go server yes how old do you Tim I'm 18 guys I do really apologize to a lot of you guys I appreciate the help and everyone's joining in and trying to mess with this I think it's kind of fun but I mean like it's also kind of annoying because you want it I want to get working a little bit better but at the end of the day um I'm not left the game oh great so you had block it's their turn I'm playing against player - I don't know whoever that is he must not know type 2 naman Oh connection reset player non left the game player hey Tim left the game left the game left the game hmm I'm gonna try castle because I haven't done that yet that'll be our test currently add a listener for an input let's see oh great he knows I'm trying to Castle cuz he's listening to what I'm saying maybe that other way I remember reading somewhere like the rules of chess like in your opening you never want to move the same piece twice or something like that and I've just violated that rule a bunch of times man really you're not gonna let me Castle I just want to test my castling let's do that so now I'm kind of screwed because he has all these pieces advanced up the board but you know I don't this would be good if I was actually like a decent chess player other player left so again I don't oh there's something I got an error that popped up there let's read that err I mean I'm gonna run this with IDL II and try to play and see like what errors I get one if I disconnect an invalid argument was supplied oh I'm not running server sir why am i running server one run game no edit with ideally five Tim let's get this PI game window open all right waiting for player let's see the next person to successfully connect to the server is going to be yeah was early planning on making this stream like go for a long time if I was I would I trot like attempt to fix all these issues obviously but again I just don't really know like what is going on there's issues on the server side there's issues on the client side just a lot of stuff and apparently okay now I'm in so I'm playing at Blue Jay then playing against this guy like the whole time I just want to have this ideally window open so I can actually see what the air is when when I get one so I'm just gonna keep testing this will keep going just kind of play with it um what else you guys saying here all right I'm so bad at chess I don't know have any idea what made us to actually make if you guys haven't seen my other livestream by the way I did what was it like a 12 hour coding one where actually went for 12 hours this time and I did the tower defense game so that one's cool okay so ran outta input bytes objects has so much we already failed server offline ran Oh to input that is actually a easier fix okay so we can fix that one ran out of input so if you guys we're getting ran out of input as like a main issue I can fix that actually what is ran out of input err Python what is that getting this I would check the file is not empty first most of the answers here I've dealt with how to manage EOF error exceptions which is really handy if you're unsure but whether the pickled object is empty or not however if you're surprised pickle if I was empty okay so the pickle file is empty that it's sending to me which means it wouldn't have been dumped from the server properly or it just like didn't receive anything from the server so it was empty when I was opening it okay let's try to mess with that server okay connection closed they'll print e.honda send all send data it goes pickled dumb Bo okay is that always happening if not d break so it should just be dumping this this pic object every time but I guess if Bo isn't defined but it should be so I don't know why that would be it so in the client error here pickled out loads reply let's try to make this eight yeah I don't know why that's doing that I don't know why I'm getting that except socket air as II trying to apply pickles ran out of input hmm where was I looking at up okay let's see pickle ran on input easy solutions to prefix each message with the length the problem with your code is that receive when you cease to be saga my return different amounts of data from what you might have expect and their slice type packet boundaries so the easy solution is prefect each message then for receiving okay for receiving everything the server sends until it closes its side of the connection try this socket dot send all okay and then start server at address so yeah I don't know why I'm getting that issue you guys were saying you were getting that issue a lot - um yeah I don't know that's it I wonder earn you guys playing right now says something says some games ago I player Jake left game one game one ended I think the game aspect is working but I think what just happening is it's it's just crashing on on this the client-side so I think I've honestly figured out because I don't get these like these happen to once in a while but that's not I don't know that's expected so I think what I need to do now is just mess with the client-side and see if there's a way that it you know it could keep trying rather than just doing this this issue here so we'll send that same data we'll just say like wow should we try it like I just want to set a timer essentially okay so let's import time this is gonna require that you guys read download this after so I'll tell you that after that's probably an issue to you guys are using like different versions of everything okay anyways we'll print E and I will say try or say start time this time that time we'll say Wow time that time - start others where time is less than and we'll do well give it like a 10-second doing this a long time we'll give it a five second time out so it waits five seconds to try to get another response if it doesn't get one in that time it will just break um so then what we'll do is just keep trying to do this so we'll keep if pick okay let's try this keep trying this so I could just do like a Wow let's put the whole thing in a while with whatever I'm trying to do here let's just put it in a while loop with it this time then start time while true and we'll say if reply okay so if we get here then we just break this wallet if we get to the point where we can return reply then break say well I'll just return anyway so we don't even need to break it'll just keep trying it but we need to do that time aspect let's do the hot so say time time - start underscore time okay I don't know if there's any way that I can block people from joining because I want to just try it on my end and see if this works okay I'm gonna stop that connection um Python equals Java they are both to me the same know Python Java are very different okay I first update a few things I think I'm just gonna just throw this code other player left so what's that exception where it says like failed Oh failed just means it it broke that while loop skipper to that try accept and screen break print exception where else is this break sometimes printer please type your name no I can't do that okay so I'm gonna upload this code to github you guys gonna have to read download it I'm gonna change the server here to what it is on my computer now I got to deal with all these different versions just a master cap you read that go to github let's go code update files so once I changed water client and game server as well okay everyone go to the github redownload this code I just updated some stuff I don't like who knows is it gonna work I have no idea we'll see and try that okay we're gonna we're gonna mess with that now and see if we can get that going I just put in the chat too because that was gonna happen sooner I'm waiting for all these connections now to come in so this is let's see this if you try to connect with the other one it still might work but again okay I'm gonna have to update the code on github again I'm I've apologized I should tested this first Tim sir offline what's the issue started connection new connection what's you get says you guys are in though Tim but I can't join server offline why is that happening games you ended number connections one actually reset or any this it's not working is it guys I don't know what the hell what the heck is happening there's nothing I don't think anything is happening on server I think it's just literally not oh the reply might be oh yeah I know what I did wrong oh god okay let's go to network client up I just everyone's like it's broken its broken okay let's see um well time that time is less than five I apologize go redownload again guys I changed it that's yeah that's yeah oh my god okay i'ma modify that when I mind now ideally I dis just yeah that would be why I wasn't working I was like why the heck is this going now it should work uh what's running the wrong thing you're gonna have to go download again guys from the thing I apologize see this still not working oh my god I don't know what the issue is edit with ideally server offline okay let's try this yeah I pulled just for all the mistakes yeah I don't know this is kind of fun to mess around with it but like this is breaking when it shouldn't be actually sleeping and break okay if Ronnie befall Bo equals connect so it's gotta be something here that's messing up print okay I'm just gonna turn the server offline so I don't mess with you guys anymore let's see what this issue is server oh well now the servers actually offline so that's gonna be the issue okay let's try this one more time try this Tim server offline so it's just printing oh I'm not ready Tim let's go this float object is not callable what did I do here subline um float object is not callable that's gonna be in here somewhere that I did this mess son float object is not call well I don't even know where that is time time okay okay where is my github yeah I think I'm gonna go for like another 40 minutes we'll see like we'll get ups like two hours because I am determined to try to fix this and then we'll see alright redownload again guys I'm typing it in the chat because I know it's something you won't see it I'm having silly syntax errors I should test this before I upload it to github I know I'm an idiot but it's fun let's run this now and what this one's probably gonna work either I'm just like going out at each time let's see oh there we go we're in ok so I fix something again I have no idea if this is gonna do anything we have no but you guys you need you need to redownload otherwise it's just gonna kick you every time you try to go in you just hop you got to redownload it otherwise it's not gonna work where's my pie game window my pie game thing shut down I don't know what happened to it run this again main game Tim so I got in ok you're a block so someone's on right now I guess we'll see if someone moves how does Tim type and talk yeah it's an interesting question what is that issue getting some some air here I don't know what it is though I gotta wait for someone else to build successfully connect slow mode maybe no I don't need snow mode it's fine my turn okay so far so good Oh bites at your object has no actually ran out of input ran on input by jumping to actually time one okay so that means it didn't unpick lit um okay sub line bytes object has no attribute time one which would probably be mean that I didn't unpick alit so reply equals pickled loads and I'm returning reply which would just be this because something didn't happen there oh I can't return reply unless we make it over this loop so only if we get to here are we good so because that should be the end of the wallet I only want to break if this works properly break I got Rando to input thing I'm running on a bun - yeah no okay that's let's fix this uh I just got to modify this client file inside live stream thank you guys again for the feedback does really help a lot and let's go can't change that and commit changes what is it case someone was complaining why is this on this playlist it's gonna one I haven't heard yet rockabyebaby comes on in the playlist I know great selling right ok let's run that ivory up I've updated it just like it yes you gonna have to keep downloading it is B if you have the git command you could just keep pulling it it'll be easy but Tim waited for player alright my turn an established connection was aborted by the software in your host machine by itself guys know what ready established connection was how do you know not minecraft is your host machine but not minecraft Python I've just finished watching the tower defense fit how do you like it man using some Frank no I'm using no framework i coded this from scratch which is probably why it's not working and established and remover suffer heroes machine let's see what the issue is here timeout or the never network connection died firewall see do we think it could be a firewall issue timeout to other network network connection dot firewall close the connection because it was open too long connection was closed before process has been finished there's not really a framework it just like I don't know solution disable antivirus disable firewall okay so which it could be an issue with that but I never had any issue before with that hmm let's see so that was the issue that was like run into object has not recovered all right well that's a new issue just there's just a lot you know the funny thing is like this works for like two people I just don't even work for a law so I assume it's just an issue with like it can't handle all these people and I just haven't coated in a way to handle these people socket air and establish connection I should really maybe open like a new socket after a certain amount of people connect why do I keep getting air output this pipe air occurs server responds to requests and the client has already closed the connection browsers do that sometimes finite usage you can ignore this web okay so that means like I want to make sure this client the client doesn't close the connection on himself so where is do I would even close this I'm gonna disconnect here anywhere well time time current II reply equals pickle uploads hmm people that load should load that into an object no I don't need to like cast it or something hmm Piccolo's ply said bytes object has no attribute which means it didn't get loaded in which means when I returned reply would have returned that not that okay who it should really just keep calling until it returns all right we'll do a time out we'll do a longer time out maybe less than ten I don't want to just keep like spamming the error message though invalid load key eight pickle data was truncated I don't know what the heck that error is some guy keeps keeps naming himself hi Tim Tim you really should save your name I should have done that all right let's try this we need to watch that console output oh oh okay I moved it was just lagging I guess so connection was reset means that some like from the client-side it reset the connection which I have no idea how to fix that this game seems to be working smoothly raisa say that's probably in a crash but we'll see see established connection was aborted by the software in your host machine yeah that's established can I don't know to fix that that's the issue Python sockets okay I'm gonna keep going out this for a little bit cuz I can fix that and I might be able to get against you guys but I don't know what we've seen the ER flask okay when running tests to install an established connection I could bump that connection timeout but it shouldn't be a connection issue on hmm you try to reconnect now cuz then it has to start nuke this is a very complicated issue take your time you don't need to be stressed or anything I'm not stressed I just want a little bit stressed but I won't figure this out and it's just frustrating because I had it working so well for two games and then as soon as I went to maybe server blocks the real-time sockets because a lot of requests at the same time I'm gonna send an email to the guys that on my server I'm just gonna post on my other tab and just see if I can get them to respond because maybe there's a firewall on there that's blocking that so let's see if that's the issue so I gotta go to again big shout it to cherry servers they hooked me up with this server it's not definitely not their fault that's not working it's probably mine um like two cherry servers are you guys still trying to connect let me know if you guys are working or not I like you guys get in a game I think in that it just crashes like there's a timeout or something on the server but it does work like the game works everything that's functional it's just that it's just the server issue right so put that down oh man you guys got kicked again I'm mister I'm just on my other monitor right now guys just working developing a game is very hard it can be fixed at once and it can't be fixed at once oh yeah for sure I know you mean that I do think that firewall might be issue let's see here I'm just logging into the cherry server here and getting these guys see if they can help me out I don't know if there's a way to like disable the firewall on my server we'll see though let me we'll get it the hosts load on it too and see if it's like going crazy yeah says it can handle 3 gigabits per second bandwidth or that's what it has your bandwidth so this should be fine networking hmm so I'm talking to Zack right now Adam cherry servers and we'll see if he gets back to me we can see what's happening here player as our left game but I didn't connect really what how does it have why would that be happening okay no it's because the thread that didn't end when you guys leave sometimes the thread actually doesn't end oh that can be an issue you I'm hey Tim by the way oh so some hey Tim there should not be any firewall and server by default just running some here let me put this on my other tab here okay so apparently is no firewall in the server so that's not the issue and you guys are saying that you're seeing your names in the console which is how do I see okay let's try this which is like kind of blowing my mind too so that means that the threads aren't stopping so we gotta fix that so thread try break print exception has eat break because I would kick you so we'll just break okay so let's try that now on the server side you know and that wind SB I'm hatin Oh the king of mystery will it make sense because your name is the king of mystery all right let's try this again and go No everyone go try to connect so now I'm starting to think maybe it's an issue I'm like that who knows at this point someone connected let's go to desktop chess game game I will play against you all right there turn hey Tim's time fifteen Tim's time all right see this works ah we left establish connection was aborted by the software in your host machine like I don't know what the heck that means maybe I need to disable firewall if I disable firewall and this works it's probably a bad idea to do this but let's see the main firewall off let's try it out I don't leave that off for long but let's see if this works now hey Tim is back in once again oh alright let's see no issues yet I don't know why I did that I'm just literally randomly moving pieces because I already know that it's just gonna break at some point let's go Nathan you missed quite a bit my friend game one ended connection reset by Peter okay oh dude to Castle that's not how you do it if you wanted to Castle you got to do castle and then hit King but I can't do it because you moved the dude oh so it wasn't the firewall that was the issue let's turn that back on yeah so that's just not the issue okay so go to client no might have to do another part time where I try to do this I really wanted to get a bunch of people going on he was working at first like kinda but then not really strange everyone is called player none yeah I don't know why this called player none I don't know why it's Nathan if you guys see your names and you not connecting then like let me know but who knows so yeah I think threaded clients friends exception II connection reset by peers so it's happening on the client side that it's just disconnecting oh I should probably change the socket timeout on the client side too cuz I down the server side to be oh wait did I don't have that I swear I added like Oh cuz I just brought it back to my other server alright let's see here um okay change socket default time outs this is like the last wind if this doesn't work then we I don't want to give up but we might have to socket dot set default timeout so I'm gonna try this on mine set as a ten-second timeout and then we'll try it on this as well so socket dot set default timeout that's ten seconds I know that sounds long but in chess it's like slow glee anyways so that's probably not that important I would you want to try another Network game like this okay so I got a push I got I'm gonna have to reset this chess game server yes waiting for connections okay game Tim all right waiting for player should get him here there we go okay you are white my turn Oh ran out of input 51 what the heck is that invalid load key I know it doesn't it's literally it's yeah it's weird PLC invalid load pickle the air you get is a standard error yet when the network gets with wrong file format what causes the error what the heck [Music] most common pickles to pickle everything with a single dump to a file but then you have to load everything at once with a single load however if you open a file here and it'll do multiple dump calls then your load will mirror that your open we're trying to achieve okay it'll be relevant I had some a problem when the pickle archive had been created using gzip compressed pickle archive has been like this try to open it throws errors but if the pickle is open gzip all is harmonious hmm unpicking err unbowed load key I don't know what that means try to unpick 'el something that had not originally been pickled yeah I know what truncated is I know I fixed like that one's a pretty easy fix but it just this one is kind of weird okay so reply Oh pickle dot loads am I ever sending anything back that's not what did this client used to look like now I don't have the old version of oh I do have the old version of client I can look at that chess game and it was ideal Eve yeah this game is built on Python whoever asked that pic equals okay if pick something like that send people the thumbs ok reply the only thing this should receive is pickled Dada though so wonder if I'm ever sending any downa back that's not pickles self declined a sentence during not encode data applying was something I'd receive if I was people download your ploy turn play [Music] let's see this pickle download reply ok so I don't know how I'm getting that error now that I've added this timeout so I don't know if I need this like timeout thing anymore let's get rid of this I know I could've just shift-tab this but you know we didn't do that so let's get rid of the hots so try this now and let's open this with ideally such a scheme game oh we don't need break anymore them okay let's edit this break you guys I said you guys I love how you guys are still trying to connect just the persistency I love it um okay let's try this game I feel like he was working better at the beginning then I mess with all this stuff and now who knows alright someone join should I use Python as hacking purpose I don't know man I'm just waiting for someone to connect so I can play against someone alright my chain Oh player Tim left game let's see what is our issue here why did that dinosaur ideally Tim you just instantly disconnects now so that's interesting where's my freaking thing server offline service not off on there just oh my gosh other player left holy crap router the input ran out of input menu screen missing one required potential argument name Oh gonna fix that okay bytes object has actually ready ran out of input ran out of input so it's something with the sending yeah I don't know man I am NOT a Python developer no well I mean I don't know what do you consider a Python developer I do a lot of development with Python but I don't have a job as a Python developer ran out of input data stream to go thumbs Bo which is the board client pickle dot loads fly I don't know guys don't know what is going on here it's sending back the board it's now we're getting an issue here we're like we're like all menu screen button menu screen win name could fix that okay let's just dress again it's like you need some break no breaks what I break I'm just gonna get off this to be honest I still haven't even eaten dinner yet so I got to do that probably go for another few minutes see how this works Tim all right load that up I don't know why that doesn't come to the forefront unpicking stack on unpicking stack underflow that's a new one let's try this one I think now it's time to read maybe you're gonna restart the server I don't know I haven't restarted the server in a while try that address already in you so I closed it too quick and this oh my god it doesn't okay under pickling understand a flourish and pickling under flow here this is what this when pickle ends unexpectedly here self to request to receive your seemingly 12 bytes max you pick a large must be longer than 12 bytes so gets cut off I would not recommend to handling TCP sockets directly unless you're very familiar with networking and you need high-performance justing HTTP to wrap your messages in using HTTP library if you do have to be able T to be directly of two choices you can agree on a terminal string when you up this code is on github guys console gave me air 32 broken pipe oh my god alright so it's just a socket error listen process could not create a dedicated process to handle the client requests the error is caused by a resource exhaustion issue either with the OS or within the Oracle Oh God socket air air 32 broken pipe also the following may need to be changed ok so I just gotta find a better way to send large pickle over socket okay hmm socket our byte stream so ideally to write your protocol read this this is a bass amp without protocol should be careful but buffer receive oh yeah because okay so pickle a file over socket IO bytes IO what does that do hmm so the way that I'm sending this data is just like bad that's that's that's the issue python pickle pickling over socket I don't want to read all that Pikul the loads case how do you get size of pic Madonna why would the sink a happy birthday it's interesting pickled data Python since the size of serialized pickle of knowledge can be quite different from the size of the object in memory we should probably persist 5 bytes how to get byte size of pickled out in Python okay I'm just gonna try this again run f5 Tim playing against Johnny right now I don't know who Johnny is but let's see if if we can get a game going other player left pickle data was truncated by table because not she ready all right guys so it's almost been two hours how long has it been actually and we're not really getting anywhere here I'm gonna look at this and see what I can do with the sending of data I think that all I really need to figure out and I you guys have obviously helped me realize this is um that the the way this data is sending is just not it's just not good I need a better way to send this data so well not send receive the data sending it is actually fine I need a better way to receive it on the the client and a better way to send it from the server and so if I just sit down and focus on this like half an hour she probably figured out but I am gonna end the stream now big thank you to everyone who joined again another thank you to cherry servers for hooking me up with that server definitely not their fault that this isn't working I just probably you know messed something up and I really do appreciate everyone helping me out on this I had a good time chatting with you guys and do this unfortunately I couldn't get it to work but you know sometimes that's how it goes and now I'm gonna learn from the mistakes and hopefully be able to fix this and do something better in the next time you guys have any other ideas for streams or more stuff that you want to see definitely let me know I really enjoy doing these streams and like if I can do some more shorter ones that are only like 2 hours long that fits my time schedule kind of a little bit better cuz the last ones I did were like 2 3 4 like no what am I saying they were like 12 and 18 hours long so yeah anyways guys once again thank you gonna hop off the stream now and I definitely will if you guys subscribe to the channel you guys will know when I do more streams and all that kind of fun stuff so see you guys later

Original Description

Help me test the online multiplayer chess game I created with python and pygame during my 24 hour coding stream. In this stream I will be setting up a server that will allow for unlimited players to play against each other in the game of chess I created. GitHub Download Link: https://github.com/techwithtim/chessGame/ Playlist: https://www.youtube.com/watch?v=iLHAKXQBOoA&list=PLzMcBGfZo4-nTARLniGMmigJT7P17wDDX Massive shout out to CHERRY SERVERS for providing me with the server to run my python code on. Without them this stream wouldn't have been possible. You can check them out here: https://www.cherryservers.com/ If you're interested in renting some powerful hardware for any of your projects they have very affordable options and an awesome support team that I can speak too first hand. About Cherry Servers Cherry Servers is committed to offering private and secure bare metal cloud infrastructure to small and medium businesses worldwide. Specialized infrastructure and hardware level control enables to handle even the most demanding workloads at ease. #python #pygame #codinglivestream ◾◾◾◾◾ 💻 Enroll in The Fundamentals of Programming w/ Python https://tech-with-tim.teachable.com/p... 📸 Instagram: https://www.instagram.com/tech_with_tim 🌎 Website https://techwithtim.net 📱 Twitter: https://twitter.com/TechWithTimm ⭐ Discord: https://discord.gg/pr2k55t 📝 LinkedIn: https://www.linkedin.com/in/tim-rusci... 📂 GitHub: https://github.com/techwithtim 🔊 Podcast: https://anchor.fm/tech-with-tim 💵 One-Time Donations: https://www.paypal.com/donate/?token=... 💰 Patreon: https://www.patreon.com/techwithtim ◾◾◾◾◾◾ ⚡ Please leave a LIKE and SUBSCRIBE for more content! ⚡ Tags: - Tech With Tim - Pygame - Python Tutorials - Coding Livestream - Pygame
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from Tech With Tim · Tech With Tim · 0 of 60

← Previous Next →
1 A* Path Finding Algorithm(Visualization)
A* Path Finding Algorithm(Visualization)
Tech With Tim
2 Python Programming Tutorial #1 - Variables and Data Types
Python Programming Tutorial #1 - Variables and Data Types
Tech With Tim
3 Python Programming Tutorial #2 - Basic Operators and Input
Python Programming Tutorial #2 - Basic Operators and Input
Tech With Tim
4 Python Programming Tutorial #3 - Conditions
Python Programming Tutorial #3 - Conditions
Tech With Tim
5 Python Programming Tutorial #4 - IF/ELIF/ELSE
Python Programming Tutorial #4 - IF/ELIF/ELSE
Tech With Tim
6 Python Programming Tutorial #5 - Chained Conditionals and Nested Statements
Python Programming Tutorial #5 - Chained Conditionals and Nested Statements
Tech With Tim
7 Python Programming Tutorial #6 - For Loops
Python Programming Tutorial #6 - For Loops
Tech With Tim
8 Python Programming Tutorial #7 - While Loops
Python Programming Tutorial #7 - While Loops
Tech With Tim
9 Python Programming Tutorial #8 - Lists and Tuples
Python Programming Tutorial #8 - Lists and Tuples
Tech With Tim
10 Python Programming Tutorial #9 - Iteration by Item (For Loops Continued...)
Python Programming Tutorial #9 - Iteration by Item (For Loops Continued...)
Tech With Tim
11 Python Programming Tutorial #10 - String Methods
Python Programming Tutorial #10 - String Methods
Tech With Tim
12 How to Overclock a NVIDIA GPU
How to Overclock a NVIDIA GPU
Tech With Tim
13 Python Programming Tutorial #11 - Slice Operator
Python Programming Tutorial #11 - Slice Operator
Tech With Tim
14 Python Programming Tutorial #12 - Functions
Python Programming Tutorial #12 - Functions
Tech With Tim
15 Python Programming Tutorial #13 - How to Read a Text File
Python Programming Tutorial #13 - How to Read a Text File
Tech With Tim
16 Python Programming Tutorial #14 - Writing to a Text File
Python Programming Tutorial #14 - Writing to a Text File
Tech With Tim
17 Python Programming Tutorial #15 - Using .count() and .find()
Python Programming Tutorial #15 - Using .count() and .find()
Tech With Tim
18 Python Programming Tutorial #16 - Introduction to Modular Programming
Python Programming Tutorial #16 - Introduction to Modular Programming
Tech With Tim
19 Python Programming Tutorial #17 - Optional Parameters
Python Programming Tutorial #17 - Optional Parameters
Tech With Tim
20 Python Programming Tutorial #18 - Try and Except (Python Error Handling)
Python Programming Tutorial #18 - Try and Except (Python Error Handling)
Tech With Tim
21 Python Programming Tutorial #19 - Global vs Local Variables
Python Programming Tutorial #19 - Global vs Local Variables
Tech With Tim
22 Python Programming Tutorial #20 - Classes and Objects
Python Programming Tutorial #20 - Classes and Objects
Tech With Tim
23 Cool VBS Script to Prank Your Friends!
Cool VBS Script to Prank Your Friends!
Tech With Tim
24 How to Overclock an AMD GPU
How to Overclock an AMD GPU
Tech With Tim
25 Best GPU'S For Mining Ethereum (2018)
Best GPU'S For Mining Ethereum (2018)
Tech With Tim
26 Recursion and Memoization Tutorial Python
Recursion and Memoization Tutorial Python
Tech With Tim
27 Ethereum Mining Rig - Hardware Guide
Ethereum Mining Rig - Hardware Guide
Tech With Tim
28 Pygame Tutorial #1 - Basic Movement and Key Presses
Pygame Tutorial #1 - Basic Movement and Key Presses
Tech With Tim
29 How to Install Pygame (Windows 8/10)
How to Install Pygame (Windows 8/10)
Tech With Tim
30 How to Trade Your Cryptocurrency (Bitcoin, Ethereum etc.) For Cash!
How to Trade Your Cryptocurrency (Bitcoin, Ethereum etc.) For Cash!
Tech With Tim
31 How to Mine Ethereum 2018 - WORKING (Super-Easy)
How to Mine Ethereum 2018 - WORKING (Super-Easy)
Tech With Tim
32 Microphone Comparison - $10 Mic vs $150 Mic (Blue Yeti USB)
Microphone Comparison - $10 Mic vs $150 Mic (Blue Yeti USB)
Tech With Tim
33 Pygame Tutorial #2 - Jumping and Boundaries
Pygame Tutorial #2 - Jumping and Boundaries
Tech With Tim
34 Pygame Tutorial #3 - Character Animation & Sprites
Pygame Tutorial #3 - Character Animation & Sprites
Tech With Tim
35 Pygame Tutorial #4 - Optimization & OOP
Pygame Tutorial #4 - Optimization & OOP
Tech With Tim
36 OBS Studio Tutorial - Best OBS Settings
OBS Studio Tutorial - Best OBS Settings
Tech With Tim
37 Linear Search Algorithm - Python Example and Code
Linear Search Algorithm - Python Example and Code
Tech With Tim
38 Make Any Mic Sound AMAZING! (WITH OBS)
Make Any Mic Sound AMAZING! (WITH OBS)
Tech With Tim
39 Binary Search Algorithm - Python Example & Code
Binary Search Algorithm - Python Example & Code
Tech With Tim
40 Pygame Tutorial #5 - Projectiles
Pygame Tutorial #5 - Projectiles
Tech With Tim
41 Pygame Game - Mini Golf
Pygame Game - Mini Golf
Tech With Tim
42 Pygame Tutorial - Projectile Motion (Part 1)
Pygame Tutorial - Projectile Motion (Part 1)
Tech With Tim
43 Pygame Tutorial - Projectile Motion (Part 2)
Pygame Tutorial - Projectile Motion (Part 2)
Tech With Tim
44 Pygame Tutorial #6 - Enemies
Pygame Tutorial #6 - Enemies
Tech With Tim
45 Pygame Tutorial #7 - Collision and Hit Boxes
Pygame Tutorial #7 - Collision and Hit Boxes
Tech With Tim
46 Pygame Tutorial #8 - Scoring and Health Bars
Pygame Tutorial #8 - Scoring and Health Bars
Tech With Tim
47 Cloud Mining vs. Hardware Mining - 2018
Cloud Mining vs. Hardware Mining - 2018
Tech With Tim
48 How to Install Pygame on Mac OSX (Fast-Simple)
How to Install Pygame on Mac OSX (Fast-Simple)
Tech With Tim
49 Pygame Tutorial #9 - Sound Effects, Music & More Collision
Pygame Tutorial #9 - Sound Effects, Music & More Collision
Tech With Tim
50 Pygame Tutorial #10 - Finishing Touches & Next Steps
Pygame Tutorial #10 - Finishing Touches & Next Steps
Tech With Tim
51 How to Fade Your Screen in Pygame [CODE IN DESCRIPTION]
How to Fade Your Screen in Pygame [CODE IN DESCRIPTION]
Tech With Tim
52 How to Create a Button in Pygame [CODE IN DESCRIPTION]
How to Create a Button in Pygame [CODE IN DESCRIPTION]
Tech With Tim
53 Pygame Side-Scroller Tutorial #1 - Scrolling Background/Character Movement
Pygame Side-Scroller Tutorial #1 - Scrolling Background/Character Movement
Tech With Tim
54 Pygame Side-Scroller Tutorial #2 - Random Object Generation
Pygame Side-Scroller Tutorial #2 - Random Object Generation
Tech With Tim
55 Pygame Side-Scroller Tutorial #3 - Collision
Pygame Side-Scroller Tutorial #3 - Collision
Tech With Tim
56 Pygame Side-Scroller Tutorial #4 - Scoring and End Screen
Pygame Side-Scroller Tutorial #4 - Scoring and End Screen
Tech With Tim
57 How to Create A Message Box in Python - Tkinter
How to Create A Message Box in Python - Tkinter
Tech With Tim
58 Is Ethereum Mining Still Profitable - Is It Worth It (April 2018)
Is Ethereum Mining Still Profitable - Is It Worth It (April 2018)
Tech With Tim
59 How to Run MAC OSX on a WINDOWS PC (Clover Boot-loader)
How to Run MAC OSX on a WINDOWS PC (Clover Boot-loader)
Tech With Tim
60 Programming Problem #1 - Alphabet Soup (Beginner/Novice)
Programming Problem #1 - Alphabet Soup (Beginner/Novice)
Tech With Tim

The video demonstrates the development of an online multiplayer chess game using Pygame, with features such as spectator mode and automatic pip installation. The creator troubleshoots and fixes issues with server connections, code updates, and syntax errors during the 24-hour coding stream.

Key Takeaways
  1. Download the repository from GitHub
  2. Run the game.py file
  3. Install Pygame and pip automatically
  4. Connect to the server
  5. Play the game
  6. Fix key errors and issues with game connections
  7. Create a new game based on the number of connections
  8. Assign players to games based on connections
💡 The video highlights the importance of troubleshooting and fixing issues with server connections, code updates, and syntax errors during the development of an online multiplayer game.

Related Reads

📰
Changes to LLM pricing: Novita, OpenInference and StreamLake
Learn about recent changes to LLM pricing for Novita, OpenInference, and StreamLake, and how to apply this knowledge to inform your AI strategy
Dev.to AI
📰
ChatGPT in 2026: Why It’s Still the Most Searched AI Tool on Google (And How to Master It)
Master ChatGPT in 2026 by understanding its top use cases, pro tips, and SEO impact to stay ahead in AI search trends
Medium · ChatGPT
📰
A Tiny LLM Request Recorder I Use to Reproduce Production Failures
Learn to build a tiny LLM request recorder to reproduce production failures and improve model reliability
Dev.to AI
📰
Changes to LLM pricing: Novita and StreamLake
Learn about the recent price changes for Novita and StreamLake LLMs and how they impact your projects
Dev.to AI
Up next
5 Levels of AI Agents - From Simple LLM Calls to Multi-Agent Systems
Dave Ebbelaar (LLM Eng)
Watch →