David
[ Biography ] [ Flash ] [ C/C++ ] [ Python ] [ C# ] [ Artwork ] [ Resume ] [ Contact ]

 

"You wanna' ride the slide? You gotta' pay a tax..."

Fun Tax

screenshot

I wrote this game as an independent summer project this past year during 2009. Written in Python using the PyGame SDL wrapper, it culminates to about 1500 lines of code and covers a broad range of integrant game programming features. Taking a little over two months to program, it is my biggest project yet and by far the most polished and complete.

All sounds and music in the game were recorded (or played on clarinet and piano) by myself and edited and compressed using open-source Audacity; with the exception of the recurring ambient song "The Storm Within."


List of Programmed Features:

  • Sprite Rendering
  • Geometric Rendering
  • Color Theory
  • Sound Loading / Play-back
  • Randomization
  • Event-Based Systems
  • 'Game Loop' Structure
  • Basic Particle Systems
  • Hardware Consideration (Regulating Framerate)
  • Parallax Side-Scrolling Background (credits)
  • Physics System Integration
  • Collision Detection
  • Realtime FPS Display
  • Very Basic Shading (dodgeballs)


Seeing so many typical clones of games like Pong, Tetris, Breakout and Asteroids; I really wanted to break out of the box and form something wholly unique and independent. I wanted to create something very simple, yet complex enough to keep someone's attention. The game focus, however, on FunTax was not the overall theme or plot, but rather the gameplay. Multi-tasking between two characters and avoiding flying objects, seemed to me, at least a partially-addictive game formatting. After creating a framed and rendered system, I realized two blobs dodging many other blobs seemed monotonous; so I threw on this nonsensical, humorous overlay of a "Fun Tax." Though funny and peculiar, my focus was on the object-oriented programming style and actual game formatting.

Using the PyGame libraries and a small set of functions that helped clean up the cluttered SDL methodologies; I placed heavy emphasis on object-oriented design. Setting up Coin, Character, Powerup, and Dodgeball classes made setting up the game rounds and initializations a breeze. With simple object declarations, and appending all items to an array; all I had to do was iterate through, calculate collision, movement, and then actually draw the objects on the screen. Tweaking after the first beta was complete, I added menus, particle systems, sounds, and sprites to give the game finishing touches.

Using the py2exe client, and writing a script to create the executable, I test-ran my game on several friends computers. Unfortunately, I realized not all computers are equipped with dual-core processors and Nvidia 9800 GTX cards. So I went back, drastically reduced the image quality on my sprites for faster rendering, and also implemented a Python JIT (Just-In-Time) compiler, Psycho; which in itself reduced increased my framerate by about 10 across the board.

The most peculiar thing, which honestly never even occurred to me; my gameplay speed is dependent on my framerate and hardware capabilities. The more processing power you have, the quicker your game will play, drastically changing the feel of the whole experience. To fix this, I used the internal PyGame clock, and for every iteration, tested my FPS. If it was too high, I simply set the iteration to sleep for a couple milliseconds; thereby regulating game speed, and keeping a consistent pace.

At that, there is no way to possibly increase your FPS beyond hardware capabilities. One of the many pitfalls with Python, as well with any other high-level language, is its runtime inefficiencies. My game is no exception, so if your partition seems to run a bit sluggish, my apologies. Also, if you are running on a Mac, apologies again. Even if I were to make an OS X application, I've got no platform to test it on. Perhaps you could use Wine.


Code Snippet -- Main Menu Vomit Sequence
Code Sample

Download Fun Tax Here:

FunTax.rar -- 8.86 Mb
FunTax.zip -- 9.07 Mb


Copyright © 2009 David Straily