Dino hack
Tags: chrome, dino, javascript, browser
Published: 2024-04-12 06:00:00


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2hzajbh7esk9p9m5a5gz.jpeg)

The Chrome Dino Run game, also known as the "T-Rex Game," is a simple yet addictive browser game that appears in Google Chrome when you're offline and try to visit a website. It's a nod to the frustration of losing internet connectivity and offers a fun way to pass the time while waiting for the internet connection to be restored.

Here's a brief introduction to the game:

- **Gameplay**: The game features a T-Rex dinosaur character that automatically starts running once you're offline and visit a webpage in Google Chrome. The objective is to keep the T-Rex running as far as possible while avoiding obstacles.

- **Controls**: The controls are straightforward:
  - Press the spacebar or tap/click anywhere on the screen to make the T-Rex jump.
  - Hold down the spacebar to make the T-Rex perform a higher jump, useful for clearing taller obstacles.

- **Obstacles**: The main obstacles in the game are cacti and birds flying at different heights. The player must time their jumps to avoid colliding with these obstacles.

- **Scoring**: The game doesn't have a traditional scoring system. Instead, it tracks the distance traveled by the T-Rex. The farther the T-Rex runs, the higher the score.

- **Difficulty**: The game progressively increases in speed, making it more challenging the longer you survive. This adds an element of difficulty and excitement as you try to beat your own high score.

- **Appearance**: The game features a simple, minimalist design with retro-style graphics reminiscent of old-school arcade games. The background consists of a desert landscape that scrolls horizontally as the T-Rex runs.

### Let's modify the game ..

```js
Runner.prototype.gameOver = function(){}
```

Open up the inspect element and add the above line into the console section and hit enter. If the`Runner.prototype.gameOver` function in the Chrome Dino Run game is empty or overridden with custom code, it opens up the possibility of exploiting the game's mechanics or altering its behavior in various ways. Here's a description of how this could be achieved:

1. **Infinite Gameplay**: By leaving the `gameOver` function empty or modifying it to never end the game, players could effectively achieve infinite gameplay. Normally, when the T-Rex collides with an obstacle, the `gameOver` function is triggered, and the game ends. However, if this function does nothing, the game would continue indefinitely, allowing players to rack up an unlimited distance score.

2. **Immortality**: Another possibility is making the T-Rex invincible by preventing it from being affected by collisions with obstacles. By overriding the `gameOver` function to ignore collisions or reset the T-Rex's position after a collision, players could essentially render the game unwinnable for themselves.

3. **Custom Game Logic**: Developers could implement their own custom game logic within the `gameOver` function. This could involve triggering special events, changing the environment or obstacles dynamically, or even introducing new gameplay mechanics not present in the original game.

4. **Cheating**: Hackers could exploit an empty `gameOver` function to cheat in the game by automatically triggering certain actions or manipulating the game state. For example, they could automate jumping to avoid obstacles perfectly, artificially inflate their score, or modify game variables such as speed or gravity to gain an unfair advantage.

5. **Game Modification**: With access to the `gameOver` function, developers could modify the game's source code directly, introducing new features, fixing bugs, or even creating entirely new game modes within the Chrome Dino Run framework.

With the `gameOver` function in the Chrome Dino Run game can provide opportunities for experimentation and customization, it also raises concerns about fair play and game integrity. Developers need to strike a balance between allowing player creativity and maintaining the core gameplay experience.