All docschevron-rightUnity SDKchevron-rightarrow-leftGuideschevron-rightLocation based games

Location based games

Build the next big location-based game with the Mapbox Maps SDK for Unity. The Mapbox Maps SDK for Unity allows developers to create custom styling for buildings in their Unity projects.

Getting started

The Mapbox Maps SDK for Unity provides a starting point for location-based games. There are two location-based game example scenes inside of the SDK: Location-based game and Astronaut game.

Both make use of the LocationProvider which will automatically use the device GPS to position the game map.

You can use the LocationProvider by dropping the LocationBasedGame prefab game object into a scene. It comes configured with the LocationProvider, Map, and Player objects by default.

Dragging and dropping the LocationBasedGame prefab into the scene will get you started on your location-based game. If you’re new to Unity, Mapbox, or both, you might find the Pocket Droids GO video tutorial useful. The guide will walk you through creating a Pokemon GO style location based game using Mapbox's location data. Additionally, the Mapbox presentation at Unite Berlin 2108 on how to make a location-based game in 20 minutes contains useful information on creating location aware gaming experiences.

Use case ideas

Points of interest

Once you get a map rendered, the fun begins! Use Mapbox's POI data to have interactions at important locations. For more information on how to spawn game objects on the map, see the documentation on adding markers.

Racing games

Mapbox's road and building data provide the building blocks to create driving games in any city in the world. You can also use real-time traffic data and navigation inside of your game to make your racer more realistic. To see examples of how vector features can be configured in Unity, see the map features documentation.

RPG and strategy games

Create custom styles to turn real-world cities into a base map for your strategy or role playing game. Replace buildings with your own custom 3D models, or you can use the default fantasy style building texturing provided in the Maps SDK for Unity. For more information on styling, see the map texturing documentation.

Aviation games

You can create compelling games using only raster data. Create a top-down fly over game using one of the default styles for your base map. In the video below, Mapbox's satellite imagery provides the background for a fly over aviation game. Notice the realistic shadows and terrain provided by the Mapbox Satellite v9 style. You can also create your own custom style in Mapbox Studio to use in Unity for a custom backdrop for your aviation game. For more information on custom maps in Unity, see the custom style documentation.

Augmented reality

The Maps SDK for Unity also provides the building blocks for location-based AR games. For example, Space invadAR, Mapbox's demo game, uses vector data from cities around the world to create a fun world-scale AR experience. Game object styling and interaction varies based on the type of POI. For more information on building AR games, see the example scenes in the SDK, and the documentation on AR.

Level creation

Mapbox has a rich dataset, but for games sometimes too much data can be noisy. Use filters to restrict game play to safe areas or only display specific building types. You can also use road and trail data to create a navmesh for your scene. For example, see how this Mapbox demo makes enemy skeletons NPCs walk paths in a park. Mapbox's location data allows you to have full control to create a fun and safe gaming experience.

Was this page helpful?