Skip to content
/ trex Public

An exciting spin on the classic Chrome T-Rex runner. Instead of pressing spacebar, you literally jump while holding your phone, and watch T-Rex leap on the big screen!

License

Notifications You must be signed in to change notification settings

rohittp0/trex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

T-Rex

T-Rex Game Cover

Welcome to T-Rex — an exciting spin on the classic Chrome T-Rex runner. Instead of pressing spacebar, you literally jump while holding your phone, and watch T-Rex leap on the big screen!

Try out the game at trex.rohittp.com

Table of Contents

  1. Overview
  2. How It Works
  3. Running Locally
  4. Project Structure
  5. Contributing
  6. License

Overview

Originally inspired by the famous Chrome offline T-Rex game, we’ve given it a modern twist: real-world motion input via your phone.

  • No more button mashing.
  • No more arrow key spam.
  • It’s time to jump and let your phone handle the rest!

How It Works

  1. Server: A Node.js/Express app with WebSockets keeps track of multiple game sessions.
  2. Desktop Browser: Displays the T-Rex game (HTML5 Canvas) and listens for jump signals from the server.
  3. Phone / Controller: Opens a special controller page, uses device motion APIs to detect your jumps, and sends jump commands via WebSocket to the server.

Running Locally

1. Clone the Repo

git clone https://github.com/rohittp0/trex
cd trex

2. Install Dependencies

bun install

3. Generate Self signed certificate

openssl genpkey -algorithm RSA -out private.key
openssl req -new -key private.key -out certificate.csr
openssl x509 -req -days 365 -in certificate.csr -signkey private.key -out certificate.crt

4. Move the certificate to the certificate folder

mkdir certificate
mv private.key certificate.crt certificate/
rm certificate.csr

5. Run the Server

bun run dev

6. Open in Browser

7. Phone as Controller

  • On your phone, navigate to https://:3000
  • Enter the Game ID.
  • Start jumping!

Project Structure

A quick look at the main directories and files:

.
├── public
│   ├── css
│   │   ├── index.css
│   │   ├── controller.css
│   │   └── game.css
│   ├── images
│   │   └── cover.jpg        # Our epic cover image
│   ├── js
│   │   ├── index.js
│   │   ├── controller.js
│   │   ├── motion.js
│   │   └── runner
│   │       ├── Runner.js
│   │       ├── Trex.js
│   │       ├── ...
│   │       └── collisionHelpers.js
│   ├── game.html            # Game page
│   ├── controller.html      # Phone interface
│   └── index.html           # Desktop landing page
├── index.ts                 # The Express/WS server
├── tsconfig.json                 
└── package.json
  • public/: Frontend code, including HTML, CSS, images, and client JS.
  • runner/: Modular classes for the T-Rex game (Trex, Horizon, Obstacles, etc.).
  • index.ts: The Node/Express + WebSocket server.

Contributing

We’d love your help to make the T-Rex game even better! Feel free to:

  1. Fork the repo
  2. Create a branch for your feature or fix (git checkout -b feature/my-awesome-idea)
  3. Commit your changes (git commit -m 'Add my awesome idea')
  4. Push to your branch (git push origin feature/my-awesome-idea)
  5. Open a Pull Request and we’ll review ASAP.

License

This project is licensed under the MIT License — you’re free to use, modify, and distribute it. See the LICENSE file for details.


Thank You for Playing!

Thanks for checking out T-Rex Motion Game. We hope you have a blast jumping around and making the little dino dodge cacti. If you have questions or run into any issues, please open an issue.

Let’s jump to it — literally!

About

An exciting spin on the classic Chrome T-Rex runner. Instead of pressing spacebar, you literally jump while holding your phone, and watch T-Rex leap on the big screen!

Topics

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •