diff --git a/.env-example b/.env-example index d1a3bcc..ed9cc1a 100644 --- a/.env-example +++ b/.env-example @@ -1,13 +1,9 @@ -API_KEY=xxxxxxx -PORT=3000 -API_URL=http://localhost:3000 -INSTANCE_DOMAIN=api.topia.io -INSTANCE_PROTOCOL=https -INTERACTIVE_KEY=xxxxxxx -INTERACTIVE_SECRET=xxxxxxx NODE_ENV="development" - -# Google Sheets -GOOGLESHEETS_CLIENT_EMAIL= -GOOGLESHEETS_SHEET_ID= -GOOGLESHEETS_PRIVATE_KEY= +INSTANCE_DOMAIN=api.topia.io +INTERACTIVE_KEY=your_interactive_key +INTERACTIVE_SECRET=your_interactive_secret +REDIS_URL=redis://localhost:6379 +GOOGLESHEETS_CLIENT_EMAIL=your_google_service_account_email +GOOGLESHEETS_SHEET_ID=your_google_sheet_id +GOOGLESHEETS_PRIVATE_KEY=your_google_private_key +TRACKS=[{"id":1,"name":"Track 1","thumbnail":"https://example.com/thumb.png","sceneId":"your_scene_id"}] diff --git a/README.md b/README.md index be9a7ed..25518dc 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,20 @@ Race App is an exciting racing game built with Node.js and React. Players compete to complete a virtual race course in the fastest time possible by navigating through a series of waypoints. The app features a leaderboard that displays the top 20 fastest race times, allowing players to compare their performance with others. +## Built With + +### Client + +![React](https://img.shields.io/badge/react-%2320232a.svg?style=for-the-badge&logo=react&logoColor=%2361DAFB) +![Vite](https://img.shields.io/badge/vite-%23646CFF.svg?style=for-the-badge&logo=vite&logoColor=white) +![TypeScript](https://img.shields.io/badge/typescript-%23007ACC.svg?style=for-the-badge&logo=typescript&logoColor=white) +![Tailwind CSS](https://img.shields.io/badge/tailwindcss-%2338B2AC.svg?style=for-the-badge&logo=tailwind-css&logoColor=white) + +### Server + +![Node.js](https://img.shields.io/badge/node.js-%2343853D.svg?style=for-the-badge&logo=node.js&logoColor=white) +![Express](https://img.shields.io/badge/express-%23000000.svg?style=for-the-badge&logo=express&logoColor=white) + ## Features - Interactive race course with a visual racetrack loop and multiple waypoints @@ -53,3 +67,53 @@ To reset the race stats to a default unplayed state: Click the "Admin" button in the drawer. On the admin page, click the "Reset Race Stats" button to remove all previously attained race times. + +## Implementation Requirements + +### Required Assets with Unique Names + +The following assets must exist in the world with specific unique names: + +| Unique Name | Description | +| ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `race-track-container` | A rectangle asset that surrounds the entire race track area. Used to determine placement position when switching tracks. | +| `race-track-checkpoint` | Checkpoint assets placed along the track. Multiple checkpoints should use partial matching (e.g., `race-track-checkpoint-1`, `race-track-checkpoint-2`). | +| `race-track-start` | The starting line asset where players begin the race. | + +### Environment Variables + +Create a `.env` file in the root directory. See `.env-example` for a template. + +| Variable | Description | Required | +| --------------------------- | ------------------------------------------------------------------------------------------------------------ | -------- | +| `NODE_ENV` | Node environment (`development` or `production`) | No | +| `INSTANCE_DOMAIN` | Topia API domain (`api.topia.io` for production, `api-stage.topia.io` for staging) | Yes | +| `INTERACTIVE_KEY` | Topia interactive app key | Yes | +| `INTERACTIVE_SECRET` | Topia interactive app secret | Yes | +| `REDIS_URL` | Redis connection URL for caching race state (e.g., `redis://localhost:6379`) | Yes | +| `TRACKS` | JSON array of track configurations. Each track requires `id`, `name`, `thumbnail`, and `sceneId`. See below. | Yes | +| `GOOGLESHEETS_CLIENT_EMAIL` | Google service account email for analytics | No | +| `GOOGLESHEETS_SHEET_ID` | Google Sheet ID for analytics | No | +| `GOOGLESHEETS_PRIVATE_KEY` | Google service account private key | No | + +### Track Configuration + +Tracks are configured via the `TRACKS` environment variable as a JSON array. Each track requires: + +- `id`: Unique track identifier +- `name`: Display name for the track +- `thumbnail`: URL to track preview image +- `sceneId`: The Topia scene ID containing the track assets + +Example: + +```json +[ + { + "id": 1, + "name": "Beach", + "thumbnail": "https://example.com/thumbnails/beach.png", + "sceneId": "your_scene_id" + } +] +```