Skip to main content

PyFense is a tower defense game built using Python 3, the cocos2d and pyglet frameworks. If you want to contribute in any way (art, code, balancing, bug reporting) you can do so here: https://github.com/nimarb/pyfense/ . Thank you!

Project description

pyFense

PyFense is a Tower Defense game written in Python 3 using cocos2d and pyglet. For the roadmap and further documentation/information on the project, check documentation/roadmap.md.

Playing the Game

If you just want to play and enjoy pyfense, you can simply install it from pypi here: https://pypi.python.org/pypi/PyFense. Alternatively you can clone this repo and run pyFense locally through virtualenv, for that please see the instructions below on how to setup a development environment.

About

pyFense was written by Daniel Lechner, Jakob Müller, Matthias Lutz, Nimar Blume and Robin Wachsmann as part of an university project at the Technical University of Munich. The aim of the course was to get familiar with the Python programming language, git, and distributed development.

Contributing

We welcome all contributions: code, ideas, sprites/art, balancing suggestions and other improvements. Please don't hesitate to ask, write an issue or send a pull request! For code, please try to adhere to the PEP8 guideline to keep the code readable and uniform :).

Dependencies

python 3, pyglet>=1.3.0, cocos2d>=0.6.5, numpy>=1.9.2
earlier versions might work but were not tested against. pyglet 1.2.2 and earlier cause a segfault due to incorrect calling of gdk_pixbuf.

How to Setup the Development Environment

To setup the development environment you can either use venv which comes with Python 3.3 or later, or you can use virtualenv which has to be explicitly installed but works with a wider variety of versions. venv is definitely recommended.

Steps to replicate the development environment:

Using venv (recommended)

  1. clone this repo
  2. initiate virtualenv in the project dir: python3 -m venv .
  3. install pyfense in the virtualenv environment: ./bin/python setup.py develop
  4. set execute permission for the executeable: chmod +x ./bin/pyfense
  5. run pyfense: ./bin/pyfense
  6. to modify pyfense edit the responding file in ./pyfense/
  7. have fun :)

Using virtualenv

  1. clone this repo
  2. initiate virtualenv in the project dir: virtualenv .
  3. install pyfense in the virtualenv environment: ./bin/python setup.py develop
  4. set execute permission for the executeable: chmod +x ./bin/pyfense
  5. run pyfense: ./bin/pyfense
  6. to modify pyfense edit the responding file in ./pyfense/
  7. have fun :)

Unit Tests

to be added later

Program Structure

pyFense is written in an Object oriented structure. What each file contains:

  • pyfense.py: entry point into the game, contains the game menus. for some menus a "modmenu" class is used, which is defined in
  • enemy.py: subclasses cocos2d sprite to create a class to represent a single enemy.
  • entities.py:
  • game.py:
  • highscore.py:
  • hud.py: provides the ingame HUD (announcements, tower build/upgrade menu, coursor selections etc)
  • map.py:
  • mapBuilder.py:
  • mapbuilderhud.py:
  • modmenu.py: subclasses cocos2d menuitem to display a non-scaled image as a menuitem.
  • particles.py:
  • pause.py: a cocos2d scene and layer to provide the ingame pause menu.
  • projectile.py: subclasses cocos2d sprite to create a class to represent a single projectile, fired by towers at enemies.
  • projectileParticle.py: subclasses the pyglet particle system to provide particles for projectiles.
  • resources.py: all assets used by pyFense are loaded into memory in resources.py.
  • tower.py: subclasses cocos2d sprite to create a class to represent a single tower.

Possible Improvements

Please look at the GitHub issues and the following list:

  • major balancing improvements
  • more exciting levels
  • online highscores
  • multiplayer (lan/internet) -> requires significant client/server rewrite

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

PyFense-0.9.5.tar.gz (4.5 MB view details)

Uploaded Source

Built Distribution

PyFense-0.9.5-py3-none-any.whl (4.6 MB view details)

Uploaded Python 3

File details

Details for the file PyFense-0.9.5.tar.gz.

File metadata

  • Download URL: PyFense-0.9.5.tar.gz
  • Upload date:
  • Size: 4.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.4

File hashes

Hashes for PyFense-0.9.5.tar.gz
Algorithm Hash digest
SHA256 d7cb6192a0d53a25257bfa5172970ba0f39faa5549ce9fb20e5b115529b69b8a
MD5 eb1750cb9ee34b874162d03532ef80e4
BLAKE2b-256 8047e47c024e9d5e523433870b00c964a8befd39ef61f983f976e1c1b486f266

See more details on using hashes here.

File details

Details for the file PyFense-0.9.5-py3-none-any.whl.

File metadata

  • Download URL: PyFense-0.9.5-py3-none-any.whl
  • Upload date:
  • Size: 4.6 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.4

File hashes

Hashes for PyFense-0.9.5-py3-none-any.whl
Algorithm Hash digest
SHA256 6c72b4df5caa7e900ca18a7744c5579fccb8172727bbc593ea4035b461f9b851
MD5 ffa5678258ec488c34b4d2d1736fe269
BLAKE2b-256 41fd439da92208aa09252e645eaa85f41747c1e92c858027febde178a1f7608e

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