Python for Android Game Development - Cross-platform game framework
Project description
PFAGD - Python for Android Game Development
PFAGD is a powerful, all-in-one Python framework for developing 2D and 3D games that run seamlessly on both desktop (Windows/Linux/Mac) and Android devices. Focus on your game logic and design while PFAGD handles cross-platform deployment, monetization, and optimization.
๐ฎ Features
Core Game Engine
- Cross-platform compatibility - Write once, run on desktop and Android
- Scene management - Easy scene transitions and state management
- 2D/3D rendering - Built on Kivy for smooth graphics
- Physics engine - Built-in 2D physics simulation
- Animation framework - Smooth sprite animations and transitions
- Audio engine - Sound effects and music playback
UI Framework
- Rich UI widgets - Buttons, labels, sliders, menus
- Flexible layouts - Responsive UI that adapts to screen sizes
- Custom themes - Beautiful, customizable UI themes
Asset Management
- Smart asset loading - Automatic optimization for mobile
- Image processing - Built-in image compression and format conversion
- Audio optimization - Efficient audio format handling
- Caching system - Fast asset loading with intelligent caching
Monetization Ready
- Ad network support - AdMob integration with easy setup
- In-app purchases - Complete IAP system for Android
- Analytics tracking - Built-in game analytics and user tracking
- A/B testing - Easy implementation of feature testing
Build System
- One-command builds -
pfagd build-android main.py - Automatic packaging - Handles manifest, permissions, icons
- Hot reload - Live code updates during development
- Multi-platform - Build for Android, Windows, Mac, Linux
๐ Quick Start
Installation
pip install pfagd
Create a New Game
# Create a new project
pfagd scaffold mygame
# Navigate to project
cd mygame
# Run on desktop
pfagd run main.py
# Build for Android
pfagd build-android main.py
Simple Game Example
from pfagd.engine import Game, Scene
from pfagd.ui import Button, Label
from pfagd.assets import AssetManager
class MainMenu(Scene):
def on_enter(self):
title = Label("My Game", pos=(300, 400))
self.add_widget(title)
start_btn = Button("Start", on_press=self.start_game)
self.add_widget(start_btn)
def start_game(self):
self.manager.switch_to("GameScene")
class GameScene(Scene):
def on_enter(self):
self.player = self.add_sprite("player.png", pos=(100, 100))
def update(self, dt):
# Game logic here
pass
# Create and run game
game = Game(
title="My Game",
start_scene=MainMenu(),
assets=AssetManager("assets/")
)
game.add_scene(GameScene())
game.run()
๐ฑ Cross-Platform Development
PFAGD makes cross-platform development effortless:
Desktop Development
- Instant testing with
pfagd run main.py - Hot reload for rapid iteration
- Full Python debugging support
Android Development
- One-command APK builds
- Automatic permission handling
- Native Android API access through Python
Code Sharing
- 100% code reuse between platforms
- Platform-specific optimizations handled automatically
- Unified input handling (touch, mouse, keyboard)
๐ CLI Commands
# Project Management
pfagd scaffold <name> # Create new project
pfagd run <file> [--debug] # Run game on desktop
pfagd run <file> --hot-reload # Run with hot reload
# Building
pfagd build-android <file> # Build Android APK
pfagd build-desktop <file> # Build desktop executable
# Assets
pfagd import-assets <dir> # Import and optimize assets
# Monetization
pfagd add-monetization admob # Add AdMob ads
pfagd add-monetization iap # Add in-app purchases
pfagd add-monetization analytics # Add analytics tracking
๐ Examples
Basic Platformer
class Player(Scene):
def on_enter(self):
self.player = self.add_sprite("player.png")
def update(self, dt):
# Gravity
self.player.velocity[1] += 500 * dt
# Ground collision
if self.player.pos[1] > 400:
self.player.pos[1] = 400
self.player.velocity[1] = 0
Adding Monetization
# Add AdMob ads
from monetization.ads import AdMobManager
ads = AdMobManager("your-app-id", "banner-id", "interstitial-id")
ads.show_banner("bottom")
# Track analytics
from monetization.analytics import AnalyticsManager
analytics = AnalyticsManager("your-api-key")
analytics.track_level_start("level_1")
๐ฏ Target Use Cases
PFAGD is perfect for:
- Indie game developers wanting to reach both desktop and mobile
- Prototype development with rapid iteration
- Educational games that need cross-platform deployment
- Casual mobile games with monetization requirements
- Game jams where speed of development is crucial
๐ฆ Architecture
pfagd/
โโโ engine/ # Core game engine
โ โโโ core.py # Game loop, scenes
โ โโโ renderer.py # Cross-platform rendering
โ โโโ physics.py # Physics simulation
โ โโโ animation.py # Animation system
โโโ ui/ # UI framework
โ โโโ widgets.py # Buttons, labels, etc.
โ โโโ layout.py # Layout management
โโโ assets/ # Asset management
โ โโโ manager.py # Loading, optimization
โโโ monetization/ # Revenue features
โ โโโ ads.py # Ad networks
โ โโโ iap.py # In-app purchases
โ โโโ analytics.py # User tracking
โโโ cli/ # Command-line tools
โโโ scaffold.py # Project creation
โโโ build.py # Build system
๐ง Requirements
- Python 3.8+
- Kivy (automatically installed)
- Buildozer (for Android builds)
- PIL/Pillow (for image processing)
Optional:
- Android SDK (for Android development)
- PyInstaller (for desktop builds)
๐ค Contributing
We welcome contributions! See our Contributing Guide for details.
Development Setup
git clone https://github.com/pfagd/pfagd.git
cd pfagd
pip install -e .
pip install -e .[dev] # Install development dependencies
๐ License
PFAGD is released under the MIT License. See LICENSE for details.
๐ Support
- Documentation: pfagd.readthedocs.io
- Issues: GitHub Issues
- Discord: Join our Discord
- Email: support@pfagd.org
๐ Acknowledgments
PFAGD is built on top of excellent open-source projects:
- Kivy - Cross-platform Python framework
- Buildozer - Android packaging
- PyInstaller - Desktop packaging
- Pillow - Image processing
Start building your cross-platform game today with PFAGD! ๐๐ฎ
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 pfagd-0.1.0.tar.gz.
File metadata
- Download URL: pfagd-0.1.0.tar.gz
- Upload date:
- Size: 38.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6298d9210a06aae9c2ed9893b76d1255ff3edcb51b640d98d2105c5a310daff7
|
|
| MD5 |
01df5158b084fee20027fb5b8e7e4d0c
|
|
| BLAKE2b-256 |
2a0d4b5b5cbdda847588346a19c9f99c2689b8dc088d7883e95d0b31997c1a01
|
File details
Details for the file pfagd-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pfagd-0.1.0-py3-none-any.whl
- Upload date:
- Size: 30.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6e7f919c03bcdb6436ae90e40816bb146922e509ffc22dabb605f20e87c92fd9
|
|
| MD5 |
84c53d2e419a9c9a8275908428305aa7
|
|
| BLAKE2b-256 |
1e551d3feaae7bb2c4dcd54d750c4783e474353985e7faa766f9f43ff31929d0
|