Giter Club home page Giter Club logo

pursuedpybear's Introduction

PursuedPyBear

stable: Documentation Status

canon: 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 Scene. 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(position=(0, -7)))


ppb.run(setup=setup)

Depending on your operating system, you may need to install additional packages (see installation guide).

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 relevant portions of Contributing.MD

pursuedpybear's People

Contributors

alby37135 avatar astraluma avatar bernardthered avatar bildzeitung avatar bors[bot] avatar bubbsthesupreme avatar dmaroulidis avatar elenajp avatar gideongrinberg avatar ironfroggy avatar jschwarzwalder avatar jugmac00 avatar julielinx avatar lfunderburk avatar lgh2 avatar lunacodes avatar mark-boer avatar marymclark avatar mfonism avatar mgmanzella avatar michaelcdubois avatar moshez avatar nbraud avatar pathunstrom avatar reginareynolds avatar serin-delaunay avatar sheenarbw avatar sjames1958gm avatar tran-dy avatar vicohart avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pursuedpybear's Issues

Scene Class

Should Inherit Publisher and keep a reference to the view and controller interfaces.

New Rendering API

instead of leaving rendering code to the developer, the Engine should use a Scene.game_objects attribute to get a list of sprites, then filter the list by checking for collision against a Scene.viewport attribute.

Scene.game_objects: Iterable[GameObject]
Scene.viewport: GameObject

The goal of this change is to simplify the drawing code and being able to centralize optimizations of rendering routines.

Mouse subsystem

A Pygame based subsystem to create PPB Mouse events.

  • Listens for hardware mouse events
  • Raises ppb.events.Mouse events
  • Translates screen space to game space.
  • Extends Update event

Formalize Sprite API

All sprites are two pieces: A model and a view. The view is based on the hardware rendering objects. The model is a class that listens for events from the engine and manages state.

Windows SDL blinking sprites

Reported by two windows on Windows platforms, all sprites blink erratically during game play.

Probably a problem in SDL.

Using pygame.FULLSCREEN makes it impossible to close game.

On macOS when passing flags=pygame.FULLSCREEN to GameEngine the now fullscreen window does not have a close button, and without a keyboard escape can not be closed.

Proposed: Implement some form of keyboard value that will kill all PPB windows either by throwing a QUIT event or exiting the engine loop.

New Log Levels for low level engine debugging

Right now, it is impossible to add debug logging to the Engine itself at the logging.DEBUG level without it flooding a user's debug logging.

To prevent this, some sort of mechanism should be added to allow engine logging to use a level lower than the built in logging.DEBUG

To that end, a new logger class could be implemented.

Alternatively we can monkey-patch logging to have an additional method.

Or finally we could, as developers on the engine proper, use the "hard" way of calling logging.log(NEW_LEVEL, debug_message) directly.

Additionally, we should pick a logging value to use.

Components Package

Components will be the items that are used to make a game (As separated by the items that make the engine run.)

Components: Sprites and in game objects.
Utilities: View, Controller, Publisher and similar.

Improve publishing functionality

Currently the engine subscribes to itself to catch events, by subscribing to each scene in turn we can have only a single publisher active at a time.

System Lookup Interface

Right now, when one system needed another system, there's no good way to do it.

As part of this issue, we should build an interface to allow this.

Considerations:

  • Should be non-blocking: A system that doesn't have another system shouldn't lock up and should do its best to keep functioning without the other system.
  • Should probably use the existing signalling system to request and respond.
  • Consider a simple callback model.

SDL flags must be passed bitwise -- prefer Pythonic APIs

Right now, the flags parameter accepts a single flag, which must conform to the bitwise-OR flags from SDL/PyGame. Would much prefer that flags parameter accept either a single flag or an iterable of flags that will be combined for the user inside the engine.

  • Define PPB Flags for supported flags.
  • Consider that flags is an artifact of implementation and really is talking about rendering flags.
  • Accept either a single flag or an iter of flags that can be bitwise-ORed inside the engine itself.
  • Make lazy evaluation.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.