mirror of
https://github.com/tiennm99/vngeoguessr.git
synced 2026-10-15 08:17:28 +00:00
f41ba32f30b6e5bf865b48dc6b327de9eb95aba1
Replaces the hand-maintained flat CITIES map with a generated 67-node tree: one country, five provinces, 61 districts and towns. Names, centres and extents now come from the boundary build rather than being duplicated in src/lib/game.js, so there is one source instead of two that a test had to police for drift. Boundaries are built per district and unioned upward. A single-child province byte-copies its child rather than re-simplifying it, so the two cannot disagree along a border and strand panoramas in the gap. The country has no polygon of its own: the real Vietnam outline is vastly larger than the covered area and would mislead on a map, so its extent is the envelope of its provinces. OpenStreetMap has applied the 2025 merger, so the pre-2025 units survive only as boundary/historic relations whose rendered parent is the current province. A qualified lookup misses them entirely and a bare one can match a same-named unit elsewhere in the country, so each leaf tries both forms and the hit is validated against the parent pre-2025 extent. 60 of 61 leaves resolve; Cu Chi has no boundary relation left at all, which is why the previous outline already recorded a missing part and no panorama in the index sits there. The generated barrels now sanitise import identifiers and quote object keys. Region codes contain hyphens, which are legal in a filename but not in a bare identifier, and the barrel is rewritten after every region -- emitting them raw would have broken the build from the first district onward. Panorama indexes are re-clipped against the rebuilt outlines, dropping 74 of 424,691 entries that fell outside the retightened boundaries. Da Lat and Duc Hoa keep their bare codes so their leaderboard history stays attached, and their index files move to the province codes that now own them. Scoring is untouched: a guess still credits one city and Vietnam. The rollup through the tree lands in a later change.
VNGeoGuessr
A GeoGuessr clone focused on Vietnamese locations with accurate boundary detection and anti-cheat security. Play geolocation guessing games across 5 Vietnamese locations using real street-level imagery.
🎮 Features
- 5 Vietnamese Locations: Ha Noi, Da Nang, Ho Chi Minh, Da Lat, Duc Hoa (Long An)
- 360° Street View: Mapillary panoramic images with PhotoSphere viewer
- Anti-Cheat Security: Server-side session management prevents cheating
- Distance-Based Scoring: 0-5 point system based on accuracy
- Persistent Leaderboards: Redis-powered top 200 player rankings
- Accurate Boundaries: Nominatim API + Turf.js for precise city detection
📚 Documentation
For detailed information about this project, see the documentation in /docs/:
- Project Overview - Project summary and key characteristics
- Features - Complete feature list and game mechanics
- Tech Stack - Technology stack and dependencies
- Development Guidelines - Development setup and coding standards
- Game Flow - Complete gameplay flow documentation
- Project Structure - Codebase organization and architecture
🚀 Getting Started
Prerequisites
- Node.js 18+
- npm 11+
- Redis server (for leaderboards)
Development
# Install dependencies
npm install
# Start development server
npm run dev
# Build for production
npm run build
# Start production server
npm start
# Run linting
npm run lint
Open http://localhost:3000 to play the game.
🏗️ Built With
- Frontend: Next.js 15 + React 19 + Tailwind CSS 4
- Street View: Mapillary API + PhotoSphere Viewer
- Maps: Leaflet + OpenStreetMap
- Geographic Data: Nominatim API + Turf.js
- Storage: Redis (leaderboards) + In-memory sessions
- UI Components: shadcn/ui
🎯 How to Play
- Enter your username
- Select a Vietnamese location
- View the 360° street panorama
- Place your guess on the map
- Earn points based on accuracy (closer = more points)
- Compete for the top 200 leaderboard spots!
📋 Development Notes
- JavaScript Only: No TypeScript files
- Individual Parameters: Functions use separate parameters, not object destructuring
- Server-Side Security: Game coordinates never sent to client
- Session Management: Automatic cleanup after 30 minutes
🤝 Contributing
This project follows specific development guidelines. Please read the Development Guidelines before contributing.
Description
GeoGuessr clone for Vietnamese locations — Mapillary panoramas, Turf.js boundaries, Upstash REST leaderboards
Readme
Apache-2.0
14 MiB
0 Stars
1 Watchers
0 Forks
Languages
JavaScript
98.2%
CSS
1.8%