<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Langston Smith</title>
    <description>The latest articles on DEV Community by Langston Smith (@langsmith).</description>
    <link>https://dev.to/langsmith</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F70662%2Fa32efa66-72bf-4004-b52d-0d9830b58b10.jpeg</url>
      <title>DEV Community: Langston Smith</title>
      <link>https://dev.to/langsmith</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/langsmith"/>
    <language>en</language>
    <item>
      <title>Create a mobile game with the Mapbox Maps SDK</title>
      <dc:creator>Langston Smith</dc:creator>
      <pubDate>Tue, 01 May 2018 21:09:09 +0000</pubDate>
      <link>https://dev.to/langsmith/create-a-mobile-game-with-the-mapbox-maps-sdk-48ld</link>
      <guid>https://dev.to/langsmith/create-a-mobile-game-with-the-mapbox-maps-sdk-48ld</guid>
      <description>&lt;p&gt;With our &lt;a href="https://www.mapbox.com/mobile/" rel="noopener noreferrer"&gt;Maps SDKs for iOS and Android&lt;/a&gt;, 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 &lt;a href="https://github.com/mapbox/mapbox-geography-quiz-demo" rel="noopener noreferrer"&gt;open on GitHub&lt;/a&gt; so you can replicate the project or use it to build something new.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2AoJwqztAZH1atbacPf5Xxfw.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2AoJwqztAZH1atbacPf5Xxfw.jpeg"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here’s how &lt;a href="https://github.com/mapbox/mapbox-geography-quiz-demo" rel="noopener noreferrer"&gt;Tapper GeoChallenge&lt;/a&gt; works:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;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:&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2AdsGi8K6w2ThYUUrX.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2AdsGi8K6w2ThYUUrX.gif"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;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.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2AWVcx_aaaiMk5gU4unRPAiA.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2AWVcx_aaaiMk5gU4unRPAiA.gif"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The entire game exists in one screen and on a single map that’s using our &lt;a href="https://www.mapbox.com/maps/outdoors/" rel="noopener noreferrer"&gt;Outdoors style&lt;/a&gt;. The game is using only features of the Maps SDK for Android, as well as a few &lt;a href="https://github.com/mapbox/mapbox-java/tree/master/services-turf/src/main/java/com/mapbox/turf" rel="noopener noreferrer"&gt;Turf methods&lt;/a&gt; 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!&lt;/p&gt;

&lt;p&gt;Visit the game’s &lt;a href="https://github.com/mapbox/mapbox-geography-quiz-demo" rel="noopener noreferrer"&gt;Github repository&lt;/a&gt;, 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:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Use a different list of locations to guess from&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Instead of storing the GeoJSON list of cities in the app’s assets folder (which &lt;em&gt;is&lt;/em&gt; great for offline gaming), you could use &lt;a href="https://www.wikidata.org/wiki/Special:ApiSandbox" rel="noopener noreferrer"&gt;the Wikidata API&lt;/a&gt; to retrieve locations around the world. Or you could &lt;a href="https://www.mapbox.com/studio/styles/" rel="noopener noreferrer"&gt;use your Studio account&lt;/a&gt; to create a GeoJSON dataset and then use &lt;a href="https://www.mapbox.com/api-documentation/#datasets" rel="noopener noreferrer"&gt;our Datasets API&lt;/a&gt; to retrieve the file.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create easy, medium, and difficult modes that use different city lists. Easy mode = only the 100 largest cities in the world, etc.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.mapbox.com/studio/styles/" rel="noopener noreferrer"&gt;Use your Studio account&lt;/a&gt; to create a custom map style for the game. Check out &lt;a href="https://www.mapbox.com/designer-maps/" rel="noopener noreferrer"&gt;our designer map styles&lt;/a&gt; if you want awesome pre-made styles.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use our &lt;a href="https://www.mapbox.com/api-documentation/#directions" rel="noopener noreferrer"&gt;Directions API&lt;/a&gt; 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?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Replace the player and bullseye marker icons with different images. Explore our &lt;a href="https://www.mapbox.com/help/marker-playground/" rel="noopener noreferrer"&gt;new Marker Playground&lt;/a&gt; to experiment.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Use the &lt;a href="https://www.mapbox.com/mobile/" rel="noopener noreferrer"&gt;Maps SDKs for Mobile&lt;/a&gt; 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 &lt;a href="https://www.mapbox.com/unity/" rel="noopener noreferrer"&gt;Maps SDK for Unity&lt;/a&gt;. Let us know what you build on Twitter, &lt;a href="https://twitter.com/search?f=tweets&amp;amp;vertical=default&amp;amp;q=%23BuiltWithMapbox&amp;amp;src=tyah" rel="noopener noreferrer"&gt;#BuiltWithMapbox&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>mapbox</category>
      <category>android</category>
      <category>mobilegaming</category>
      <category>maps</category>
    </item>
  </channel>
</rss>
