The Evolution of MapMaster
What began as a project for an online React course at MalmΓΆ University in Sweden, originally started as a simple interactive map. Initially, the idea was to create a map where users could click on countries to display information about them. However, the project quickly evolved. The simple map transformed into MapMaster, a flag-guessing game that challenges players to identify countries based on their flags.
Introducing MapMaster π
Welcome to MapMaster, a geography-based flag guessing game that offers both fun and educational insights into the world of flags and countries. By integrating the restcountries.com API and the Google Geocoding API, the game became an interactive learning experience.
The Game’s Genesis
The idea of MapMaster started as a simple assignment but quickly evolved into a full-fledged game. The goal was to use technology not only to create something entertaining but also educational. By combining the Rest Countries API, which provides information about countries and their flags, with Google’s Geocoding API for accurate map interactions, MapMaster became a reality. It’s a perfect blend of learning and playing, where players test their knowledge of world flags in a fun and interactive way.
Adding a Competitive Edge with a Leaderboard
To enhance the game’s engagement, I added a leaderboard, hosted in Supabase. This addition not only brought a competitive element but also turned MapMaster into a platform where geography enthusiasts can compete and learn.
How to Play
The gameplay is simple yet captivating:
- Players are presented with a flag and have to guess the corresponding country.
- Points are scored for correct guesses.
- The game is time-bound, adding an element of excitement.
- Clues are available, but using them deducts points, adding a strategic layer to the game.
Project Structure
Here’s a glimpse into the structure of MapMaster:
.
βββ LICENSE
βββ README.md
βββ index.html
βββ package.json
βββ public
β βββ favicon.svg
βββ src
β βββ App.tsx
β βββ api
β β βββ CountriesApi.ts
β β βββ GeocodeApi.ts
β βββ assets
β β βββ fonts
β β β βββ RocherColorGX.woff
β β β βββ RocherColorGX.woff2
β β βββ scss
β β βββ _base.scss
β β βββ _font.scss
β β βββ _variables.scss
β β βββ components
β β β βββ buttons.scss
β β β βββ clickwindow.scss
β β β βββ confetti.scss
β β β βββ flag.scss
β β β βββ gamemode.scss
β β β βββ gameover.scss
β β β βββ leaderboard.scss
β β β βββ leaderboardentry.scss
β β β βββ overlays.scss
β β β βββ roundwin.scss
β β βββ main.scss
β βββ clients
β β βββ SupaBaseClient.ts
β βββ components
β β βββ ClickWindow.tsx
β β βββ ConfettiCanon.tsx
β β βββ Game.tsx
β β βββ GameInitializer.ts
β β βββ GameUtils.ts
β β βββ Leaderboard.tsx
β β βββ Map.tsx
β β βββ Notification.tsx
β β βββ overlays
β β β βββ ClueOverlay.tsx
β β β βββ FlagOverlay.tsx
β β β βββ GameModeSelectionOverlay.tsx
β β β βββ GameOverOverlay.tsx
β β β βββ InstructionsOverlay.tsx
β β β βββ LeaderboardEntryOverlay.tsx
β β β βββ PointsOverlay.tsx
β β β βββ RoundWinOverlay.tsx
β β β βββ TimerOverlay.tsx
β β βββ stages
β β βββ GameModeSelectionStage.tsx
β β βββ GameOverStage.tsx
β β βββ InstructionsStage.tsx
β β βββ RoundWonStage.tsx
β β βββ RunningStage.tsx
β βββ constants
β β βββ InitialGameState.ts
β β βββ constants.ts
β β βββ overlayVariants.ts
β βββ contexts
β β βββ GameContext.tsx
β β βββ NotificationContext.tsx
β βββ hooks
β β βββ useAntiCheat.ts
β β βββ useCountdown.ts
β β βββ useGameManager.ts
β β βββ useMapInteraction.ts
β β βββ useNotification.ts
β β βββ usePreventPinchZoom.ts
β β βββ useTimer.ts
β βββ interfaces
β β βββ Country.ts
β β βββ GameState.ts
β β βββ HighScore.ts
β β βββ INotification.ts
β βββ main.tsx
β βββ reducers
β β βββ GameReducer.ts
β βββ services
β β βββ CountryService.ts
β β βββ HighScoreService.ts
β βββ vite-env.d.ts
βββ tsconfig.json
βββ tsconfig.node.json
βββ vite.config.ts
βββ yarn.lock
This structure shows the organization and modern tech stack used to build MapMaster. It’s all about creating an engaging, efficient, and scalable game.
Code Quality and Standards
Developing MapMaster, I emphasized code quality by using ESLint with Airbnb’s style guide. This ensures clean, maintainable code, aligning with best practices in JavaScript development. It’s about crafting code that’s as engaging and intuitive as the game itself.
Conclusion
MapMaster, at its core, is a game that combines fun with a bit of learning. It stands as an example of how creative coding can transform a simple idea into an engaging and enjoyable experience. The game is open source, and I welcome everyone to explore, play, and perhaps contribute to its evolution.
Discover the game on GitHub and enjoy the challenge at https://map.christianek.io. Let’s explore the world of flags together!