# 🚂 Railtrack Pro

**A web-based railway construction game featuring track building, junctions, signals, and 3D driver's eye view.**

![Railtrack Pro](https://img.shields.io/badge/Status-Prototype-orange)
![License](https://img.shields.io/badge/License-MIT-blue)
![Three.js](https://img.shields.io/badge/Renderer-Three.js-green)

## ✨ Features

- 🚂 **Track Pieces**: Straight, curved, junction, and signal tracks
- 🌍 **World Grid**: Interactive grid system for precise placement
- 🎮 **Construction Interface**: Click-to-place track building
- 👁️ **3D View**: Full 3D driver's eye view with camera controls
- 🔌 **Junction Logic**: Connect multiple tracks at junctions
- 🚦 **Signal System**: Railway signals for traffic control
- 💾 **Save/Load**: Game state persistence (coming soon)
- 🎨 **Visual Effects**: Dynamic lighting and shadows

## 🏗️ Project Structure

```
railtrack_pro/
├── index.html          # Main HTML entry point
├── css/
│   └── styles.css      # Application styles
├── js/
│   ├── app.js          # Main application logic
│   ├── renderer.js     # Three.js renderer
│   ├── tracks.js       # Track piece definitions
│   ├── world.js        # Grid and world management
│   └── game.js         # Game state and controls
├── assets/
│   ├── textures/       # Track textures (TBD)
│   └── models/         # 3D models (TBD)
├── test/
│   └── unit/           # Unit tests (TDD)
├── PLAN.md             # Development plan
└── README.md           # This file
```

## 🚀 Getting Started

### Requirements
- Modern web browser (Chrome, Firefox, Safari, Edge)
- WebGL 2.0 support
- No server required - works as local file

### Installation
1. Clone or download this repository
2. Open `index.html` in your browser
3. Start building your railway empire!

### Development Setup

```bash
# Navigate to project directory
cd /a0/usr/projects/railtrack_pro

# View development plan
cat PLAN.md

# Open in browser
open index.html  # Mac
x-www-browser index.html  # Linux
```

## 🎮 Controls

| Control | Action |
|---------|--------|
| **Mouse Wheel** | Zoom in/out |
| **Left Drag** | Rotate camera |
| **Right Drag** | Pan camera |
| **Click Track** | Remove track |
| **Click Viewport** | Place selected track |
| **Track Buttons** | Select track type |

## 🛠️ Development

### Technology Stack

- **Frontend**: HTML5, CSS3, JavaScript ES6+
- **3D Rendering**: Three.js
- **No Build System**: Vanilla JavaScript
- **Testing**: TDD approach (Jest planned)

### Code Style
- **TDD First**: Test before implementation
- **Well Documented**: JSDoc comments throughout
- **Clean Code**: Follows SOLID principles
- **Modular**: Class-based architecture

### Adding Features

1. Create test file in `test/unit/`
2. Implement feature in `js/`
3. Update documentation
4. Run tests to verify

## 📜 License

MIT License - See LICENSE file for details

## 🤝 Contributing

1. Fork the repository
2. Create feature branch (`git checkout -b feature/amazing-feature`)
3. Commit changes (`git commit -m 'Add amazing feature'`)
4. Push to branch (`git push origin feature/amazing-feature`)
5. Open Pull Request

## 📝 Version History

- **0.1.0** - Initial prototype with basic track system
- *Coming Soon*: Driver's eye view, signal logic, save/load

## 🙏 Acknowledgments

- Three.js for amazing 3D rendering
- Railway enthusiasts for inspiration

---

*Built with ❤️ for railway simulation* | 2026 Railtrack Pro Development Team
