Train Switch - Logic Puzzle Game

Seele01-Flash
By
Train Switch is an exciting real-time logic puzzle where you control railway switches to guide runaway trains to safety. Test your strategic thinking and quick reflexes in this challenging brain teaser.

Prompt

MODEL: Seele01-Flash
Please use Three.js to generate a **mobile-first game** with the theme "**Train Switch: The Toy Railway**". Please read the following detailed game design requirements first, and then generate the code accordingly: ### 1. Assets & Environment * **Visual Style**: A charming **Low-Poly / Voxel 3D** aesthetic, resembling a physical toy train set. The camera should be an **Orthographic Camera** fixed at an isometric angle (approx. 45 degrees) to provide a clear view of the track layout without perspective distortion. * **Environment**: A "Desert / Wild West" themed baseboard. The ground is a sandy orange plane with simple flat-shaded cactus and rock props scattered outside the playable track area. * **Track System**: Modular 3D track pieces (straight, curved, and Y-junctions). Use **InstancedMesh** for the track sleepers (wooden ties) and rails to ensure high performance (60 FPS) on mobile devices. * **Trains**: Blocky, cute trains consisting of a Locomotive and 1-2 wagons. They should be distinct colors (Red, Blue, Green) to match specific destination stations. * **Switches (Junctions)**: The core interactive element. Junctions must have a clear visual indicator (e.g., a large 3D Arrow or a Lever next to the track) showing the current direction. The active path should be highlighted (brighter rail color), while the inactive path looks duller. ### 2. Audio Requirements * **BGM**: A lighthearted, rhythmic **Ragtime piano** or acoustic guitar track that mimics the "chug-chug" tempo of a train. It should loop seamlessly. * **Sound Effects (SFX)**: * **Train Movement**: A constant, low-volume rhythmic chugging sound that speeds up slightly as the train accelerates. * **Switch Toggle**: A crisp, mechanical "Click-Clack" sound when the player taps a junction. * **Whistle**: A steam whistle sound when the level starts. * **Success**: A cheerful "Ding-Ding!" bell sound when a train enters the correct station. * **Fail/Crash**: A cartoonish "Bonk" or wood-splintering sound if the train crashes or hits a dead end. ### 3. Gameplay Loop * **Core Mechanic**: This is a real-time pathfinding puzzle. Trains spawn automatically from a tunnel and move forward at a constant speed along the tracks. They cannot stop. * **Player Action**: The player acts as the "Switch Master." They must tap/click on track junctions **before** the train arrives to change the track direction (toggling between Left/Right or Straight/Turn). * **Objective**: Guide specific colored trains to their matching colored stations (e.g., Red Train -> Red Depot). * **Win Condition**: Successfully guiding all scheduled trains to their correct destinations without crashing. * **Fail Conditions**: * Train crashes into another train. * Train runs off a dead-end track. * Train enters the wrong colored station. ### 4. Mobile Controls & Interaction * **Input Method**: **Raycasting** via single-touch taps. The user taps directly on the Junction/Switch 3D object to toggle it. * **Orientation**: **Portrait Mode** is preferred for one-handed play, or **Landscape** if the track layout is wide. The canvas must resize dynamically (`window.addEventListener('resize', ...)`). * **Touch Feedback**: * **Visual**: When a switch is tapped, the switch arrow should animate (rotate) instantly, and a small particle "puff" or scale-bounce effect should occur to confirm input. * **Haptic**: Trigger `navigator.vibrate(10)` (if supported) on every switch toggle for tactile feedback. * **UI Layout**: * Minimal HUD. A "Play/Speed Up" button in the bottom right corner. * A "Retry" button prominently displayed in the center of the screen only upon Game Over. * Prevent default browser behaviors (scrolling/zooming) on the canvas (`touch-action: none`). ### 5. Code Generation * Please generate the logic using standard modern JavaScript (ES6+). * Use a basic placeholder geometry (BoxGeometry, CylinderGeometry) if external assets cannot be loaded, but structure the code so GLTF models can be easily swapped in later. Do not ask for clarification. Do not request confirmation. Directly execute the generation task based on the given instructions.

Game Introduction

About the Game

Train Switch is a captivating classical logic puzzle that challenges your strategic thinking and quick decision-making skills. This engaging brain teaser puts you in control of a complex railway system where runaway trains are racing toward their destinations, and only your quick wit can guide them safely.

In this binary switch puzzle, every decision matters. You must analyze train paths, anticipate their movements, and throw the appropriate switches at precisely the right moments. The game combines elements of strategy, timing, and logical reasoning to create an addictive puzzle experience that will keep you coming back for more.

Core Features

Real-Time Strategic Gameplay

Unlike traditional turn-based puzzles, Train Switch operates in real-time, adding an exciting layer of pressure and urgency. You'll need to think quickly while maintaining accuracy, making split-second decisions that determine the fate of multiple trains simultaneously.

Progressive Difficulty Levels

The game starts with simple scenarios to help you learn the mechanics, then gradually introduces more complex railway networks with multiple trains, intersections, and challenging switch combinations. Each level tests different aspects of your logical reasoning abilities.

Intuitive Control System

Despite the complex strategic elements, the game features straightforward controls that anyone can master. Use WASD keys for character movement and your mouse to operate railway switches with precision timing.

Brain Training Benefits

Train Switch serves as an excellent mental exercise, improving your: - Strategic planning skills - Pattern recognition abilities - Quick decision-making under pressure - Spatial reasoning and visualization - Multi-tasking capabilities

Cross-Platform Compatibility

Built with HTML5 technology, the game runs smoothly on all modern browsers and devices. Whether you're on a desktop computer, laptop, tablet, or smartphone, you can enjoy the full Train Switch experience without any downloads or installations.

Game Mechanics

Switch Control System

The core gameplay revolves around a binary switch system where each junction can be set to either "on" or "off" position. These switches determine which path the trains will follow, and mastering their timing is crucial for success.

Multiple Train Management

As you progress, you'll encounter scenarios with multiple trains running simultaneously on the same network. This requires advanced planning and the ability to think several moves ahead, anticipating how each switch change affects all active trains.

Safety Objectives

Your primary goal is to prevent train collisions and ensure each train reaches its designated destination safely. This requires careful observation of train speeds, route planning, and perfect timing of switch operations.

Operation Guide

Basic Controls

  • WASD Keys : Move your character around the railway yard to access different switch points
  • Mouse Click : Operate railway switches to change track directions
  • Observation : Watch train movements and predict their paths before making switch changes

Winning Strategy Tips

  1. Analyze First : Study the entire railway layout before any trains start moving
  2. Plan Ahead : Think at least two moves in advance to avoid creating new problems
  3. Timing is Key : Wait for the optimal moment to throw switches - too early or too late can cause disasters
  4. Stay Calm : The real-time pressure can be intense, but maintaining composure leads to better decisions
  5. Practice Pattern Recognition : Learn to quickly identify common track configurations and their solutions

Why Play Train Switch?

Mental Stimulation

This game provides excellent cognitive exercise, challenging your brain in multiple ways simultaneously. Regular play can help improve concentration, logical reasoning, and problem-solving skills that benefit you in real-world situations.

Stress Relief Through Focus

The intense concentration required creates a meditative flow state that helps you disconnect from daily stresses. The satisfaction of successfully solving complex railway puzzles provides a rewarding sense of accomplishment.

Accessibility and Convenience

As a free browser-based game, Train Switch offers premium puzzle entertainment without any barriers. No downloads, no installations, no subscriptions - just pure puzzle-solving fun whenever you want it.

Suitable for All Ages

While challenging enough for adults, the game's intuitive mechanics and progressive difficulty make it accessible to players of all ages. It's an excellent choice for family gaming sessions or educational purposes.

Quick Gaming Sessions

Perfect for both short breaks and extended gaming sessions. Each puzzle can be completed in just a few minutes, making it ideal for busy schedules, while the addictive gameplay encourages longer play sessions when time allows.

Frequently Asked Questions (FAQ)