Skip to main content

A networking library for multiplayer games.

Project description

Aerics

A networking library for multiplayer games.

Getting Started

  1. Install Python
  2. Open cmd/terminal and type:
pip install Aerics

Examples

Creating a server

from aerics import *

server = Server("localhost", 5656)

@server.event
def setup():
    pass

@server.event
def update():
    pass

@server.event
def on_connection(connection, address, id, clients, globals):
    print("New connection")

    return {"x" : 0, "y" : 0}

@server.event
def on_disconnection(connection, address, id, clients, globals):
    print(f"Client {id} disconnected")

@server.event
def on_recv(connection, address, id, clients, globals, data):
    data = data.split(",")

    if data[0] == "move":
        clients[id]["x"], clients[id]["y"] = data[1], data[2]
        return clients

    if data[0] == "close":
        server.disconnect(connection)
        return None

server.listen()

Creating a client

from aerforge import *
from aerics import *

def update():
    client.send(f"move,{player.x},{player.y}")
    players = client.recv()

    for i in players:
        forge.draw(width = 50, height = 100, x = int(players[i]["x"]), y = int(players[i]["y"]))

if __name__ == "__main__":
    forge = Forge()
    
    client = Client("localhost", 5656)
    client.connect()

    player = prefabs.TopViewController(forge)
    player.visible = False

    forge.run()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aerics-0.0.3.tar.gz (3.4 kB view details)

Uploaded Source

File details

Details for the file aerics-0.0.3.tar.gz.

File metadata

  • Download URL: aerics-0.0.3.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.2

File hashes

Hashes for aerics-0.0.3.tar.gz
Algorithm Hash digest
SHA256 ba90233aa16f83d3e4e259d9ad3168161623342cd70e4d5013aa961fa552d505
MD5 169cd2293ca7b7e0af47aa9114b9c31c
BLAKE2b-256 4967b4d9050039f1d1dd489231f29a37d146d13b596cd0e4870f9aaa0c54975f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page