Python Online Game Tutorial #2 - Creating a Server

preview_player
Показать описание
This online game tutorial with python shows how to create a server using python sockets. The server will be responsible for handling multiple connections/clients and storing/sending information.

◾◾◾◾◾
💻 Enroll in The Fundamentals of Programming w/ Python

◾◾◾◾◾◾

⚡ Please leave a LIKE and SUBSCRIBE for more content! ⚡

Tags:
- Tech With Tim
- Pygame
- Python Tutorials
- Online Game Tutorial Python
Рекомендации по теме
Комментарии
Автор

I love this series, and it's really helped me! I just want to add that encoding in this context means converting between a string and binary data, not anything security related.

reddust
Автор

wasn't even thinking of learning this stuff quite yet but just stumbled upon this series and its hugely helpful!

trevorribbans
Автор

TCP (SOCK_STREAM) is a connection-based protocol. The connection is established and the two parties have a conversation until the connection is terminated by one of the parties or by a network error.

isaacmurray
Автор

Thanks for the vids, dude. You explain everything pretty well.

veryexciteddog
Автор

If you are using IDLE (like me), you won't be able to run the server and the client at the same time and you will get a error. You can use visual studio code to run the server and IDLE to run the client (that works), but than you won't be able to run two clients on 4, so you can code in IDLE, save it when it's time to run it, close visual studio code, open the folder it's in (if you haven't already), and run multiple things on visual studio code.

ebrahimmomin
Автор

I have an error "WinError 10022"

moanxion
Автор

I can import _start_new_thread from threading that works similar, is there any difference?
Also I can't seem stop the script on cmd hitting ctrl+c..

hemantasharma
Автор

How can you connect 2 clients but no in LAN ?
I just tryied to do my own game and it works on 2 pc at home, but once I attempt to play with a friend, he can't connect

jeeaile
Автор

Hi, just wondering:, isn't it a waste of CPU power to start a new thread in each loop iteration only to find out there was no actual connection most of the times? Wouldn't it make more sense to create a new thread only if the following line executes correctly?

data = conn.recv(2048)

or will that line take too long and make the entire thing stuck?

WaldoTheWombat
Автор

Hello, Tim. I really enjoy your videos. I am currently writing a game to apply for internship and I have successfully finished my own chess game which I've written myself from scratch. Your pygame video helped me (2 spaceships game video) with the pygame library. Now, when I am trying to create a server following this, I am unable to as Python 3 is different from Python 2. Will it be possible for you to show us certain changes. Thank you anyways.

Ahmed-iam
Автор

Hi Tim, thanks for the video. Why did you choose the _thread module instead of the threading module?

WaldoTheWombat
Автор

getting an error with s.listen(2) - invalid argument was supplied

SoulCoder
Автор

Thanks too much... Very good tutorial...

walbersgames
Автор

I have a problem with the client. The error is "[WinError 10053] An established connection was aborted b y the software in your host machine".

mirohn
Автор

hello! i dont know why but i keep on getting this error:
s.listen(2)
OSError: [WinError 10022] An invalid argument was supplied

please help! i dont know what to do!

madi
Автор

tim can you do a reveiw on how to convert .py to .exe the pyinstaller wont work i think its updated

FeedFall
Автор

hello im having a problem and was wondering if someone could heso lp, when i run server.py it comes up with this "Traceback (most recent call last):
File "server.py", line 15, in <module>
s.listen(2)
OSError: [WinError 10022] An invalid argument was supplied"


so i copied the code off your website and it still said that, can someone help?

moist_rhubarb
Автор

I'm trying to solve the error of "OSError: [WinError 10022] An invalid argument was supplied"
It occurs when I try and run the command s.listen(2)


I even tried getting your code from your website and using it, and it didn't work


And finally, I'm 100% sure I wasn't running it in parallel


Do you know how to fix this?.

mazenkhallaf
Автор

I can't find the packages you're importing from. Where can I?

llorencgalbeh.
Автор

Why use _thread instead of threading? I'm getting into it a bit and it Flake8 says that threading is more convenient, is there any particular reason to use _thread instead?

timothyvandyke