Tetris - Python

Programmer

Back to Home
3D Tetris

Download Here

Note: You must have python and the correct libraries installed.

Project Overview

Final project for college Intro to Programming class. Programmed a version of Tetris using the Super Rotation System consistent with the Tetris Guideline. Improved visual appeal by making the blocks three dimensional.

Challenge

A 2D game engine was provided and required to be used, so any three dimensional graphics objects had to be created using this engine. Due to the slow speed of python, and the architecture of the engine, the number of polygons that can be drawn per second is very limited. When changing the rotation of the 3D viewport, the shapes of polygons changes, and as such they must be redrawn.

Design

In order to use as few polygons as possible, the backsides of the tetris blocks do not exist. The view is limited to only the front of the board, both for gameplay purposes and so the player cannot see the missing backs. A per-pixel z buffer would be too slow, so a z-buffer was made that utilized the centroid of the polygons instead. This works well enough to ensure the nearer polygons are drawn last, so they appear correctly. Slight color changes simulate light and shadow, and a ghost block was added to improve playability by lightening the colors of the block currently being controlled and placing it as far down as it will go.