mpgameserver


Namempgameserver JSON
Version 0.2.4 PyPI version JSON
download
home_pageNone
SummaryPython Multiplayer Game Server
upload_time2024-08-17 10:49:05
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseNone
keywords pygame multiplayer udp server
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# MpGameServer

A Python 3.8+ UDP Client and Server for building multiplayer games with a focus on security and ease of use.

MpGameServer abstracts all of the complexities with handling network connections and multithreading so that
you can focus on building an event driven game server.

The network protocol is based on the work of [Glenn Fiedler's Gaffer On Games](https://www.gafferongames.com)

* [Installation](#installation)
* [Features](#features)
* [Performance](#performance)
* [Security](#security)
* [Roadmap](#roadmap)
* Documentation
    * [Echo Server Example](docs/example.md)
    * [PyGame Example](docs/example2.md)
    * [Getting Started](docs/GettingStarted.md)
    * [Network Protocol](docs/network.md)
    * [Production Deployment](docs/ProductionDeployment.md)
* API Documentation
    * [Client](docs/client.md)
    * [Server](docs/server.md)
    * [HTTP/TCP/WebSockets](docs/http.md)
    * [Cryptography](docs/crypto.md)
    * [Serialization](docs/serializable.md)
    * [Event Dispatch](docs/event_dispatch.md)
    * [Pygame Engine](docs/engine.md)
    * [Misc.](docs/misc.md)
    * [Experimental](docs/experimental.md)

![Client](docs/client.png)

## Installation

MpGameServer has an optional installation of pygame.

```bash
pip install mpgameserver[pygame]
```

## Features

* UDP Client and Server
* Supports Windows, OSX, Linux
* End to End Authenticated Encryption
* IPv4 and IPv6 support
* Mitigations for DDOS amplification attacks
* Detect (and reject) corrupt or tampered packets
* Reject duplicate datagrams, and duplicate messages.
* Optional guaranteed datagram delivery
* Automatic message fragmentation for messages larger than the maximum packet payload size
* Combines small messages into a single datagram
* Connection metrics including datagram latency, datagrams per second sent and received, bytes per second sent and received.
* Configurable Server IP block list
* Configurable MTU size

## Installation

You can install MpGameServer from [PyPI](https://pypi.org/project/mpgameserver/)

```
pip install mpgameserver
```

MpGameServer supports python 3.8+

## How To Use

Read the [Getting Started](docs/GettingStarted.md) guide for how to use this package with PyGame.

## Security

Datagrams are encrypted using AES-GCM. A unique key is generated for every
connection using ECDH and ECDSA. The elliptic curve SECP256R1 is used.
This provides Authentication (a client can verify it is communicating with the correct server),
Integrity (the client and server can detect if a message has been modified)
Confidentiality (unauthorized users are not able to decrypt the messages.)

## Performance

The performance goal for this server is to handle 128 concurrent connections, each sending 32 datagrams per second, with 60 server ticks per second.

The primary bottleneck is the encryption or decryption of datagrams. The limit
is about 40,000 datagrams per second (depending on hardware). In practice this
translates to sending or receiving around 3000 datagrams per second,
if any practical workload is performed on each datagram.

The second limitation is that the ack bits in the header only contains 32 bits.
The implicit assumption is that there will not be more than 32 unacked datagrams in flight.
This puts a limit of 32 datagrams per second, the default timeout. Sending more datagrams
than this limit can result in datagrams that are received by the remote client, but
are not acked on the sending side. A game or server running at 60 frames per second
should take care to structure sending messages to avoid hitting this limit.
Note that 32 datagrams per second is a transfer rate of about 45KB per second.

## Road map
* Client Side Prediction (CSP) / Server Side Prediction (SSP)
  * A half baked solution is almost ready to be merged.
* Entity Component System
* Connection throttling based on latency
* Use X509 certificates for server authentication. The current EC key solution is somewhat hacky.
* Ability to send multiple packets per tick/frame.
* Better retry logic for sending. Currently only retry on timeout is supported.
* Support for message de-duplication and strong ordering. While individual datagram packets are de-duplicated, the current
  best way to de-duplicated individual messages is to embed a SeqNum.
* An API to allow a client to get the metrics from a headless server. A metrics dashboard for a headless client
* detect packet flooding and prevent sending if there are too many datagrams in flight
* Utilities to help with user account creation, with a database independent API.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "mpgameserver",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "PYGAME, MULTIPLAYER, UDP, SERVER",
    "author": null,
    "author_email": "Nick Setzer <nsetzer@users.noreply.github.com>",
    "download_url": "https://files.pythonhosted.org/packages/a9/3d/0c26896816fd27833ff26cbe16c91fbca20f8c292e8731505bae3ab1eb80/mpgameserver-0.2.4.tar.gz",
    "platform": null,
    "description": "\n# MpGameServer\n\nA Python 3.8+ UDP Client and Server for building multiplayer games with a focus on security and ease of use.\n\nMpGameServer abstracts all of the complexities with handling network connections and multithreading so that\nyou can focus on building an event driven game server.\n\nThe network protocol is based on the work of [Glenn Fiedler's Gaffer On Games](https://www.gafferongames.com)\n\n* [Installation](#installation)\n* [Features](#features)\n* [Performance](#performance)\n* [Security](#security)\n* [Roadmap](#roadmap)\n* Documentation\n    * [Echo Server Example](docs/example.md)\n    * [PyGame Example](docs/example2.md)\n    * [Getting Started](docs/GettingStarted.md)\n    * [Network Protocol](docs/network.md)\n    * [Production Deployment](docs/ProductionDeployment.md)\n* API Documentation\n    * [Client](docs/client.md)\n    * [Server](docs/server.md)\n    * [HTTP/TCP/WebSockets](docs/http.md)\n    * [Cryptography](docs/crypto.md)\n    * [Serialization](docs/serializable.md)\n    * [Event Dispatch](docs/event_dispatch.md)\n    * [Pygame Engine](docs/engine.md)\n    * [Misc.](docs/misc.md)\n    * [Experimental](docs/experimental.md)\n\n![Client](docs/client.png)\n\n## Installation\n\nMpGameServer has an optional installation of pygame.\n\n```bash\npip install mpgameserver[pygame]\n```\n\n## Features\n\n* UDP Client and Server\n* Supports Windows, OSX, Linux\n* End to End Authenticated Encryption\n* IPv4 and IPv6 support\n* Mitigations for DDOS amplification attacks\n* Detect (and reject) corrupt or tampered packets\n* Reject duplicate datagrams, and duplicate messages.\n* Optional guaranteed datagram delivery\n* Automatic message fragmentation for messages larger than the maximum packet payload size\n* Combines small messages into a single datagram\n* Connection metrics including datagram latency, datagrams per second sent and received, bytes per second sent and received.\n* Configurable Server IP block list\n* Configurable MTU size\n\n## Installation\n\nYou can install MpGameServer from [PyPI](https://pypi.org/project/mpgameserver/)\n\n```\npip install mpgameserver\n```\n\nMpGameServer supports python 3.8+\n\n## How To Use\n\nRead the [Getting Started](docs/GettingStarted.md) guide for how to use this package with PyGame.\n\n## Security\n\nDatagrams are encrypted using AES-GCM. A unique key is generated for every\nconnection using ECDH and ECDSA. The elliptic curve SECP256R1 is used.\nThis provides Authentication (a client can verify it is communicating with the correct server),\nIntegrity (the client and server can detect if a message has been modified)\nConfidentiality (unauthorized users are not able to decrypt the messages.)\n\n## Performance\n\nThe performance goal for this server is to handle 128 concurrent connections, each sending 32 datagrams per second, with 60 server ticks per second.\n\nThe primary bottleneck is the encryption or decryption of datagrams. The limit\nis about 40,000 datagrams per second (depending on hardware). In practice this\ntranslates to sending or receiving around 3000 datagrams per second,\nif any practical workload is performed on each datagram.\n\nThe second limitation is that the ack bits in the header only contains 32 bits.\nThe implicit assumption is that there will not be more than 32 unacked datagrams in flight.\nThis puts a limit of 32 datagrams per second, the default timeout. Sending more datagrams\nthan this limit can result in datagrams that are received by the remote client, but\nare not acked on the sending side. A game or server running at 60 frames per second\nshould take care to structure sending messages to avoid hitting this limit.\nNote that 32 datagrams per second is a transfer rate of about 45KB per second.\n\n## Road map\n* Client Side Prediction (CSP) / Server Side Prediction (SSP)\n  * A half baked solution is almost ready to be merged.\n* Entity Component System\n* Connection throttling based on latency\n* Use X509 certificates for server authentication. The current EC key solution is somewhat hacky.\n* Ability to send multiple packets per tick/frame.\n* Better retry logic for sending. Currently only retry on timeout is supported.\n* Support for message de-duplication and strong ordering. While individual datagram packets are de-duplicated, the current\n  best way to de-duplicated individual messages is to embed a SeqNum.\n* An API to allow a client to get the metrics from a headless server. A metrics dashboard for a headless client\n* detect packet flooding and prevent sending if there are too many datagrams in flight\n* Utilities to help with user account creation, with a database independent API.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Python Multiplayer Game Server",
    "version": "0.2.4",
    "project_urls": null,
    "split_keywords": [
        "pygame",
        " multiplayer",
        " udp",
        " server"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "200c956d5db5e9d293775df07b719c570eee23e056332e3468156ae4e605a042",
                "md5": "d6c841893886663d9e66b934bc0fe706",
                "sha256": "c5c235a1d81c3933f0c52a6f60551ac7a81c3133ce21bcf08eedc90980b11d32"
            },
            "downloads": -1,
            "filename": "mpgameserver-0.2.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d6c841893886663d9e66b934bc0fe706",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 97159,
            "upload_time": "2024-08-17T10:49:02",
            "upload_time_iso_8601": "2024-08-17T10:49:02.537885Z",
            "url": "https://files.pythonhosted.org/packages/20/0c/956d5db5e9d293775df07b719c570eee23e056332e3468156ae4e605a042/mpgameserver-0.2.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a93d0c26896816fd27833ff26cbe16c91fbca20f8c292e8731505bae3ab1eb80",
                "md5": "71a3b05ad76c9a0af3b2ea980e423a35",
                "sha256": "1cded870bff51e500f45f5bf2a27e2db6bbcb02e1013bacdb09704a265a5404f"
            },
            "downloads": -1,
            "filename": "mpgameserver-0.2.4.tar.gz",
            "has_sig": false,
            "md5_digest": "71a3b05ad76c9a0af3b2ea980e423a35",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 90891,
            "upload_time": "2024-08-17T10:49:05",
            "upload_time_iso_8601": "2024-08-17T10:49:05.210771Z",
            "url": "https://files.pythonhosted.org/packages/a9/3d/0c26896816fd27833ff26cbe16c91fbca20f8c292e8731505bae3ab1eb80/mpgameserver-0.2.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-17 10:49:05",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "mpgameserver"
}
        
Elapsed time: 0.37050s