Skip to main content

Python for Android Game Development - Cross-platform game framework

Project description

PFAGD - Python for Android Game Development

Version Python License

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

๐ŸŽ– Acknowledgments

PFAGD is built on top of excellent open-source projects:


Start building your cross-platform game today with PFAGD! ๐Ÿš€๐ŸŽฎ

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

pfagd-0.1.0.tar.gz (38.1 kB view details)

Uploaded Source

Built Distribution

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

pfagd-0.1.0-py3-none-any.whl (30.4 kB view details)

Uploaded Python 3

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

Hashes for pfagd-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6298d9210a06aae9c2ed9893b76d1255ff3edcb51b640d98d2105c5a310daff7
MD5 01df5158b084fee20027fb5b8e7e4d0c
BLAKE2b-256 2a0d4b5b5cbdda847588346a19c9f99c2689b8dc088d7883e95d0b31997c1a01

See more details on using hashes here.

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

Hashes for pfagd-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6e7f919c03bcdb6436ae90e40816bb146922e509ffc22dabb605f20e87c92fd9
MD5 84c53d2e419a9c9a8275908428305aa7
BLAKE2b-256 1e551d3feaae7bb2c4dcd54d750c4783e474353985e7faa766f9f43ff31929d0

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