Skip to content

Grasshopper & Rhino3D

Grasshopper game: DragRace with Firebase

Published on

In short

A proof of concept in Grasshopper: with the FireHopper plug-in, players exchange live data through a Firebase database. The little game DragRace shows how it works: who reaches the chosen score fastest?

  • Live data exchange between Grasshopper and the web, in JSON
  • Scores stored and shared through Firebase
  • A basis for sharing geometric data in larger projects
  • The script can be downloaded to try it yourself

The concept of live data exchange via the web, in combination with geometric applications such as in Rhino, offers many possibilities.

DragRace is a simple test with the plugin FireHopper. The plugin has not been in development for some time but is still relevant and working with the current API of Firebase, a (to some extent) free database system from Google.

Through the API calls that are possible from grasshopper thanks to the FireHopper plugin, live data can be exchanged in the JSON format.

Grasshopper game: DragRace with Firebase
This part is included in the script that can be downloaded at the bottom of this page. You can of course place your own API in this part of the script in the blank slate version at the bottom.

In the Firebase database the date can then be read out as follows:

Grasshopper game: DragRace with Firebase

The DragRace game

In this video Friso explains a few things about this setup:

A game contains some important elements:

  • A clear goal
  • Different levels of difficulty
  • A competition element

All these parts are built in the script as a way of exercise.

  • It is possible to choose the number of points to be gained and to set your name. (Step 2 in the picture below)
  • The goal is to score the points as quickly as possible by dragging the slider back and forth. Hence DragRace as a name.(Step 3)
  • As soon as the value is obtained it will be stored in the database in firebase.
  • Finally you can see the score of yourself and others in the database. That is competition element. (Step 4)
Grasshopper game: DragRace with Firebase
At the top left you can reset the game by clicking on the X for a new chance.

Proof of concept

Of course, the game is not accessible to the average user, but should be seen as an exercise in exchanging data over the Internet between different players. In a larger project, for example, this can be the exchange of geometric data.

Download and play!

Download the script here to try out how it works for yourself.

Here is a version without api and database data to add your own database.

Connect data to your design?

StudioFG connects Grasshopper to databases, web services and other software.

Image tracer with pattern options

Grasshopper & Rhino3D

Image tracer with pattern options

Grasshopper3D can also be used for graphic design, i.e. parametric graphic design for 2-dimensional applications. This post is about building an image…

A project or training in mind?

Tell us briefly what you want to achieve. You get a reply with a first approach within two working days.