-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Build online tic-tac-toe game for two players #223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
umardarlive
wants to merge
1
commit into
patchy631:main
Choose a base branch
from
umardarlive:claude/online-tic-tac-toe-game-NZjnx
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| # Dependencies | ||
| node_modules/ | ||
|
|
||
| # Build outputs | ||
| dist/ | ||
| build/ | ||
| .vercel/ | ||
|
|
||
| # Environment variables | ||
| .env | ||
| .env.local | ||
| .env.production | ||
|
|
||
| # OS files | ||
| .DS_Store | ||
| Thumbs.db | ||
|
|
||
| # IDE | ||
| .vscode/ | ||
| .idea/ | ||
| *.swp | ||
| *.swo | ||
|
|
||
| # Logs | ||
| *.log | ||
| npm-debug.log* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| # ⚡ Quick Start Guide - Get Your Game Live in 10 Minutes | ||
|
|
||
| ## Step 1: Firebase Setup (5 min) | ||
|
|
||
| 1. **Create project**: [console.firebase.google.com](https://console.firebase.google.com/) → "Add project" | ||
|
|
||
| 2. **Enable Database**: | ||
| - Build → Realtime Database → Create Database | ||
| - Start in **test mode** | ||
| - Enable | ||
|
|
||
| 3. **Set Rules** (in Rules tab): | ||
| ```json | ||
| { | ||
| "rules": { | ||
| "rooms": { | ||
| "$roomId": { | ||
| ".read": true, | ||
| ".write": true | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| 4. **Get Config**: | ||
| - Project Settings (gear icon) → Your apps → Web (`</>`) | ||
| - Copy `firebaseConfig` | ||
|
|
||
| 5. **Update game.js**: | ||
| - Replace lines 7-14 with your config | ||
|
|
||
| ## Step 2: Deploy (3 min) | ||
|
|
||
| ### Option A: Vercel (Recommended) | ||
| ```bash | ||
| npm i -g vercel | ||
| cd online-tic-tac-toe | ||
| vercel | ||
| ``` | ||
| ✅ Done! Copy the URL | ||
|
|
||
| ### Option B: Netlify | ||
| 1. Drag folder to [app.netlify.com/drop](https://app.netlify.com/drop) | ||
| 2. ✅ Done! Copy the URL | ||
|
|
||
| ### Option C: Local Testing | ||
| ```bash | ||
| python3 -m http.server 8000 | ||
| # Open http://localhost:8000 | ||
| ``` | ||
|
|
||
| ## Step 3: Play! 🎮 | ||
|
|
||
| 1. Visit your URL | ||
| 2. Create Game → Share link | ||
| 3. Friend joins → Play! | ||
|
|
||
| --- | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| **"Firebase not configured"** | ||
| → Update `game.js` with your Firebase config | ||
|
|
||
| **Opponent can't join** | ||
| → Check Firebase Rules are set correctly | ||
|
|
||
| **Not deploying** | ||
| → Make sure you're in the `online-tic-tac-toe` directory | ||
|
|
||
| --- | ||
|
|
||
| **Need help?** See full [README.md](README.md) | ||
|
|
||
| **Total time**: ~10 minutes | ||
| **Total cost**: $0 (Free tier) | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Security warning needed for Firebase rules.
The documented rules allow unrestricted read/write access to all rooms. While suitable for quick testing, this is insecure for production and should include a warning. Malicious users could overwrite or delete game state.
Consider adding a note that these are test-only rules, and link to production-ready rules (e.g., validating turn order, player assignments) in the full README.
Suggested addition
3. **Set Rules** (in Rules tab): ```json { "rules": { "rooms": { "$roomId": { ".read": true, ".write": true } } } } ``` + > ⚠️ **Warning**: These rules are for testing only. For production, implement validation rules to prevent cheating and unauthorized modifications.📝 Committable suggestion
🤖 Prompt for AI Agents