RedLine Motorsport Simulator is a Node.js + React racing simulation platform supporting F1, MotoGP, and drones. It features animated track browsing, real-time leaderboards, configurable race parameters, SVG/3D-ready rendering, and optional WebSocket telemetry for live event simulation.
RedLine/RedLine/RedLine/— app root (created from the original archive; leave nesting intact).- Key folders inside the app:
src/components,src/pages,src/data,src/utils,src/three,public/.
- Multi-discipline coverage: Formula 1, MotoGP, and a drone-racing experience.
- Infinite carousels to browse circuits with stats, regulations, and quick “Begin simulation” CTAs.
- Simulation page with live parameters (session type, time of day, weather, tyres, fuel, grip, temps, strategy, AI difficulty, safety car probability, run length) plus timers and lap estimation.
- SVG track renderer with a moving marker; uses procedural track centerlines when available.
- Live leaderboard with row expansion, change highlighting, optional WebSocket hookup, and local mock data.
- Mock telemetry options: React hook (
useWebsocketMock) and a Node-based WebSocket server (ws-mock.js). - Three.js-ready placeholders:
CanvasPlaceholderexposes a mount point;three/Car3Dandthree/TrackExtruderscaffold future 3D work; drone page uses the animatedHyperspeedbackground. - Accessibility-minded (keyboardable controls, ARIA labels, live regions) and responsive styling built with CSS plus utility-friendly Tailwind config.
- Runtime: Node.js (tested with 18+)
- Frontend: React 19, React Router 7, Framer Motion, Three.js, Vite
- Tooling: ESLint, Jest + React Testing Library, Tailwind/PostCSS
cd RedLine/RedLine/RedLine # project root
npm install # install dependencies
npm run dev # start Vite dev server (defaults to 5173)Open the printed localhost URL in your browser.
npm run dev— run the Vite dev servernpm run build— production build todist/npm run preview— serve the production build locallynpm run lint— ESLint over the projectnpm test/npm run test:watch/npm run test:coverage— Jest + RTL suites
- Routing (
src/App.jsx): landing page →home,formula1,motogp,drones,tracks,simulate/:trackId,create. - Track selection (
pages/Formula1.jsx,pages/MotoGP.jsx): looping carousels, regulation toggles persisted tolocalStorage, and begin buttons that push into the simulation route with the chosen track payload. - Track browser (
pages/Tracks.jsx): searchable, series-filtered grid of all F1/MotoGP circuits, using reusableTrackCardcomponents. - Simulation (
pages/Simulation.jsx):- Renders SVG centerlines via
CanvasPlaceholder. - Parameter sidebar (mirrors
ParamsSidebarAPI) manages session, weather, grip, temps, tyres, fuel, traffic, AI difficulty, safety car odds, and run duration. - Animation loop advances car progress with lap detection; timer handles finite runs; state persists selected regulation.
- Leaderboard card supports live shuffling and driver detail expansion.
- Renders SVG centerlines via
- Drone Racing (
pages/Drones.jsx): lazy-loadsHyperspeedThree.js effect with an overlayed hero.
- Built-in mock hook:
useWebsocketMocksends periodic leaderboard reshuffles for local development. - Node WebSocket server: run
npm install ws(dev or prod), thennode ws-mock.jsto broadcast sample F1 leaderboards onws://localhost:8080. - Connecting real data: pass
websocketUrl(andautoConnect) toLeaderboardor wire your own WebSocket inSimulation.jsx; messages should deliver an array or{ leaderboard: [...] }snapshot.
- Circuit metadata lives in
src/data/tracks.js,src/data/motogpTracks.js, andsrc/data/droneTracks.js. - Procedural centerlines for Monza, Silverstone, and Spa come from
src/data/trackPointMaps.js; normalize and sampling utilities are insrc/utils/trackUtils.js. - Static assets (SVG layouts, video backgrounds, images) live in
src/assetsandpublic/.
- Component tests cover key UI pieces (
CanvasPlaceholder,ParamsSidebar,Leaderboard,TrackCard,Loading) undersrc/components/__tests__/. - Tests run in a JSDOM environment via Jest; CSS modules are mocked with
identity-obj-proxy, and asset imports use__mocks__/fileMock.js.
- Mount a real Three.js renderer inside
CanvasPlaceholdervia its ref, or replace the SVG preview entirely. - Swap the mock telemetry for a real feed by plugging into
useEffectinSimulation.jsxor by enrichinguseWebsocketMock. - Add more tracks by extending the data files and (optionally) adding centerline generators to
trackPointMaps.
- Controls include labels, ARIA attributes, and keyboard-friendly interactions; live regions announce time/leaderboard changes.
- Layout and typography favor dark UI with orange/red highlights; responsive CSS lives in
src/css/andApp.css.
- Build:
npm run build→dist/. - Host the static output on any CDN/SPA host (Vercel, Netlify, S3, etc.). Configure preview locally with
npm run preview.
- Keep the nested folder structure if you move the project; relative imports assume the current layout.
- If you need environment-specific settings, create
.envwithVITE_*variables as required (e.g.,VITE_WEBSOCKET_URL).