Skip to content

The T-Rex 🦖 runner game extracted from chromium

Notifications You must be signed in to change notification settings

litetex/t-rex-runner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Online version Latest stable docker version

t-rex-runner 🦖

This is an updated version of the t-rex-runner game, originally extracted by wayou/t-rex-runner

source from chromium

You can find a online version at https://litetex.github.io/t-rex-runner/

demo dino

How to run it

Unfortunately it's only possible to run the code on a webserver.
You can find the exact reason here

A simple predefined image exists at DockerHub

However here is a quick setup if you wan't to build it yourself using docker

  • Get Docker
  • Build it with
docker build -t my-trex-runner-demo .
  • Start it with
docker run --rm -it --name trex-runner-demo -p 8080:80 my-trex-runner-demo
docker rm -f trex-runner-demo

All in one:

docker build -t my-trex-runner-demo . && docker run --rm -it --name trex-runner-demo -p 8080:80 my-trex-runner-demo

How to extract the required code

  • Clone the chromium repo
    • Chromium is a really large repo (as of now it has nearly 1 million Commits and the default branch with only the latest commits alone consumes 4GB of disk memory) so you should clone it only optimized:
    git clone --depth 1 --branch master https://chromium.googlesource.com/chromium/src
    
  • Check the dependencies of the neterror component html page
  • Currently the components components/neterror and components/security_interstitials are required, so let's extract them
  • Extract those dependencies (copy the directories) into a new directory

Migration

  • Clean not required stuff from the html file, e.g. i18n or not used parts of the div
  • The sounds have to be served encoded in Base64, so encode them and add them directly
  • Remove the complicated neterror.js and replace it at the end of the body with a simple <script>new Runner('.interstitial-wrapper');</script>
  • Clean up offline.js by removing external dependencies or merging them into the file
    e.g. loadTimeData is only used to determine if the game should be disabled, which we totally don't need
  • The JS-Constant <script>const HIDDEN_CLASS = 'hidden';</script> is required
  • Simplify the stylesheets into a single one and clean up not required stuff
  • Remove unnecessary images