All Projects → GoogleChromeLabs → Performance Game

GoogleChromeLabs / Performance Game

Licence: apache-2.0

Programming Languages

javascript
184084 projects - #8 most used programming language

The Performance Game

There are many excellent tools, metrics and docs regarding page speed, but these often only appeal to a specific audience - basically people already in the mindset anyway. And even for those the material can be sometimes confusing, boring or just too much. This project aims at visualizing key metrics and problems with the loading of a page in a fun and engaging way - as a game. Idea is to educate people about site load speed through gamification, and also encourage sharing of the game (and therefore page speed ideas and resources) through game leaderboards.

An early beta is live and can be tried here:

g.co/perfgame:

Game Overview

This project uses bases on a well-known traditional game, and uses obstacles to represent loading of resources. Player controls a spaceship and has to destroy incoming asteroids, representing loaded resources of the page. Key aspects of the game:

  • At game start player selects a URL of a website to play
  • Player selects difficulty (2G, 3G, 4G, Wifi - changes fire rate, each fired shot is 20kb download)
  • If an asteroid is hit enough times, the asteroid is destroyed (resource is downloaded)
  • Well implemented best practices will give you boosters
    • Service-Worker - extra life?
    • If page is on https player gets a shield?
    • Http2?
    • font-display css
    • resource hints (link rel preconnect etc.)
  • Every meteorite represents one loaded resource of the page (labeled for player)
  • Meteorites come in in the sequence of the loading order
  • Size of meteorite represents size of resource
  • Color of meteorite represents optimization potential (red part is unused JS/CSS or what could be saved by further compressing for images etc.)
    • If a large part of code is unused at page load, it can't be destryed (will stay as obstacle through the whole game)
  • Several levels mapping to site load key points (first paint, first meaningful paint, TTI, fully loaded)
  • Destroying the last asteroid ends the game, and brings you to the the highscores for the URL you played, which you can then easily share via web-share API

Can I contribute?

Of course you can! Contributions are always welcome. Please take a look at CONTRIBUTING.

Installation/Contributing

  1. Fork the repository (see here)
  2. Clone the repository (see here)
  3. Install dependencies via npm install (be sure to have node and npm installed)
$ npm install 
  1. Build the game
$ npm run build
  1. Run the game
$ npm run start
  1. Do your changes, test, repeat
  2. Lint the code via
$ npm run lint
  1. Push code back to your fork
  $ git add .
  $ git commit -m "update message"
  $ git push
  1. Create PR from this via UI (see here)

  2. Deploy

  • Install and set up Google Cloud SDK as described here
  • Then run the deploy script
    $ npm run deploy
    
  • See also notes here
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].