Pratham had some his friends over and they were going to play on his Wii but found that one of the controllers was dead. They tried changing out the batteries but it didn't seem to help. For everyone to be able to play, they had to go out to Best Buy and get a new controller. Not only was this a waste of time, it was also a waste of $40. After describing this to the team, we decided to build a solution and bypass this problem by using something that everyone has all the time – a cell phone, as a physical controller for a video game.
What it does
Fruit Sensei is a spin on a familiar game to everyone, Fruit Ninja. The player uses their mobile device as the handle of their katana. When the move their phone, the katana moves on-screen. Fruit falls from the sky and the player has to hit it with their katana before the fruit splatters on the ground and makes a mess. Smaller fruits, being harder to hit, are worth more points. The object of the game is to earn the most points before the 60-second timer runs out.
The game can also be run on a mobile device. If you load the website on your phone, it will become split-screen so you can easily place it into a cardboard VR device.
How we built it
To make the game as accessible as possible, we built the entire thing off the web. That means no app to download, no libraries, no plugins, just an internet connection.
The game is being hosted on a .tech domain, so it can be easily accessed at www.fruitsensei.tech
Challenges we ran into
We had a hard time figuring out a 3D space using a library like Three.js, and figuring out textures for shapes such as the fruits. None of us had experience with DNS and CNAME records either, so we had to forward our original Heroku app on a .tech domain.
Accomplishments that we're proud of
We're proud that we were able to create a working game that involves a phone as a controller. This is very different from conventional computer or mobile phone games that only use a touchscreen, mouse, and/or keyboard as input. We were able to create a game that feels more immersive like a real video game without the need to buy a game controller.
What we learned
We learned how to use the Three.JS library to render 3D graphics for our program, and how to use JS's native DeviceOrientation to detect the phone's orientation to map to the katana's position. It was also just a lot of fun trying to figure out game mechanics, and how to make a game both technically complex and enjoyable. At some point, we had to sacrifice complexity for the sake of performance on the user's end.
What's next for Fruit Sensei
We have already built the capability to detect the game is being run on a mobile device and adapt for mobile VR headsets. The game is already built in a 3D space. However, we don’t currently use this for much and we would like to build more 3D interactive features in the future to make it an even more immersive experience, such as fruit falling from all around you.