initial commit

Signed-off-by: ale <ale@manalejandro.com>
Este commit está contenido en:
ale
2025-11-11 23:13:13 +01:00
padre 78613f6cbe
commit 16469bab3c
Se han modificado 22 ficheros con 3855 adiciones y 6659 borrados

110
README.md
Ver fichero

@@ -1,36 +1,106 @@
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).
# Dominoes Online
A modern, real-time multiplayer dominoes game built with Next.js, TypeScript, Canvas, and Socket.IO.
## Features
- 🎮 **Real-time Multiplayer** - Play with friends online using WebSocket connections
- 🤖 **AI Opponent** - Play against an intelligent AI when no other players are available
- 🎨 **Beautiful UI** - Modern, responsive design with smooth animations
- 🎯 **Canvas Rendering** - Domino tiles rendered using HTML5 Canvas
- 📱 **Responsive** - Works great on desktop and mobile devices
-**Fast & Real-time** - Instant updates for all players
## How to Play
1. **Create a Room** - Start a new game and share the room code with friends
2. **Join a Room** - Enter a room code to join an existing game
3. **Play vs AI** - Practice against an AI opponent
4. **Match Tiles** - Place tiles that match the numbers on the board ends
5. **Win** - First player to use all tiles wins!
## Game Rules
- Each player starts with 7 domino tiles
- Players take turns placing tiles that match the numbers on either end of the board
- If you can't play, draw a tile from the boneyard
- The game ends when a player uses all their tiles or when no one can move
- Lowest total value wins if the game is blocked
## Tech Stack
- **Next.js 16** - React framework for production
- **TypeScript** - Type-safe JavaScript
- **Socket.IO** - Real-time bidirectional communication
- **Zustand** - State management
- **Framer Motion** - Smooth animations
- **Tailwind CSS** - Utility-first CSS framework
- **HTML5 Canvas** - Tile rendering
## Getting Started
First, run the development server:
### Prerequisites
- Node.js 18+ installed
- npm or yarn package manager
### Installation
1. Install dependencies:
```bash
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
npm install
```
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
2. Run the custom server with Socket.IO:
```bash
npm run dev
```
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
3. Open [http://localhost:3000](http://localhost:3000) in your browser
This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.
**Note:** This project uses a custom Next.js server (`server.mjs`) to integrate Socket.IO for real-time multiplayer functionality.
## Learn More
## Development
To learn more about Next.js, take a look at the following resources:
### Project Structure
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
```
domino/
├── app/ # Next.js app directory
│ ├── api/socket/ # Socket.IO API route
│ ├── page.tsx # Main game page
│ └── layout.tsx # Root layout
├── components/ # React components
│ ├── DominoCanvas.tsx
│ ├── GameBoard.tsx
│ ├── PlayerHand.tsx
│ ├── Lobby.tsx
│ ├── WaitingRoom.tsx
│ └── GameOver.tsx
├── lib/ # Core game logic
│ ├── types.ts # TypeScript interfaces
│ ├── gameLogic.ts # Game mechanics
│ ├── aiLogic.ts # AI opponent
│ ├── store.ts # Zustand store
│ └── socket-server.ts # Socket.IO server
└── public/ # Static assets
```
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!
### Available Scripts
## Deploy on Vercel
- `npm run dev` - Start custom development server with Socket.IO
- `npm run build` - Build for production
- `npm start` - Start production server with Socket.IO
- `npm run lint` - Run ESLint
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
## Contributing
Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.
Contributions are welcome! Please feel free to submit a Pull Request.
## License
MIT License - feel free to use this project for learning or personal use.
---
Enjoy playing dominoes online! 🎲