Skip to main content

An Event Driven Python Game Engine

Project description

PursuedPyBear

Documentation Status

PursuedPyBear, also known as ppb, exists to be an educational resource. Most obviously used to teach computer science, it can be a useful tool for any topic that a simulation can be helpful.

A Game Engine

At its core, ppb provides a number of features that make it perfect for video games. The GameEngine itself provides a pluggable subsystem architecture where adding new features is as simple as subclassing and extending System. Additionally, it contains a state stack of Scenes simple containers that let you organize game scenes and UI screens in a simple way.

The entire system uses an event system which is as extensible as the rest of the system. Register new values to existing event types, and even overwrite the defaults. Adding a new event type to the system is as simple as firing an instance of your new event class with signal. Instead of a publisher system, the engine knows everything in its own scope and only calls objects with appropriate callbacks. The most basic event is Update and your handlers should match the signature on_update(self, update_event, signal).

Guiding Principles

Because ppb started to be a game framework great for learning with, the project has a few longterm goals:

Education Friendly

Non-technical educators should feel comfortable after very little training. While some programming knowledge is required, the ability to think in objects and responses to events allows educators to only focus on their lessons.

Idiomatic Python

A project built on ppb should look like idiomatic Python. It also should look like modern Python. As such, we often add new language features as soon as they're available, letting a new user always know ppb runs on the latest Python.

Object Oriented and Event Driven

ppb games are built out of instances of objects. Each object only has enough information to respond to the event provided, which always includes the current BaseScene. Because ppb doesn't have a master list of events, you can provide new ones simply to add more granular control over your game.

Hardware Library Agnostic

Because ppb strongly tries to be extensible and pluggable, each hardware extension can provide its own hooks to ppb, and you can nearly seamlessly switch between various Python libraries.

Fun

One of the maintainers put it best:

If it’s not fun to use, we should redo it

ppb is about filing off the rough edges so that the joy of creation and discovery are both emphasized. A new user should be able to build their first game in a few hours, and continue exploring beyond that.

Try it

Install ppb in the standard method:

pip install ppb

ppb provides a run function that makes it simple to start single screen games.

To make a very simple game, make a directory and add an image file called ship.png to it. Then add the following to a python file and run it.

import ppb
from ppb.features.default_sprites import TargetSprite


class Ship(TargetSprite):
    target = ppb.Vector(0, 40)


def setup(scene):
    scene.add(Ship(pos=(0, -7)))


ppb.run(setup=setup)

Compatibility

ppb is guaranteed compatible with Python 3.6 or later.

Get Involved

The fastest way to get involved is to check out the ongoing discussions. If you're already using ppb feel free to report bugs, suggest enhancements, or ask for new features.

If you want to contribute code, definitely read the relavant portions of Contributing.MD

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

ppb-0.11.0.tar.gz (2.5 MB view details)

Uploaded Source

Built Distribution

ppb-0.11.0-py3-none-any.whl (51.7 kB view details)

Uploaded Python 3

File details

Details for the file ppb-0.11.0.tar.gz.

File metadata

  • Download URL: ppb-0.11.0.tar.gz
  • Upload date:
  • Size: 2.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.8.6

File hashes

Hashes for ppb-0.11.0.tar.gz
Algorithm Hash digest
SHA256 f037bab7e73bd63b2b6795f862bf26fc88b82aa63e79383e26fd6c04ff1a54af
MD5 f9064d3125f66c500290428bac0771d6
BLAKE2b-256 1cc2f2bededfb5392f0c26a4ec20dafe62111bb63e290bd604200fdfae10d7af

See more details on using hashes here.

File details

Details for the file ppb-0.11.0-py3-none-any.whl.

File metadata

  • Download URL: ppb-0.11.0-py3-none-any.whl
  • Upload date:
  • Size: 51.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.8.6

File hashes

Hashes for ppb-0.11.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9545f91455c80b716f8776e8e62b0996f52b115e27cf5d9ceebd7886cdb242c8
MD5 f3440c08097ca6baab53dc804577a68c
BLAKE2b-256 7e6873615e7f267695fb0abadf324f1bbb32cc312f396ab549d6fe26f5aa2e51

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page