Skip to content

Stormwrecker/pygame-multiplayer-framework

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This code is adapted from a series that TechWithTim made, but I made it expandable and can have up to any number of clients. So far, this framework has proved to be pretty indestructible and is pretty much fool-proof. It runs on the TCP protocol using socket and _thread (I tried UDP, but it's proven unreliable for me, and everyone online also discourages the use of UDP). Hopefully, it's generic enough to implement it in whatever Pygame project you have.

To run: Simply run server.py in your IDE then open up command prompts (or terminals) in the same directory and type in this command: python client.py and hit enter.

To change max amount of players: You can change max amount of players by simply modifying the MAX_PLAYERS variable in server.py and modifying the section of code in player.py just above the Player class.

Below is a preview of 5 clients interacting with each other:

image

Cool, right?

Dependencies: Pygame 2

About

A framework that I adapted from TechWithTim's code into something better

Topics

Resources

Stars

Watchers

Forks

Contributors

Languages