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.0.5.tar.gz (37.1 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.0.5-py3-none-any.whl (31.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: styly_netsync_server-0.0.5.tar.gz
  • Upload date:
  • Size: 37.1 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.0.5.tar.gz
Algorithm Hash digest
SHA256 5f2fb91d20a36587f1c22119b27a59c30efa0dbb5bf3a09f84c383db2eda35aa
MD5 41afe60a881834e8fb9c02b6b9d5eb70
BLAKE2b-256 0cc2ded9a47d52b7b7b2cfc60a5ca2334aab66d720fbf7bb089fd02a78db5ced

See more details on using hashes here.

Provenance

The following attestation bundles were made for styly_netsync_server-0.0.5.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.0.5-py3-none-any.whl.

File metadata

File hashes

Hashes for styly_netsync_server-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 73235f8e171817955ca3db0f127625fd6543c92f0e23de22f0bb3c67b4de57fa
MD5 1c1b77d0d6e98888a145b9b5fa37f7dd
BLAKE2b-256 5462005203d687ce6fbbc6c7daabc0015ed7bb0704cc29c58f99e377af1eac0e

See more details on using hashes here.

Provenance

The following attestation bundles were made for styly_netsync_server-0.0.5-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