Posted by Dereck Bridie, Developer Relations Engineer and Bradford Lee, Augmented Reality Product Marketing Manager at ARCore
To commemorate the 45th anniversary of “Space Invaders”, Taito, the developer of the original arcade game, and UNIT9 collaborated to launch “Space Invaders”.Space Invaders: World Defense is an immersive game that leverages cutting-edge location-based AR technology. Players around the world can go outdoors and explore their local neighborhoods, defend the Earth from virtual space invaders that emerge from nearby structures, and earn points by defeating them. All of these use augmented reality.
This game leverages the latest ARCore technologies: Geospatial API, Streetscape Geometry API, and Geospatial Creator. We’re excited to give you a behind-the-scenes look at how the game was developed and how we used modern features and tools to design first-of-its-kind procedural global AR gameplay.
Geospatial API: Turn the world into your playground
The Geospatial API allows you to remotely attach content to any area mapped by Google Street View, creating richer, more robust immersive experiences linked to real-world locations on a global scale. Space Invaders: World Defense is available in more than 100 countries in areas where Street View has extensive Visual Positioning Service (VPS) coverage, adapting gameplay to crowded urban environments and small towns and villages.
For players living in areas without VPS coverage, we recently updated the game to add a new mode called Indoor Mode. This allows you to protect Earth from space invaders in any setting or location, indoors or outdoors.
Space Invaders’ new indoor mode brings immersive gameplay to indoor built environments. |
Creating the initial user flow
The ARCore Geospatial API uses camera images from a user’s device to scan for feature points and compares them to Google Street View imagery to accurately position the device in real-world space.
The Geospatial API is based on VPS with tens of billions of images from Street View, allowing developers to remotely build globally anchored experiences in over 100 countries. |
This requires the user to pick up the phone and move it around so that enough data is collected to accurately determine the user’s location. To do this, we employed a clever technique that forces users to scan the area by asking them to track a spacecraft within the camera’s field of view.
First, follow the spacecraft and scan the surrounding environment. |
Use this user flow to continually check whether the Geospatial API has collected enough data to deliver a high-quality experience.
if (earthManager.EarthTrackingState == TrackingState.Tracking)
|
Turn your environment into a playground
After scanning the nearby area, the game uses mesh data from the Streetscape Geometry API to algorithmically make gameplay in different locations a unique experience. Every real-world location has its own unique terrain and city layout, which affects gameplay in unique ways.
Gameplay changes depending on your location, from a town in the Czech Republic (left) to a city in New York (right). |
In the game, space invaders can spawn from buildings, so we built a test case using building geometry from different parts of the world. This ensures that the game works optimally in a variety of environments, from local villages to bustling cities.
Visualization of how the algorithm places portals in the real world |
Entering the Invader’s Dimension
Our research has shown that holding up your hand for an augmented reality experience can be tiring for users. This knowledge influenced our gameplay development. We created Invader’s Dimension to give players the opportunity to relax their phone arms and improve user comfort.
My favorite “wow” moment that demonstrates the power of the Geospatial API is the transition between real-world AR and virtually generated 3D dimensions.
Transitioning gameplay from real-world AR to 3D dimensions |
This effect is achieved by blending the camera feed with a virtual environment shader that renders buildings and terrain in a unique wireframe style.
The Invaders dimension appears around the player in the Unity Editor, seamlessly transitioning between the two modes |
After the player enters the invader’s dimension, the player’s spaceship flies through the neighborhood along an algorithmically generated path. This is done by creating a depth image of the user’s environment from his camera overhead. In this image, the red channel represents buildings and the blue channel represents space that may be used for flight paths. This image is then used to generate a grid containing the points that the path follows, and the A* search algorithm is used to solve the path that follows all the points.
Finally, the generated A-Star paths are post-processed to smooth out potential jittering, sharp turns, and collisions.
To smooth the spacecraft path, jitter is removed by sampling the path at a set node interval. It then determines whether there are sharp turns in the path by analyzing the angles along the path. If a sharp turn exists, introduce two additional points to round it out. Finally, check if this smoothed path collides with an obstacle and adjust to fly over it if an obstacle is detected.
Visualizing Depth Map and Generated Sample Paths in Invader Dimensions |
Creating a global gaming experience
A key takeaway from building the game was that the complexity of context generation required worldwide testing. Using Unity, we were able to incorporate multiple environments into our test cases, allowing us to quickly iterate and validate changes to these algorithms. This gave us the confidence to take the game globally.
Visualize Space Invaders using Geospatial Creator
Use Geospatial Creator, powered by ARCore and Google Maps Platform’s photorealistic 3D tiles, to explore how virtual content such as Space Invaders appears next to specific landmarks in Tokyo in Unity. did.
Using photorealistic 3D tiles, they were able to visualize intruders in specific locations, such as Tokyo Tower in Japan. |
Upcoming updates and releases
Since the game’s launch, we’ve listened to player feedback and actively updated and improved the gameplay experience.
- Added a new gameplay mode, Indoor Mode. This allows all players who don’t have VPS coverage or who don’t want to use AR mode to experience the game.
- To encourage users to play games in AR, scores have been rebalanced to reward players who play outdoors more than those who play indoors.
Download the game now on Android or iOS, join the ranks of the elite Earth Defense Force, and compete for the highest score in your neighborhood. To stay up to date with the game, follow us on Twitter (@GoogleARVR) Hear how we’re improving your game. Additionally, visit the ARCore and Geospatial Creator websites to learn how to start building with Google’s AR technology.