seacrest / t3tr0s

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Click to Play!

We are re-creating Tetris™ in ClojureScript. We are mainly doing this to produce the pleasure and to celebrate the 30th anniversary of its original release in 1984. Our remake will enable us to host a small, local tournament and to share a montage of the game's history, with each level resembling a different version from its past. (We are working on the game at least once a week):

  • DevBlog 1 - data, collision, rotation, drawing
  • DevBlog 2 - basic piece control
  • DevBlog 3 - gravity, stack, collapse, hard-drop
  • DevBlog 4 - ghost piece, flash before collapse
  • DevBlog 5 - game over animation, score
  • DevBlog 6 - level speeds, fluid drop, improve collapse animation, etc.
  • DevBlog 7 - draw next piece, tilemap for themes
  • DevBlog 8 - allow connected tiles for richer graphics
  • DevBlog 9 - live board broadcasting
  • DevBlog 10 - chat room, more tilemaps, page layouts
  • DevBlog 11 - page routing, username

Setup

  1. Install Leiningen and Node.js.

  2. Run the following in the project directory

    # install node.js dependencies
    npm install
    
    # compile LESS file
    grunt
    
    # compile ClojureScript files (this may take a minute)
    lein cljsbuild once
    
    # copy the example config file (edit as needed)
    cp example.config.json config.json
    
    # start the node.js server
    node server.js
  3. Open http://localhost:1984 in your browser.

Browser REPL

If you want a REPL connected to the browser for interactive testing:

lein repl
> (brepl)

Recording GIFs

If you want to record a GIF of gameplay:

  1. Create empty "gif" directory at the project root.

  2. Play the game in the browser (with the developer console open).

  3. Press "shift" to start/stop recording. (watch the console)

  4. To write the recording to a file, type this in the browser REPL:

    (ns client.vcr)
    (publish-record!)
  5. In the "gif" folder, you should see "anim.gif" and intermediate PNG frames.

References

License

All code licensed under the terms of the MIT License.

The image files of past versions of the games (ie: the tilemap files) belong to their respective copyright holders.

Tetris is a registered trademark of The Tetris Company.

About

License:MIT License