Skip to main content

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:

  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

Metadata

Release files for PyFense 0.9.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for PyFense 0.9.5
File Size Uploaded
PyFense-0.9.5.tar.gz 4.5 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for PyFense 0.9.5
File Interpreter ABI Platform
PyFense-0.9.5-py3-none-any.whl Python 3 none any Details

Total release size: 9.1 MB

Release files / PyFense-0.9.5.tar.gz

Download URL PyFense-0.9.5.tar.gz
Size 4.5 MB
Tags Source
SHA-256 checksum
How to use checksums
d7cb6192a0d53a25257bfa5172970ba0f39faa5549ce9fb20e5b115529b69b8a
BLAKE2b-256 checksum
How to use checksums
8047e47c024e9d5e523433870b00c964a8befd39ef61f983f976e1c1b486f266
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / PyFense-0.9.5-py3-none-any.whl

Download URL PyFense-0.9.5-py3-none-any.whl
Size 4.6 MB
Tags Python 3
SHA-256 checksum
How to use checksums
6c72b4df5caa7e900ca18a7744c5579fccb8172727bbc593ea4035b461f9b851
BLAKE2b-256 checksum
How to use checksums
41fd439da92208aa09252e645eaa85f41747c1e92c858027febde178a1f7608e
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

0.9.5 This release

2 release files

0.9.4

1 release file

0.9.3

1 release file

0.9.2

1 release file

0.9.1

1 release file

0.9

1 release file

0.8.22

1 release file

0.8.20

1 release file

0.8.7

1 release file

0.8.6

1 release file

0.8.5

1 release file

0.8.4

1 release file

0.8.3

1 release file

0.8.2

1 release file

0.8.1

1 release file

0.8

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page