Create a mobile game with the Mapbox Maps SDK
Tags: mapbox, android, mobilegaming, maps
Published: 2018-05-01 21:09:09

---
title: Create a mobile game with the Mapbox Maps SDK
published: true
description: 
tags: #mapbox #android #mobilegaming #maps
---

With our [Maps SDKs for iOS and Android](https://www.mapbox.com/mobile/), 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](https://github.com/mapbox/mapbox-geography-quiz-demo) so you can replicate the project or use it to build something new.

![](https://cdn-images-1.medium.com/max/2000/1*oJwqztAZH1atbacPf5Xxfw.jpeg)

Here’s how [Tapper GeoChallenge](https://github.com/mapbox/mapbox-geography-quiz-demo) 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:*

![](https://cdn-images-1.medium.com/max/2000/0*dsGi8K6w2ThYUUrX.gif)

*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.*

![](https://cdn-images-1.medium.com/max/2000/1*WVcx_aaaiMk5gU4unRPAiA.gif)

The entire game exists in one screen and on a single map that’s using our [Outdoors style](https://www.mapbox.com/maps/outdoors/). The game is using only features of the Maps SDK for Android, as well as a few [Turf methods](https://github.com/mapbox/mapbox-java/tree/master/services-turf/src/main/java/com/mapbox/turf) 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](https://github.com/mapbox/mapbox-geography-quiz-demo), 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](https://www.wikidata.org/wiki/Special:ApiSandbox) to retrieve locations around the world. Or you could [use your Studio account](https://www.mapbox.com/studio/styles/) to create a GeoJSON dataset and then use [our Datasets API](https://www.mapbox.com/api-documentation/#datasets) 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](https://www.mapbox.com/studio/styles/) to create a custom map style for the game. Check out [our designer map styles](https://www.mapbox.com/designer-maps/) if you want awesome pre-made styles.

* Use our [Directions API](https://www.mapbox.com/api-documentation/#directions) 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](https://www.mapbox.com/help/marker-playground/) to experiment.

Use the [Maps SDKs for Mobile](https://www.mapbox.com/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](https://www.mapbox.com/unity/). Let us know what you build on Twitter, [#BuiltWithMapbox](https://twitter.com/search?f=tweets&vertical=default&q=%23BuiltWithMapbox&src=tyah).