Skip to main content

A kind of FSM for game states

Project description

panda3d-stageflow

Just about every game beyond gameplay prototypes goes through distinct stages: Opening credits, main menu, main game loop, ingame credits, and so on. These can be arranged as a finite state machine, with data being passed between stages.

In addition, each stage, especially the main menu and main game loop, can have certain modes that modify their base functionality, mostly menus that pause the base game; These are called substages.

stageflow implements this basic framework, letting you...

  • focus on each Stage and Substage separately,
  • re-use Substages over several Stages,
  • use premade typical Stages / Substages.

For example: # FIXME: Abstract Panda3DSplash out of the example...

from direct.showbase.ShowBase import ShowBase

from stageflow import Flow
from stageflow.panda3d import Panda3DSplash
from stageflow.prefab import Quit


ShowBase()
base.flow = Flow(
    stages=dict(
        splash=Panda3DSplash(exit_stage='quit'),
        quit=Quit(),
    ),
    initial_stage='splash',
)
base.run()

This example...

  • creates a Flow with two stages (named splashes and quit),
  • immediately enters the splashes stage, which creates a Task,
  • starts Panda3D's main loop,
  • lets the Task play the splash until it ends, or escape is pressed,
  • transitions to quit, which in turn ends the program.

Installation, etc.

Installation: pip install panda3d-stageflow

Documentation: readthedocs.io

Source and issue tracker: GitHub

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

panda3d_stageflow-0.1b4-py2.py3-none-any.whl (7.3 kB view details)

Uploaded Python 2Python 3

File details

Details for the file panda3d_stageflow-0.1b4-py2.py3-none-any.whl.

File metadata

  • Download URL: panda3d_stageflow-0.1b4-py2.py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.1

File hashes

Hashes for panda3d_stageflow-0.1b4-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 850ae7c73c5a3bc4b4f3fae634306315eab6ba2864b0c633b2d282668ac5efe3
MD5 76b1520f08be0144f3ca75bf1bb3869e
BLAKE2b-256 2aeddc299a2bd9d6a0eccb7f795465c6aeefcd3149f95f6b570d3193261ca1b2

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