A networking library for multiplayer games.
Project description
Aerics
A networking library for multiplayer games.
Getting Started
- Install Python
- 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
Release history Release notifications | RSS feed
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)
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
Algorithm | Hash digest | |
---|---|---|
SHA256 | ba90233aa16f83d3e4e259d9ad3168161623342cd70e4d5013aa961fa552d505 |
|
MD5 | 169cd2293ca7b7e0af47aa9114b9c31c |
|
BLAKE2b-256 | 4967b4d9050039f1d1dd489231f29a37d146d13b596cd0e4870f9aaa0c54975f |