Skip to main content

Audio-Visual Game Control System - Real-time motion tracking and game control

Project description

๐ŸŽฎ AVGCS - Ashwath-Visual Game Control System

Python 3.8+ License: MIT PyPI version

AVGCS is a Python module for real-time motion tracking and game control. It enables you to control game characters using your body movements captured through a camera.

โœจ Features

  • Real-time Motion Tracking: Uses OpenCV and MediaPipe for accurate body part detection
  • Flexible Character Mapping: Map any body part to any character part (humanoid, animals, vehicles, etc.)
  • Custom Action Rules: Define custom gestures and movements to trigger specific actions
  • Multiple Tracking Modes: Support for both MediaPipe (advanced) and basic camera tracking
  • Easy Integration: Simple API for integrating with any game engine or application
  • Cross-platform: Works on Windows, macOS, and Linux

๐Ÿš€ Quick Start

Installation

# Install from PyPI
pip install avgcs

Basic Usage

from avgcs import MediaPipeTracker, CharacterMapper, MotionInterpreter

# Initialize motion tracking
tracker = MediaPipeTracker(camera_index=0)
tracker.start_tracking()

# Set up character mapping
mapper = CharacterMapper()
mapper.add_mapping("left_shoulder", "left_arm")
mapper.add_mapping("right_shoulder", "right_arm")
mapper.add_mapping("left_wrist", "left_hand")

# Create motion interpreter
interpreter = MotionInterpreter(mapper.get_part_mapper())

# Main loop
while True:
    motion_data = tracker.get_motion_data()
    if motion_data:
        commands = interpreter.interpret_motion(motion_data)
        for command in commands:
            print(f"{command.character_part}: {command.action}")

๐Ÿ“– Documentation

Core Components

MotionTracker

Abstract base class for motion tracking systems.

from avgcs import MediaPipeTracker, CameraTracker

# Advanced tracking with MediaPipe
tracker = MediaPipeTracker(camera_index=0)

# Basic tracking with OpenCV
tracker = CameraTracker(camera_index=0)

CharacterMapper

Manages mappings between body parts and character parts.

from avgcs import CharacterMapper

mapper = CharacterMapper()

# Add mappings
mapper.add_mapping("left_shoulder", "left_arm")
mapper.add_mapping("right_shoulder", "right_arm")
mapper.add_mapping("left_wrist", "left_hand")

# Set movement thresholds
mapper.set_threshold("left_arm", 0.05)
mapper.set_threshold("right_arm", 0.05)

MotionInterpreter

Interprets motion data and generates game commands.

from avgcs import MotionInterpreter

interpreter = MotionInterpreter(mapper.get_part_mapper())

# Add action rules
interpreter.add_action_rule("left_hand", "wave", {
    "min_movement": 0.1,
    "position_range": {
        "x": [0.0, 0.3],
        "y": [0.0, 0.5],
        "z": [-0.5, 0.5]
    }
})

Character Types

AVGCS supports various character types:

Humanoid Characters

mappings = {
    "left_shoulder": "left_arm",
    "right_shoulder": "right_arm",
    "left_wrist": "left_hand",
    "right_wrist": "right_hand",
    "nose": "head"
}

Dragon/Creature Characters

mappings = {
    "left_shoulder": "left_wing",
    "right_shoulder": "right_wing",
    "left_wrist": "left_claw",
    "right_wrist": "right_claw",
    "nose": "head"
}

Vehicle/Spaceship Characters

mappings = {
    "left_wrist": "thrust_control",
    "right_wrist": "weapon_control",
    "left_shoulder": "roll_control",
    "right_shoulder": "pitch_control"
}

๐ŸŽฏ Examples

Basic Demo

Run the basic demo to see motion tracking in action:

python examples/basic_demo.py

Pygame Demo

Run the visual Pygame demo:

python examples/pygame_demo.py

Custom Configuration

Create your own character mapping:

from avgcs import CharacterMapper, MappingConfig

mapper = CharacterMapper()

# Create a custom configuration
config = mapper.create_config(
    name="my_character",
    description="My custom character",
    character_type="custom"
)

# Add your mappings
mapper.add_mapping("left_shoulder", "custom_part_1")
mapper.add_mapping("right_shoulder", "custom_part_2")

# Save configuration
mapper.save_config(config)

๐Ÿงช Testing

Run the test suite:

# Run all tests
pytest

# Run with coverage
pytest --cov=avgcs

# Run specific test file
pytest tests/test_core.py

๐Ÿ“ฆ Project Structure

avgcs/
โ”œโ”€โ”€ avgcs/                 # Main package
โ”‚   โ”œโ”€โ”€ __init__.py       # Package initialization
โ”‚   โ”œโ”€โ”€ core.py           # Core classes and data structures
โ”‚   โ”œโ”€โ”€ tracking.py       # Motion tracking implementations
โ”‚   โ”œโ”€โ”€ mapping.py        # Character mapping system
โ”‚   โ””โ”€โ”€ utils.py          # Utility functions
โ”œโ”€โ”€ examples/             # Example applications
โ”‚   โ”œโ”€โ”€ basic_demo.py     # Basic motion tracking demo
โ”‚   โ””โ”€โ”€ pygame_demo.py    # Visual Pygame demo
โ”œโ”€โ”€ tests/                # Test suite
โ”‚   โ””โ”€โ”€ test_core.py      # Core functionality tests
โ”œโ”€โ”€ configs/              # Configuration files
โ”œโ”€โ”€ pyproject.toml        # Project configuration
โ””โ”€โ”€ README.md            # This file

๐Ÿ”ง Development

Setup Development Environment

# Clone the repository
git clone https://github.com/avgcs/avgcs.git
cd avgcs

# Install in development mode
pip install -e .

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

Code Quality

# Format code
black avgcs/ tests/ examples/

# Lint code
flake8 avgcs/ tests/ examples/

# Type checking
mypy avgcs/

๐Ÿค Contributing

We welcome contributions! Please see our Contributing Guide for details.

Development Workflow

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests for new functionality
  5. Run the test suite
  6. Submit a pull request

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

  • MediaPipe for advanced pose detection
  • OpenCV for computer vision capabilities
  • Pygame for the visual demo

๐Ÿ“ž Support

๐Ÿ—บ๏ธ Roadmap

  • GUI mapping tool
  • Gesture learning system
  • Pre-built character profiles
  • Support for multiple cameras
  • Integration with popular game engines
  • Mobile device support
  • VR/AR integration

Made with โค๏ธ by the AVGCS Team

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

avgcs-0.1.0.tar.gz (17.7 kB view details)

Uploaded Source

Built Distribution

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

avgcs-0.1.0-py3-none-any.whl (14.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: avgcs-0.1.0.tar.gz
  • Upload date:
  • Size: 17.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.8

File hashes

Hashes for avgcs-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d7d46084ec3c4ca28b36a013fd6a348ac782dd692769362426b459f95ff0949e
MD5 6a1ab9514f3eda9196038a1b0a03fc95
BLAKE2b-256 55dfefd394376e93d0a1b7d2faa276f5dc03dfd0025baaf4604736ebddf258b1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: avgcs-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 14.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.8

File hashes

Hashes for avgcs-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 baea4ac5cf8be00bb418202c3be228ebee75acbe1054220d51b76ac5883087f5
MD5 2f67bb1a9b450cd66dd9f1e09731c354
BLAKE2b-256 1b1c81b8e9f8ed3eb169f23e8fc27ab286f132f2dfe01ddff52a013279e33c46

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