Audio-Visual Game Control System - Real-time motion tracking and game control
Project description
๐ฎ AVGCS - Ashwath-Visual Game Control System
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
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Run the test suite
- 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
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Email: team@avgcs.dev
๐บ๏ธ 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d7d46084ec3c4ca28b36a013fd6a348ac782dd692769362426b459f95ff0949e
|
|
| MD5 |
6a1ab9514f3eda9196038a1b0a03fc95
|
|
| BLAKE2b-256 |
55dfefd394376e93d0a1b7d2faa276f5dc03dfd0025baaf4604736ebddf258b1
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
baea4ac5cf8be00bb418202c3be228ebee75acbe1054220d51b76ac5883087f5
|
|
| MD5 |
2f67bb1a9b450cd66dd9f1e09731c354
|
|
| BLAKE2b-256 |
1b1c81b8e9f8ed3eb169f23e8fc27ab286f132f2dfe01ddff52a013279e33c46
|