Skip to main content

A Python client for interacting with the airena game API.

Project description

airena Python Game Client

This package provides the core client library for building games that run in the airena ecosystem.

Overview

The airena Python Game Client enables developers to create games that interact with the airena platform. It handles communication, game state management, and integration with airena's infrastructure.

Features

  • Easy integration with airena game servers
  • Utilities for game state and environment management
  • Typed Python interfaces for robust development

Getting Started

  1. Install the package

    pip install airena-python-game-client
    
  2. Develop Locally When developing games locally, use the airena-mock-server to simulate the airena communication layer.

    docker run -p 8196:8196 ghcr.io/airena-dev/airena-mock-server:latest
    

    Configure your game client to connect to the mock server for local testing by setting the following environment variables:

    export airena_CGI_URL="http://localhost:8196"
    export airena_GAME_ID="00000000-0000-0000-0000-000000000000"
    export airena_GAME_SECRET="00000000-0000-0000-0000-000000000000"
    export PLAYER_COUNT=2
    

    These values will allow your client to communicate with the mock server.

  3. Basic Usage

    from airena_game_client import AirenaGameClient
    
    client = AirenaGameClient()
    client.start_game(
        player_public_states={
            0: {"foo": "bar"},
            1: {"bar": "foo"},
        },
        players_accepting_moves=[1]
    )
    while client.wait_for_changes():
        # Do move validation and reject moves if needed.
        if invalid_move:
            client.reject_moves({1: 'Invalid Move'})
            continue
    
        if game_over: # You decide if the game is over.
            client.end_game(winners=[1])
            break
        # Update Game State
        client.update_game(
                player_public_states={
                0: {"foo": "bar"},
                1: {"bar": "foo"},
            },
            players_accepting_moves=[1]
        )
    

License

MIT

Resources

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

airena_game_client-0.1.0.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

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

airena_game_client-0.1.0-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file airena_game_client-0.1.0.tar.gz.

File metadata

  • Download URL: airena_game_client-0.1.0.tar.gz
  • Upload date:
  • Size: 11.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.2

File hashes

Hashes for airena_game_client-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b8acc87ee60184dc04e2924a51782146f63ea92725228080a142e56efc3625a7
MD5 51cae0e3d0b081f4796ccfb14bb0e9cb
BLAKE2b-256 8e00c599cf1dbb03433a27ea60368cb3fab62bdfd10404168a812ba38221321b

See more details on using hashes here.

File details

Details for the file airena_game_client-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for airena_game_client-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5d9ff286d3926e7dd962443005922662ab4ee2a20c671f47cb9bee3e2cdedb0b
MD5 9ff8d31b820c3ae5072bfaa030616c8a
BLAKE2b-256 c3766e4a014aa123abed878d237b999ab3bcecb2061aa627dc8a4ccd6a84d097

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