With our Maps SDKs for iOS and Android, you can create custom map interfaces for your mobile games. As an example, I put together a simple geography quiz game using our Maps SDK for Android. Don’t laugh, but its current name is “Tapper GeoChallenge”. Yes, that’s the best name that I could come up with. I’ve made the code open on GitHub so you can replicate the project or use it to build something new.
Here’s how Tapper GeoChallenge works:
In a one player game, the app picks a city at random, and the user guesses what country it’s in. If you guess incorrectly, the app returns the distance between the player’s guess and the target city:
In a two player game, each player gets a turn guessing the country for the target city, and points are awarded for each correct guess.
The entire game exists in one screen and on a single map that’s using our Outdoors style. The game is using only features of the Maps SDK for Android, as well as a few Turf methods to calculate distance. The most complex code is basically keeping track of whose turn it is and which marker/map-click corresponds to each player. Give it a shot!
Visit the game’s Github repository, follow the README’s installation instructions, and download the code to start developing your own version in Android Studio. Here are some ideas for improvements:
Use a different list of locations to guess from
Instead of storing the GeoJSON list of cities in the app’s assets folder (which is great for offline gaming), you could use the Wikidata API to retrieve locations around the world. Or you could use your Studio account to create a GeoJSON dataset and then use our Datasets API to retrieve the file.
Create easy, medium, and difficult modes that use different city lists. Easy mode = only the 100 largest cities in the world, etc.
Use your Studio account to create a custom map style for the game. Check out our designer map styles if you want awesome pre-made styles.
Use our Directions API to turn the game into a mileage guessing game. For example, how many miles need to be driven to go from Istanbul to Lisbon? Tokyo to Osaka?
Replace the player and bullseye marker icons with different images. Explore our new Marker Playground to experiment.
Use the Maps SDKs for Mobile to incorporate maps into your mobile games. If you’re looking to create immersive experiences in 3D, AR, or console gaming, then check out our Maps SDK for Unity. Let us know what you build on Twitter, #BuiltWithMapbox.
Top comments (0)