AI summary by TwinMind

MarioKart.js Blew My Mind (Open Source + React + ThreeJS)

Theo - t3․gg

11m 36s

Project Introduction

  • Mario Kart clone recreated entirely in browser using React framework
  • Created by Alex Lun poo (pronunciation uncertain)
  • Project went viral on Twitter, now open source
  • Built using React 3 Fiber (React wrapper for Three.js/WebGL)
  • Includes bugs from original game

Open Source Release and Legal Concerns

  • Alex initially concerned about Nintendo DMCA takedown
  • Discussed with Robin (Wind Waker project creator) before open sourcing
  • Decision made that code value outweighs legal risks
  • Hope additional exposure won't increase DMCA likelihood

Modular Components Released

  • useGamepad hook: React hook for Bluetooth game controller access
    • Makes browser controller integration easy (previously difficult)
  • cart-controller.js: Manages cart physics
  • Components designed to exist independently if main repo gets DMCA'd

Technical Architecture Overview

  • Uses React 3 Fiber (wrapper for Three.js)
  • Three.js = easiest way for 3D rendering in WebGL/canvas
  • React components create 3D objects
  • Enables complex game development in browser

Code Structure and Hot Reloading

  • Uses npm package manager
  • Multiple control options: keyboard, mobile phone as controller
  • Hot reloading demonstration:
    • Fixed keyboard typo in real-time
    • Update time: <0.5 seconds, closer to 0.1 seconds
    • Maintains game state during changes
    • Superior to traditional game engines requiring full reload

Landing Page Architecture

  • HTML elements rendered in browser
  • Control style selection interface
  • Canvas component from React 3 Fiber handles 3D rendering
  • Physics package integration
  • Keyboard controls via Drei

Game State Management

  • Multiplayer: Uses playroom-kit library
  • Network bananas: Tracks bananas set by other players
  • Network shells: Manages shell states across network
  • Curve path: Level path data from curve-path.json
  • Scaling system: Points scaled based on loaded data
  • useEffect: Handles Paris scale adjustments when points change

Camera System

  • Camera as empty ref and moveable component
  • Revolutionary concept for web developers
  • Two places to change user view:
    • Browser window
    • 3D camera position in space

Performance Optimizations

  • useFrame hook: Runs outside React render loop
  • Updates refs per frame without blocking React
  • Animation logic separated from React thread
  • React defines element placement, not frame rendering

Component Reusability Demo

  • Item box component demonstration
  • Added 4 boxes with different positions using map
  • Shows React patterns work in 3D:
    • Reusable components
    • Props passing
    • Trivial duplication

State Management

  • Zustand: Core game state management
  • Originally written for React 3 Fiber by same creators (Poimandres)
  • Designed for 3D environment performance requirements
  • Accessible via useStore throughout app

Development Experience Benefits

  • Easy code readability for non-game developers
  • JavaScript object mapping to render 3D assets
  • Familiar React syntax and behaviors
  • Standard JavaScript libraries work as expected
  • GPU/canvas rendering limitations noted

TwinMind

Get summaries like this for your own meetings

TwinMind takes notes in the background during meetings, lectures, and calls, then writes the summary for you.

Free plan to get started

No bot joins your calls

Phone, desktop & Chrome apps

Your next meeting, summarized like this

TwinMind listens in the background and turns meetings, lectures, and calls into searchable notes you can chat with. Start free.

Available on phone, desktop & Chrome

Your next meeting, summarized like this

TwinMind listens in the background and turns meetings, lectures, and calls into searchable notes you can chat with. Start free.

Available on phone, desktop & Chrome

Your next meeting, summarized like this

TwinMind listens in the background and turns meetings, lectures, and calls into searchable notes you can chat with. Start free.

Available on phone, desktop & Chrome