Skip to main content

Python library that made for Multiplayer games.

Project description

BGM

Python library made for python multiplayer games.

About

This library made for python multilplayer games. It uses UDP protocol for transfering packets, library requires central server also packets are not encrypted but it gonna be soon.

Packets

  1. Connect packet
CONNECT|[From ip]|[To ip]|[From port]|[To port]
  1. Disconnect packet
DISCONNECT|[From ip]|[To ip]

Other packets are made by user.

Functions

Server

  1. Recive event - runs function everytime server recives message. Can be used as decorator
BGM_Server.recive_event(callback: Callable (data: Tuple, address: Tuple) ) 
  1. Connect event - runs function everytime server recives connection. Can be used as decorator
BGM_Server.connect_event(callback: Callable (address: Tuple) )
  1. Disconnect event - runs function everytime server recives disconnection. Can be used as decorator
BGM_Server.disconnect_event(callback: Callable (address: Tuple) )
  1. Start server - Starts server on defined ip and port
BGM_Server.start_server()
  1. Broadcast - Sends a same packet to everyone
BGM_Server.broadcast(message: Bytes)
  1. Constructor - Construct packet with data given and type.
Packets.Constructor(data: Dict, type: String)
  1. Deconstructor - Deconstructs packet given in arg.
Packets.Deconstructor(message: Str)

Client

  1. Connect - Connects to server with given information
BGM_Client.connect(ip: Str, port: Int)
  1. Send - Send packet to connected server with given information.
BGM_Client.send(data: Dict, packet: Str)
  1. Recive Event - If u are connected to any server it will call callback everytime u recive message (can be used more that 1 time)
BGM_Client.recive_event(callback: Callable)
  1. Disconnect - Disconnects you from connected server
BGM_Client.disconnect()
  1. Constructor - Construct packet with data given and type.
Packets.Constructor(data: Dict, type: String)
  1. Deconstructor - Deconstructs packet given in arg.
Packets.Deconstructor(message: Str)
  1. Disconnect - Returns constructed packet for disconnect
Packets.disconnect(fromip: Str, toip: Str)
  1. Deconstructor - Returns constructed packet for connection
Packets.connect(fromip: Str, toip: Str, fromport: Int, toport: Int)

Credits

Made by danxvo

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

bgm_net-0.1.1.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bgm_net-0.1.1-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file bgm_net-0.1.1.tar.gz.

File metadata

  • Download URL: bgm_net-0.1.1.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.1

File hashes

Hashes for bgm_net-0.1.1.tar.gz
Algorithm Hash digest
SHA256 c0420f48b8dee66299b3884ddfa50c058c0cb899782dfc40bd599fe84dfaf692
MD5 e0e5437c7d4b5e5193b9d1e8753bdbf9
BLAKE2b-256 bf8dbc4d0c13a407f3db0a368909f3b68c7317bd16974f79036b0baeef0a075d

See more details on using hashes here.

File details

Details for the file bgm_net-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: bgm_net-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.1

File hashes

Hashes for bgm_net-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d7b7d463514d0f9d34e5a301a3325f9a4de56e64a17951945958b5141cd75606
MD5 790700b6b508a7de872af41047e3f484
BLAKE2b-256 d19999b32eae1ca986216822753469c8656bf1da1f0f484937da2392fa2df92a

See more details on using hashes here.

Supported by

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