Coming from the cricket crazed country of India having over a billion fans of the game, cricket has been a passion of mine since a young age. Being an Army officer’s son, I spent my childhood moving from city to city courtesy his frequent postings. I found Cricket to be the unifying bond across religions, regions and languages. Rarely have I seen an empty piece of land not occupied by kids playing a quick game of cricket, be it the concrete jungle of Bangalore or the hills of Kashmir.
Living as a room-mate with 4 other guys, I frequently hear them crib of how their corporate lifestyle is taking a toll on their fitness and they are unable to play cricket because of lack of playing fields or friends to play with. When I first discussed the idea of this project with them, they were super excited about it and happily volunteered to be “test models”! :-) I hope you find the game to be as amazing and as fun as they found it to be.
What it does
CricFit combines the calorie-burning exercise of Cricket with the fun and excitement of a virtual game. A common complaint against virtual games is that they are responsible for obesity and lethargy because they do not involve any real physical activity. CricFit is a direct answer to these complaints and shows a way to enjoy some exercise without the hassles or cost of VR systems or expensive gaming consoles.
P.S. Also there are no motion-based Cricket game in Wii or anywhere else :-)
How I built it
I started by building a simple HTTP server that could allow two clients to communicate quickly using Websockets. I used Python and Asyncio/Aiohttp to achieve the same. Over this protocol, I built the "bat" to "screen" communication. An Android App was created in React Native to obtain and analyze Accelerometer and Grysocope data when the user mimics a Cricketing Shot. Once the signature of each shot is obtained and stored, the user can use his skills in a match where the shot is then classified by comparing with the signature that was stored using the Dynamic Time Warping (DTW) algorithm.
Challenges I ran into
The first prototype I build was bound to fail because of latency issues between the clients and server. It was impossible to deal with the split-second reaction time needed in most sports thanks to the delay over the network. I tried to send real-time accelerometer and gyroscope data from the "bat" (Smartphone) to the "screen" (Desktop website) through the Openshift Server. When this didn't work, I switched to an event-based model, where the "bat" would process the data at it's end and then send a simple event to the "screen" over Websockets. This was a significant change in game design just days before the final submission.
Another challenge was classification of the shots using the noisy data obtained by the gyroscope/accelerometers. This time series data was regularized and scaled before applying the DTW algorithm on it, yet it is still far from giving accurate results.
Accomplishments that I'm proud of
I learnt about this Hackathon very late and began working on it very close to the deadline. Despite the last minute panic-induced adrenaline rush, I managed to create a working product without neglecting my job.
I'm also proud of adapting to the failure of the first prototype and quickly pivoting to a better much solution without losing too much progress.
What I learned
What's next for CricFit
CricFit has a very long way to go in becoming an awesome interactive game. There is a lot of scope of improvement in the shot detection algorithm, and there are plenty Cricket rules and techniques that haven't been added to the game and can be incorporated. There is also a huge need for designing the screens, flows and get rid of bugs. As it currently stands, CricFit is a project that was hacked together to act a proof-of-concept to the as yet unexplored realm of motion-based Cricket gaming, perhaps laying the foundation for the first Cricket game for Wii or Kinect :-)
I am continuing to build the game and shall share it with my colleagues and friends to enjoy the experience and pit their skills against each other! Based on the response, I could also aim to release it to a larger audience (fingers crossed)