📢 Sponsored: Check out Susan's Sudoku - A free daily sudoku puzzle.

Intermediate

Flappy Bird on Rails

A simple Flappy Bird clone that uses Falcon and Live to implement real-time interactivity.

Updated Jul 12, 2024
Price: Free

Description

An absolutely impressive Ruby on Rails port of the popular game Flappy Bird that showcases how you might be able to do some basic interactive game development using Rails.

The game is implemented as a server-side rendered view. The game logic is fully implemented in lib/flappy_view.rb.
The game uses a standard Rails controller, implemented in app/controllers/game_controller.rb. The controller consists of two actions: index and live.

The index action instantiates the game view FlappyView which is then rendered by the view template app/views/game/index.html.xrb. The live action is used to accept a WebSocket connection from the client browser.

When the client connects to the server, it binds the <div class="live" data-class="FlappyView" id="..."> tag to a server side instance. User interactions generate events which are sent to the server, and the server can send HTML to the client to update the view. In addition, for things like sound effects, the server can send JavaScript to the client to execute.

The actual implementation of the game logic consists of a main game loop which updates the game physics at 30 FPS (frames per second), and then renders the update to the client browser. As the client browser may be running at something other than 30 FPS, we use CSS transforms with linear interpolation to smooth out the changes in position.

More "Standalone App" Projects

DailyLog

A Ruby on Rails web application that uses Turbo Native, iOS, and Android app to track my daily habits like exercise, medication, food, and water.

StarryWeather

A modern weather application built with Ruby on Rails and iOS, featuring real-time weather data, beautiful UI animations, and seamless cross-platform integration.

Upright

Synthetic monitoring engine with Playwright and Prometheus metrics

More "Open Source" Projects

Once

Easy self-hosting for Docker-based web apps

RubyUI

A UI component library, crafted precisely for Ruby devs who want to stay organised and build modern apps, fast.

keygen

A fair source software licensing and distribution API built with Ruby on Rails.

More "Free" Projects

shadcn/ui on Rails

Build your component library.

An ActiveStorage S3 Direct Uploader

You want a fast fancy file uploader. Avi explains how he built the Uploader for Musicbase using ActiveStorage and Direct Uploads to S3.

Bullet Train

The Open Source Ruby on Rails SaaS Framework is an MIT-licensed Rails-based framework that saves you months of development by starting you off with all the features that are the same in every product, so you can focus on what makes your app unique.

Stay updated with the latest Rails projects

Join our newsletter to get updates on new Rails projects and resources.

    We won't send you spam. Unsubscribe at any time.