Skip to main content
Version: Release

Introduction

Documentation versions

This site has two documentation tracks:

  • Release — matches the stable master branch of batFramework
  • Dev — matches the dev branch (newer APIs, may change)

Use the version dropdown in the navbar to switch. You are viewing Release.

Getting Started​

BatFramework is available on Windows/Linux and only requires the pygame-ce library as a direct dependency.

What you'll need​

  • Pygame-ce (install latest version using pip install)
  • Python >=3.11
Quick Install
pip install --upgrade batFramework

For pre-release builds: pip install --upgrade --pre batFramework

Your first project​

Project structure​

A batFramework game is organized in the following way:

  • Manager handles the game and its scenes
  • Scenes manage layers (world / hud by default), each with a camera and entities, plus a built-in GUI root on hud
  • Entities are the building blocks of the game (sprites, widgets, systems, …)

When you want to add specialized behavior, inherit the relevant class from the framework and override the necessary hooks.

Get a window running​

Here's the minimum you need to run a batFramework project. The following code will create an empty window with the right resolution.

import batFramework as bf

bf.init((640, 480))

bf.Manager(bf.Scene("main")).run()

Minimal

Have a Scene​

By inheriting a scene, you can override its methods and customize it. As an example, let's change the scene's background.

import batFramework as bf

class MainScene(bf.Scene):
def do_when_added(self) -> None:
self.set_clear_color("blue")

bf.init((640, 480))

bf.Manager(MainScene("main")).run()

blue

note

You can check the Scene class to learn all the different methods the framework gives you.