Skip to main content

STYLY NetSync Server - Multiplayer framework for Location-Based Entertainment VR/MR experiences

Project description

STYLY NetSync Server

A Unity-based multiplayer framework for Location-Based Entertainment (LBE) VR/AR experiences. Provides real-time synchronization of player positions, hand tracking, and virtual objects using a Python server with ZeroMQ networking and binary serialization.

Installation

From PyPI (when published)

pip install styly-netsync-server

From Source

# Clone the repository
git clone https://github.com/PsychicVRLab/STYLY-LBE-Multiplayer.git
cd STYLY-LBE-Multiplayer/STYLY-NetSync-Server

# Install in development mode
pip install -e .

Using uv (recommended)

# Run without installing (one-time use)
uvx styly-netsync-server

# Run with custom options
uvx styly-netsync-server --dealer-port 5555 --pub-port 5556

# Run with uv (automatically installs dependencies)
uv run ./dev  # Convenience script for development

Usage

Command Line

Start the server with default settings:

styly-netsync-server

Start with custom configuration:

styly-netsync-server --dealer-port 5555 --pub-port 5556 --beacon-port 9999 --name "My-Server"

Disable UDP discovery:

styly-netsync-server --no-beacon

Programmatic Usage

from styly_netsync import NetSyncServer
import time

# Create and start server
server = NetSyncServer(
    dealer_port=5555,
    pub_port=5556,
    enable_beacon=True,
    beacon_port=9999,
    server_name="STYLY-NetSync-Server"
)

try:
    server.start()
    # Keep server running
    while True:
        time.sleep(1)
except KeyboardInterrupt:
    server.stop()

Client Simulator

Test the server with simulated clients:

# Simulate 100 clients
styly-netsync-simulator --clients 100

# Custom server and room
styly-netsync-simulator --server tcp://localhost --room my_room --clients 50

Architecture

  • Binary Protocol: Efficient ZeroMQ-based networking with ~60% bandwidth reduction vs JSON
  • Threading Model: Separate threads for receive, periodic broadcast, and cleanup operations
  • Client Management: Device ID to client number mapping with automatic cleanup
  • Network Variables: Synchronized key-value storage with conflict resolution
  • RPC System: Remote procedure calls for custom game logic

Dependencies

  • Python 3.8+
  • pyzmq >= 26.0.0

Development

Testing During Development

There are several ways to test the server during development:

1. Install in Development Mode

# Install the package in editable mode
pip install -e .

# Run the server
styly-netsync-server

2. Run Directly as Python Module

# From the project root
python -m styly_netsync

# With custom options
python -m styly_netsync --dealer-port 6000 --pub-port 6001

3. Use uv for Development

# Run using convenience script (automatically installs dependencies)
uv run ./dev

# Run with custom options
uv run ./dev --dealer-port 6000 --pub-port 6001

# Use uvx for one-time execution without installation
uvx --from . styly-netsync-server

# Test with client simulator
uvx --from . styly-netsync-simulator --clients 50

4. Create Test Scripts

# test_server.py
from src.styly_netsync import NetSyncServer

server = NetSyncServer(dealer_port=5555, pub_port=5556)
try:
    server.start()
    print("Server is running. Press Ctrl+C to stop.")
    while True:
        pass
except KeyboardInterrupt:
    server.stop()

5. Use the Test Client

# Start the server first
styly-netsync-server

# In another terminal, run the test client
python test_client.py

6. Load Testing with Client Simulator

# Start server
styly-netsync-server

# In another terminal, simulate multiple clients
styly-netsync-simulator --clients 100 --room test_room

# Monitor server logs for performance metrics

Code Quality

# Install development dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Format code
black src/ tests/

# Lint code
ruff src/ tests/

# Type check
mypy src/

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

styly_netsync_server-0.5.3.tar.gz (37.6 kB view details)

Uploaded Source

Built Distribution

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

styly_netsync_server-0.5.3-py3-none-any.whl (32.5 kB view details)

Uploaded Python 3

File details

Details for the file styly_netsync_server-0.5.3.tar.gz.

File metadata

  • Download URL: styly_netsync_server-0.5.3.tar.gz
  • Upload date:
  • Size: 37.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for styly_netsync_server-0.5.3.tar.gz
Algorithm Hash digest
SHA256 3d02c654543dfa330e046a5ef746a38ed82662e76016b7c29c5edfbca30b2cc6
MD5 808dc28d1fee3c3bba94cca44ae284c0
BLAKE2b-256 2fd2613c5e9e543b43cd855a2747e13e3e8a19442159b011ae96e90946cdc8c9

See more details on using hashes here.

Provenance

The following attestation bundles were made for styly_netsync_server-0.5.3.tar.gz:

Publisher: publish-to-pypi.yml on styly-dev/STYLY-NetSync

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file styly_netsync_server-0.5.3-py3-none-any.whl.

File metadata

File hashes

Hashes for styly_netsync_server-0.5.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b711347fe4072efb8fd21e9bcdb36ec6a474b0fb8dbd81bab7b6c41397a01ea7
MD5 f88507433aa1597ebc35ba85c6a44b6b
BLAKE2b-256 aadae744ce0e17b0d11771dceb4802596d6111dffc259c9e0044af3477e0df02

See more details on using hashes here.

Provenance

The following attestation bundles were made for styly_netsync_server-0.5.3-py3-none-any.whl:

Publisher: publish-to-pypi.yml on styly-dev/STYLY-NetSync

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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