Skip to main content

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! 🚀🎮

Metadata

Release files for pfagd 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pfagd 0.1.0
File Size Uploaded Provenance Actions
pfagd-0.1.0.tar.gz 38.1 kB Without provenance Details for pfagd-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pfagd 0.1.0
File Interpreter ABI Platform Actions
pfagd-0.1.0-py3-none-any.whl Python 3 none any Details for pfagd-0.1.0-py3-none-any.whl

Total release size: 68.5 kB

Release files / pfagd-0.1.0.tar.gz

Download URL pfagd-0.1.0.tar.gz
Size 38.1 kB
Tags Source
SHA-256 checksum
How to use checksums
6298d9210a06aae9c2ed9893b76d1255ff3edcb51b640d98d2105c5a310daff7
BLAKE2b-256 checksum
How to use checksums
2a0d4b5b5cbdda847588346a19c9f99c2689b8dc088d7883e95d0b31997c1a01
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / pfagd-0.1.0-py3-none-any.whl

Download URL pfagd-0.1.0-py3-none-any.whl
Size 30.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6e7f919c03bcdb6436ae90e40816bb146922e509ffc22dabb605f20e87c92fd9
BLAKE2b-256 checksum
How to use checksums
1e551d3feaae7bb2c4dcd54d750c4783e474353985e7faa766f9f43ff31929d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Security for pfagd 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page