Skip to content

BlockBuster is a feature-packed, complete end-to-end tetris game engine that enables the user to design creative variants 2D tetris.

Notifications You must be signed in to change notification settings

aryan02420/CS_F363-Compiler-Construction

Repository files navigation

CS_F363-Compiler-Construction Project | BlockBusters

Description

BlockBuster is a feature-packed, complete end-to-end tetris game engine that enables the user to design creative variants 2D tetris. It provides a comprehensive set of common tools, so that users can focus on bringing their imagination to life without having to reinvent the wheel.

Games can be exported with simple steps to a number of major desktop platforms (Linux, macOS). The engine is based on a brand new programming language "tetris-lang" (.tl) designed specifically for the coding of tetris games making it a lot more fluid and beginner friendly. "tetris-lang" is a step towards a paradigm shift where no prerequisite programming knowledge is required to get started on tetris game development.

So what are you waiting for, quickly get started on your tetris game development journey and we hope you have an immersive and fun experience using BlockBuster!!

Directory Structure

The final package ready to be deployed is the tetrislang directory and contains all the required implementations of the compiler and also the engine files.

tetrislang/
├── docs
│   ├── engine.html
│   └── index.html
├── .gitignore
├── README.md
├── sample
│   ├── game.py
│   └── tetris.tl
├── setup.py
├── tetrislang
│   ├── assets
│   ├── bin
│   │   └── tetris-lang
│   ├── compiler.py
│   ├── engine.py
│   ├── __init__.py
│   ├── parser.py
│   ├── __pycache__
│   └── scanner.py
└── tetrislang.egg-info

7 directories, 32 files

The above tree shows the overall structure of the tetrislang package.

  1. scanner.py contains the scanner code. It is present in "tetrislang/" inside the package.
  2. grammar.txt contains the BNF grammar that was used to create the parser. Here is a link to the file.
  3. parser.py contains the parser code. It is present in "tetrislang/" inside the package.
  4. compiler.py contains the final code that combines the scanner and parser. It is present in "tetrislang/" inside the package.
  5. engine.py contains the python framework for the Tetris game. It is present in "tetrislang/" inside the package.
  6. tetris.tl is a sample code written in "tetris-lang". It is present in "sample/" inside the package.
  7. game.py is the executable output that is generated after compiling tetris.tl. It is present in "sample/" inside the package.

Note: The Assignment directory served as a playground for the team to try and test out different ideas and features for the project. The final package ready for use is the tetrislang directory.

Installation and Environment Setup

Build Requirements:

  • Python 3.6.9+
  • pip 9.0.1

Runtime Requirements:

  • Pygame 2.1.2
  • sly 0.4

Using host OS environment:

  1. Check to see if your Python installation has pip. Enter the following in your terminal:

     pip3 -h
    

    If you see the help text for pip then you have pip installed, otherwise download and install pip

  2. Clone the repo from GitHub and install the tetrislang package

    Mac OS / Linux

     git clone https://github.com/aryan02420/CS_F363-Compiler-Construction.git
     cd CS_F363-Compiler-Construction/tetrislang/
     pip3 install -e .
    

Using a virtual environment:

  1. Check to see if your Python installation has pip. Enter the following in your terminal:

     pip3 -h
    

    If you see the help text for pip then you have pip installed, otherwise download and install pip

  2. Install the virtualenv package

     pip3 install virtualenv
    
  3. Create the virtual environment

     virtualenv tetrisenv
    
  4. Activate the virtual environment

    Mac OS / Linux

     source tetrisenv/bin/activate
    
  1. Clone the repo from GitHub and install the tetrislang package

    Mac OS / Linux

     git clone https://github.com/aryan02420/CS_F363-Compiler-Construction.git
     cd CS_F363-Compiler-Construction/tetrislang/
     pip3 install -e .
    

    Windows

     git clone https://github.com/aryan02420/CS_F363-Compiler-Construction.git
     cd CS_F363-Compiler-Construction\tetrislang\
     pip3 install -e .
    

How to create a new game

  1. Write the "tetris-lang" game code (.tl file). Refer the documentation section for language syntax and functionalities offered by the engine.

  2. Compiling the code written above will generate an executable output file.

     tetris-lang <path to the .tl file>
    

    The above code will create an executable by the name "game.py" in the current directory.

    You can use the "-o" to set the output file path.

     tetris-lang <path to the .tl file> -o <path of the executable output>
    
  3. To start the game immediately after compilation, use the "-e" flag.

     tetris-lang <path to the .tl file> -e
    

    Or you can also run the generated executable file as follows:

     ./<path of the executable output>
    

Demo:

<insert, screenrecording and examples of running>

Documentation:

All documentation regarding the game programming language can be found here. It primarily consists of two parts:

Free and open source

BlockBuster is completely free and open source under the very permissive MIT license. No strings attached, no royalties, nothing. The users' games are theirs, down to the last line of engine code. BlockBuster's development is fully independent, empowering users to help shape their engine to match their expectations.

Contributing to the project

You might ask yourself now "Yeah, this sounds cool and all, but how do I participate and get famous contribute useful features?".

Fortunately for you, there is a lot to do and we are very grateful for help.

Where do I start?

  • Ask us by reaching out to any of the contributors through the Contact Us section. Someone there could need help with something.
  • You can also take the initiative and fix a bug you found, create an issue for discussion or implement a feature that we never though of, but always wanted.

Ok, I found something. What now?

  • Tell us, if you haven't already. Chances are that we have additional information and directions.
  • Read the docs. They will answer most "administrative" questions like what code style is used and how the engine core parts are connected.
  • Read the code and get familiar with the engine component you want to work with.
  • Do not hesitate to ask us for help if you do not understand something.

How do I contribute my features/changes?

  • You can upload work in progress (WIP) revisions or drafts of your contribution to get feedback or support.
  • Tell us (again) when you want us to review your work.

Contact us

Cheers, BlockBusters

About

BlockBuster is a feature-packed, complete end-to-end tetris game engine that enables the user to design creative variants 2D tetris.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages