Skip to content

g1776/termgame

Repository files navigation

python Code style: black Checked with mypy linting: pylint

Termgame

Terminal-based graphical game engine

Created by Gregory Glatzer.

Installation

pip install termgame

Find it on PyPI here.

Features

  • Simple, easy-to-use API inspired by Unity.
  • Physics engine powered by Pymunk
  • Ability to read and render sprites from image files.
  • Framerate and physics timestep control.
  • Statically typed with mypy.
  • User input with keyboard.

Examples

To run the examples from the source code, first "build" the package by running pip install . from the root directory of the project (where setup.py is). Then, you can run any of the examples by running

python termgame/examples/<example_name>/game.py

Terminal settings to optimize rendering

{
    "terminal.integrated.fontSize": 8,
    "terminal.integrated.scrollback": 78,
    "terminal.integrated.gpuAcceleration": "on" // if you have a GPU, otherwise use "auto"
}

Contributing

Contributions are welcome! Please open an issue or pull request if you have any suggestions or bug reports. The main branch is used for releases, so please open pull requests against the development branch.

Before Committing

Before committing, please run the following commands to ensure that your code is formatted correctly and passes all tests:

cd termgame
black src
mypy src
flake8 src --max-line-length=99
pylint src

Generating docs

You can run the following command (from a bash terminal) to auto-generate docs for the project. Make sure to pip install sphinx first.

sphinx-apidoc -o source/ ../termgame

If you want to build the docs you can run the make html command in the docs directory. Such as:

cd docs
make html

Upcoming Features

  • Decorator (@) for Gameobject events such as def walk() that pass in engine and frame to them so you don't have to.
  • Add support for 3D rendering.
    • Approach: Raycasting with pycaster, or Binary space partitioning (BSP)
  • Add support for importing 3D models.
    • Build wavefront files (obj) in Blender and import .obj files with pywavefront
  • Add support for sound effects and music.

About

Terminal-based game engine written in Python

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages