Apple recently released ARKit with iOS 11 so now seemed like the perfect time to dive in and try to build something. I loved playing the original space invaders growing up and wanted this to be a homage to the original.
What it does
The game is a slight twist on the original space invaders. In augmented reality, you are surrounded 360° by aliens that slowly move towards you. It is your job to shoot all of the aliens before they get to you or else you lose. As you progress through the rounds more and more aliens come after you.
How I built it
I built it entirely inside of react-native with ARKit. I did not use any other game engines or libraries. This posed a lot of fun challenges since I had to implement all of my ownn vector and rotation logic (e.g. LookAt is a common function in game engines that will rotate an object to face a given (x, y, z) coordinate). I used Blender for creating the alien 3D model.
Challenges I ran into
I had a lot of problems initially with getting the calibration working properly with the aliens so that they would stay at their global coordinates as you move around. I also ran into issues with importing the 3D model for the alien. It ended up being a combination of path problems and not having a proper material configured. I also had some issues initially with computing the rotations and vectors needed for shooting lasers and moving aliens.
Accomplishments that I'm proud of
I'm stoked that I was able to get something built with AR during the hackathon! It really came together during the last couple hours. I'm also excited that I was able to build this all entirely inside of react native without using a game engine like Unity3D or Unreal Engine.
What I learned
I learned how to use ARKit and have a better mental model of what is currently possible with AR on phones. It was also an interesting exercise to use react-native with redux to render and store game state.
What's next for AR Space Invaders
Added in some explosions, sound effects, and maybe multiple difficulty modes. After that I'll put it up on the app store for others to try out!