r/Python • • Mar 04 '26

Showcase Made a networking library for multiplayer games -- pump() once per frame and forget about sockets

30 Upvotes

TL;DR: I built repod, a networking library for Python games (Pygame, Raylib, Arcade). No async/await boilerplate in your game loop—just send/receive dicts and call pump() once per frame.

repod is a high-level networking library designed for real-time multiplayer games. It abstracts away the complexity of asyncio and sockets, allowing developers to handle network events through simple class methods.

Instead of managing buffers or coroutines, you simply:

  1. Subclass a Channel (server) or ConnectionListener (client).
  2. Write methods starting with Network_ (e.g., Network_move).
  3. Call pump() once per frame in your main loop to dispatch all pending messages.

It uses msgpack for fast serialization and length-prefix framing to ensure data integrity.

Target Audience

This is currently meant for indie developers, hobbyists, and game jam participants.

  • Current Status: Early stages (v0.1.2), but stable enough for projects.
  • Goal: It's perfect for those who want to add multiplayer to a Pygame/Raylib project without restructuring their entire codebase around an asynchronous architecture.

Comparison

Compared to other solutions:

  • vs. Raw Sockets/Asyncio: Much higher level. No need to handle partial packets, byte encoding, or event loop management.
  • vs. PodSixNet: It’s essentially a modern spiritual successor. While PodSixNet is broken on Python 3.12+ (due to the removal of asyncore), repod uses a modern asyncio backend while keeping the same easy-to-use API.
  • vs. Twisted/Autobahn: Much lighter. It doesn't force a specific framework on you; it just sits inside your existing while True loop.

Quick Example (Server)

Python

from repod import Channel, Server

class GameChannel(Channel):
    def Network_chat(self, data: dict) -> None:
        # Broadcasts: {"action": "chat", "msg": "hello"}
        self.server.send_to_all({"action": "chat", "msg": data["msg"]})

class GameServer(Server):
    channel_class = GameChannel

GameServer(host="0.0.0.0", port=5071).launch()

Links & Info

I've included examples in the repo for a chat room, a shared whiteboard (pygame-ce), and Pong with server-authoritative physics. I'd love to hear your thoughts or what features you'd like to see next!