Skip to content

Simple Python multiplayer game engine using WebSocket.

License

Notifications You must be signed in to change notification settings

MaelkMark/python-mpglite

MPGLite

A simple Python multiplayer game engine

v0.1.0 BETA

Tests Status

MPGLite is a lightweight Python multiplayer game engine built on the websockets library. Its goal is to enable Python beginners and developers unfamiliar with async/await or asyncio to easily and quickly create simple multiplayer games. Have you ever created a simple game and wondered if you could make it multiplayer? Then this might be the right library for you. MPGLite is designed so you have to write as few additional code as possible, handles repetitive and complex tasks, taking the weight off your shoulders. However, it is not for handling robust multiplayer games or thousands of players.

Table of Contents

Features

  • Server and client side
  • Built-in "room" functionalities
  • Easy communication between the server and clients
  • Simple callback implementation
  • Customizable for any game.

Hello, Server!

Here's a simple example of a client greeting the server:

server.py

from mpglite.server import Server

def message_received(message):
    print("Message received:", message)

server = Server(
    "localhost",
    8765,
    on_message=message_received
)
server.start()

client.py

from mpglite.client import Client

client = Client("localhost", 8765)
client.connect()

client.send("Hello, Server!")

Installation

pip install mpglite

About

Simple Python multiplayer game engine using WebSocket.

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages