Skip to content

## IN PROGRESS ## Animated desktop 3D car racing game using React, Three.js, React Three Fiber, React Three Drei, React Three Cannon

Notifications You must be signed in to change notification settings

sctlcd/react-threejs-car-racing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

79 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


react-threejs-car-racing



Table of Contents

  1. Introduction

  2. Run the project locally

  3. Available Scripts

  4. Deployment

  5. Credits


Introduction

Creating a desktop Car racing game React, Three.js, React Three Fiber, React Three Drei, React Three Cannon.

3D model of the peugeot 205 gti | copyright Jérôme SECLIER

👀 Have a look and zoom in at the peugeot 205 gti and its interior! 💥


205-gti-interior


👀 Zoom in on the trunk and you'll find the spare wheel! 🔥


205-gti-spare-wheel


This project was bootstrapped with Create React App.

Controls

Action Controls
Movements W/S/D/A

Back to top


Run the project locally

  • Runs the app in the development mode.
    Open http://localhost:3000 to view it in the browser.
    cd react-threejs-car-racing
    npm i
    npm start
    

Back to top


Available Scripts

In the project directory, you can run:

npm start

Runs the app in the development mode.
Open http://localhost:3000 to view it in your browser.

The page will reload when you make changes.
You may also see any lint errors in the console.

npm run build

Builds the app for production to the build folder.
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.
Your app is ready to be deployed!

See the section about deployment for more information.

npm run eject

Note: this is a one-way operation. Once you eject, you can't go back!

If you aren't satisfied with the build tool and configuration choices, you can eject at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except eject will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.

You don't have to ever use eject. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.

Back to top


Deployment

Deployment – Run locally

  1. Prerequisite:

    • Make sure Node and NPM are installed on your computer. You can download both at nodejs.org (NPM is included in your Node installation).
    • Please see .nvmrc file at the root of react-threejs-car-racing repo.
    • Using nvm, a Node Version Manager is recommended as it helps you manage and switch between different Node versions with ease. It provides a command-line interface where you can install different versions with a single command, set a default, switch between them, etc. Here is NVM for Windows
  2. In GitHub click on the repository nammed react-threejs-car-racing

  3. Clone the repository locally. Run

    git clone https://github.com/sctlcd/react-threejs-car-racing.git
    
  4. Install all modules listed as dependencies in package.json

    cd react-threejs-car-racing
    npm i
    

    note: in this app

  5. Runs the app in the development mode. Open http://localhost:3000 to view it in the browser.

    cd react-threejs-car-racing
    npm start
    

Back to top


Deployment - Live Website

Firebase

react-threejs-car-racing live website is currently deployed on Firebase using the main branch on GitHub. Once you have the project setup locally, you can proceed to deploy it remotely.

  1. Install Firebase CLI Tools, firebase-tools

    npm install -g firebase-tools
    
  2. Create firebase.json and .firebaserc at the root of your project with the following content:

    firebase.json:

    {
      "hosting": {
        "public": "build",
        "ignore": [],
        "rewrites": [
          {
            "source": "**",
            "destination": "/index.html"
          }
        ]
      }
    }
    

    .firebaserc:

    {
      "projects": {
        "default": "<YOUR_FIREBASE_ID>"
      }
    }
    
  3. After running npm run build, deploy using the command firebase deploy.

=> live link: https://react-threejs-car-racing.web.app/ (example link - not in use)

Back to top

Vercel

react-threejs-car-racing live website is currently deployed on Vercel using the main branch on GitHub. Once you have the project setup locally, you can proceed to deploy it remotely.

  1. Create a Vercel account and/or log in to your Vercel account

  2. Install Vercel package in the project:

    npm i vercel
    
  3. Add a deploy script in the package.json file

    {
      "scripts": {
        // ...
        "deploy": "vercel --prod"
      },
    }
    
  4. To login run:

    npx vercel login
    
  5. In the terminal run:

    npm run deploy
    
  6. Follow the instructions

    $ npm run deploy
    
    > react-threejs-car-racing@0.1.0 deploy
    > vercel --prod
    
    Vercel CLI 34.2.0
    ? Set up and deploy “D:\github\react-threejs\react-threejs-car-racing”? yes
    ? Which scope do you want to deploy to? sctlcd's projects
    ? Link to existing project? no
    ? What’s your project’s name? react-threejs-car-racing
    ? In which directory is your code located? ./
    Local settings detected in vercel.json:
    Auto-detected Project Settings (Create React App):
    - Build Command: react-scripts build
    - Development Command: react-scripts start
    - Install Command: `yarn install`, `pnpm install`, `npm install`, or `bun install`
    - Output Directory: build
    ? Want to modify these settings? no
    🔗  Linked to sctlcds-projects/react-threejs-car-racing (created .vercel and added it to .gitignore)
    🔍  Inspect: https://vercel.com/sctlcds-projects/react-threejs-car-racing/5ftNRUrzpM6NqrxTt1snhqnGLSFo
    ✅  Production: https://react-threejs-car-racing-ldxp3c4yq-sctlcds-projects.vercel.app
    

    => live link: https://react-threejs-car-racing.vercel.app/

Back to top


Credits

Media

Back to top


About

## IN PROGRESS ## Animated desktop 3D car racing game using React, Three.js, React Three Fiber, React Three Drei, React Three Cannon

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published