Shanghai Mahjong - Free Online Tile Matching Game

Seele01-Flash
By
Shanghai Mahjong is a free online mahjong solitaire game featuring customizable tile layouts, helpful hints, and shuffle options. Perfect for puzzle lovers on any device.

Prompt

MODEL: Seele01-Flash
Please use Three.js to generate a **mobile-first game** with the theme "Shanghai Mahjong". Please read the following detailed game design requirements first, and then generate the code accordingly: ### 1. Assets & Environment * **Visual Style:** A relaxing, Zen-inspired aesthetic. Use a background image or procedural gradient representing a blurry green bamboo forest (referencing the source image). The overall lighting should be soft and warm (AmbientLight + DirectionalLight) to cast realistic shadows, which are crucial for depth perception in a 3D stacked tile game. * **Tile Models:** Create a procedural 3D Mahjong tile using `THREE.BoxGeometry` with slightly rounded edges (bevel). The tile consists of two layers: a white "ivory" top layer and a green "bamboo" bottom layer. * **Textures:** Use standard Mahjong iconography (Bamboo, Circles, Characters, Winds, Dragons, Flowers, Seasons) applied as textures to the top face of the tiles. * **Mobile Optimization:** **Crucial:** Use `THREE.InstancedMesh` to render the 144 tiles to minimize draw calls, as mobile GPUs are sensitive to high draw counts. Use a texture atlas for the tile faces to reduce texture swaps. ### 2. Audio Requirements * **BGM:** A calming, loopable track featuring traditional Chinese instruments (like the Guzheng or Pipa) mixed with subtle ambient nature sounds (wind in leaves, distant birds). * **Sound Effects (SFX):** * **Selection:** A crisp, tactile "clack" sound (like solid stone/plastic hitting wood) when a tile is tapped. * **Match:** A satisfying melodic chime or "ding" when two tiles are successfully matched and removed. * **Invalid Move:** A dull, hollow wooden thud if the player tries to tap a blocked tile. * **Shuffle:** The sound of many tiles clattering together. * **Win:** A celebratory oriental fanfare. ### 3. Gameplay Loop * **Level Generation:** specific implementation of the classic "Turtle" (or Pyramid) layout structure. This involves stacking 144 tiles in layers (centered, building upwards). * **Core Logic:** Implement the standard "Shanghai Solitaire" rules: 1. A tile is "selectable" only if it has no tile immediately on top of it AND it has an open space on either its immediate left OR right. 2. Player selects two matching "selectable" tiles to remove them from the board. 3. Flower tiles match any Flower; Season tiles match any Season. * **Features:** * **Timer:** A countdown timer (e.g., 10 minutes). * **Score:** Points awarded for matches, with a multiplier for quick successive matches. * **Shuffle:** A button to rearrange remaining tiles if stuck (limited uses). * **Hint:** A button to highlight a valid pair (limited uses). * **Win/Loss:** Win by clearing the board; Lose if time runs out or no moves remain (and no shuffles left). ### 4. Mobile Controls & Interaction * **Camera Control:** Implement `OrbitControls` but with restricted polar angles (to prevent looking under the table) and enabled damping for smooth feel. Allow pinch-to-zoom so mobile users can see details. * **Touch Interaction:** Use a precise `Raycaster` for touch detection. The hit area for tiles should be slightly larger than the visual model to accommodate "fat finger" errors. * **Feedback:** * **Visual:** When a tile is selected, it should visually "lift" up slightly (y-axis translation) and glow (emissive color change). * **Haptic:** Trigger `navigator.vibrate(10)` on valid selection for tactile feedback. * **UI Layout:** * **Orientation:** Landscape mode preferred, but responsive to Portrait (camera zooms out to fit board). * **HUD:** Top bar for Score and Timer. Bottom bar for large, thumb-friendly buttons (44x44px min): [Pause], [Hint], [Shuffle]. Do not ask for clarification. Do not request confirmation. Directly execute the generation task based on the given instructions.

Game Introduction

About Shanghai Mahjong

Shanghai Mahjong is an engaging free online mahjong solitaire game that puts a fresh twist on the classic tile-matching puzzle. With a solid 4.2/5 rating from players, this game offers an enhanced mahjong experience that goes beyond traditional gameplay. Unlike standard mahjong games, Shanghai Mahjong allows you to customize your gaming experience with multiple tile arrangement patterns and helpful gameplay features.

Core Features

Customizable Tile Layouts

Choose from various attractive tile arrangement patterns to keep your gameplay fresh and challenging. Each layout offers a unique strategic approach to tile matching.

Smart Game Assistance

  • Hint System : Get helpful suggestions when you're stuck
  • Shuffle Option : Rearrange tiles when no moves are available
  • Time Challenges : Optional time limits for competitive play

Cross-Platform Compatibility

  • Free to Play : No downloads or payments required
  • HTML5 Technology : Runs smoothly in any modern web browser
  • Mobile Optimized : Perfect touch controls for smartphones and tablets
  • Desktop Ready : Full mouse support for PC and Mac

Brain Training Benefits

As a brain teaser puzzle game, Shanghai Mahjong helps improve: - Pattern recognition skills - Strategic thinking - Memory and concentration - Visual perception

Game Mechanics

Shanghai Mahjong follows the classic mahjong solitaire rules with enhanced features. Your objective is to clear all tiles from the board by matching identical pairs. Only tiles that are free (not blocked by other tiles) can be selected.

Tile Matching Rules

  • Match identical tiles to remove them from the board
  • Only unblocked tiles can be selected
  • Clear all tiles to complete the level
  • Use hints and shuffles strategically

Controls and Operation

Desktop Controls

  • Mouse : Point and click on matching mahjong tiles
  • Left Click : Select and match tiles
  • Menu Navigation : Use mouse for all game options

Mobile Controls

  • Touch : Tap matching tiles with your finger
  • Pinch to Zoom : Adjust view for detailed tile examination
  • Swipe : Navigate through different game options

Game Interface

The clean, intuitive interface makes it easy to: - Identify matching tiles - Access hint and shuffle functions - Track your progress - Navigate between different layouts

Why Play Shanghai Mahjong

Perfect for All Skill Levels

Whether you're new to mahjong or a seasoned player, Shanghai Mahjong offers: - Beginner-Friendly : Easy difficulty rating makes it accessible - Progressively Challenging : Multiple layouts increase complexity - No Pressure Gaming : Play at your own pace

Convenient and Accessible

  • Instant Play : No registration or downloads needed
  • Universal Access : Works on any device with a web browser
  • Quick Sessions : Perfect for short breaks or long gaming sessions
  • Offline Capability : Once loaded, can be played without internet

Mental Wellness Benefits

Regular puzzle gaming like mahjong has been shown to: - Reduce stress and anxiety - Improve cognitive function - Enhance problem-solving abilities - Provide relaxing entertainment

Frequently Asked Questions (FAQ)