About this project
Python Game Server is a lightweight server and framework for turn-based multiplayer games. It targets board and card games as well as programming courses where students implement clients or new games.
Key features described in the README:
- Automatic matchmaking or explicit session joining
- A flexible, game-agnostic API
- A framework that hides multiplayer complexity from the programmer
- Adding new games by deriving from a base class and overriding a few methods
- Intelligent state updates to avoid polling
- Optional TLS support
- Only basic Python skills required
Quick start: start the server (server/game_server.py), then run two clients (client/tictactoe_client.py). The only requirement is a regular Python installation.
Client API: the client/game_server_api.py module lets clients start and join a game session, submit moves, retrieve game state, and restart a game within the current session. The README shows a TicTacToe game loop using GameServerAPI with server, port, game, session and players parameters, plus join(), state() and move(**kwargs) calls, and an IllegalMove exception.
Adding games: create a module in server/games/, implement a class derived from AbstractGame, override required methods, and register it in server/games_list.py. A template is provided at server/games/template.py. The API needs no changes for new games; moves accept arbitrary keyword arguments and game state is returned as a dictionary.
Server operation: edit IP and port in server/config.py, where other settings including TLS can be adjusted. A systemd unit file is provided for running as a service. The project wiki includes an API reference, client implementation guidance, and server operation notes.
Project background: developed for a programming course where students learn Python as a first language and work in small groups. The framework and API are designed so basic programming skills suffice, though use is not limited to education. Contributions are welcome via pull requests, issues or discussions. Licensed under GPLv3, copyright 2025, 2026 Fabian Eberts.
Comments
0 people shared their preference · Deer Point appears after 10 participants
Sign in to join the discussion.