Thursday, April 21, 2016

Rubik's Cube

Rubik's Cube

Making of the the best ever Rubik Cube App




This is not a technical blog but I couldn't help the occasional references :-).

The Beginning



It all started when I decided to learn two things in Unity 3d -

  1. Developing an easy interface to look at a 3D object from all angles 
  2. Rotations. In gaming, we use something called Quaternions for rotations, traditional Euler angles give weird results including gimbal lock, a situation which has almost jeopardised the Apollo 13 mission. Though we don’t directly deal with Quaternions, rotations need love and care. They can make or break a game.

Rubik The Cube


I choose Rubik’s Cube because it is colourful to look at and cubes are easy to create. After about a month of struggle, the cube was partially tamed to obey my gestures. By this time I was so fascinated by the complexity of the puzzle, that I bought a cube and started to learn solving it. I tried all the apps on the play store and none were any good. I saw an opportunity here.

Vaishnavi Saddapalli


My wife, Vaishu, was irritated with me spending so much time with Rubik that she snatched it and challenged me that she would solve it. I just laughed. 

Over the next few days, after coming back from work, I would start working on the app and Vaishu on youtube watching videos to solve the cube. Three days later, while I was fine tuning my app, she threw the solved cube at me. I was shocked. But I simply scrambled it and gave it back. She went back to solving it giving me dirty looks.

Two days later, she learnt to solve the cube without referring tutorials online and my app was almost ready, well so I thought. I loaded it up on my phone and gave it to her to test. She grumbled saying that the real cube is much better, but I was persuasive. Ten seconds later she threw it back at me, telling me it sucks. I was so angry. I didn’t talk to her all night. This was the first review I got.

The next day, I convinced myself that Vaishu does not play games and hence the feedback. I opened my app and started solving it and I understood. There were problems, some gestures were being misunderstood and sometimes the cube would rotate too fast. It took me two days to fix it but the difference was visible. The cube understood my gestures better. I gave it back to her, this time she played with it for over a minute and handed it back to me saying “its ok”. 

This was a compliment because she is one of the worst critic I encountered till date. Of the 10 places we go out to eat, she doesn’t like 8 where as I would like all 10. 

So I decided the app was ready for beta. I uploaded it on Google Play. Instead of going through the alpha and beta channels, I directly uploaded it on production to save my friends the trouble of becoming beta testers. This was just before our trip to Leh.


Screenshot of version .15


Ranjeet Singh Kaurav

It was March 22nd, Vaishu, her friends and me were going to Leh via Delhi. I took my laptop to Delhi but was debating if I should take it to Leh or leave it behind. The next review from Ranjeet Singh Kaurav decided it.

(WhatsApp conversation)
Ranjeet: “There is no option to quit, and that is a strict no no” he watsapped in the group. 

Me: “What quit? This is not a desktop application to put a cross to close. Just press the Home Button” (angry angry angry)

Ranjeet: “No man, I will not use any app which does not quit”

(Me thinking: what is wrong with Ranjeet? Doesn’t he use apps on cell phones) 

Neil: “Jayanth.. in iPhone we only have the home button, but in android we have a back button to  go back and finally quit the application. Android users use the back button a lot.”

Me: “Oh shit…..”

Being an iOS developer for the last 5 years, I did not take this into consideration! It was 10pm and our flight to Leh was in 8 hours, this was a show stopper but I didn’t want to do a quick fix. So it was decided, take the laptop to Leh.

Trip to Leh

It was a wonderful trip. Leh in March has its own charm. The frozen Pangong lake was not as beautiful as it would be in summer but we could walk on it. That was fun.
My schedule in Leh was a dream come true. I always wanted to freelance and travel. Entire Leh closes at 8pm in March and then I would open my Laptop. By the end of the trip which was filled with sightseeing and coding, apart from just solving the bug, I made a few enhancements too.  But there was no internet connectivity because landslides have snapped data cables.
The moment we arrived back in Delhi, I updated the app and checked the stats. The download count was 7. Though I didn’t expect a huge number, it was discouraging. Even 17 would have been better.

Our flight to Hyderabad was on the next day and Vaishu wanted to shop in Delhi. All through shopping, I was trying to solve the cube with my app but I never could memorise the third layer algorithms so had to pester Vaishu to guide me. It was then I got this idea to put the algorithms within the app. Instead of just making a general help, I decided to do a context sensitive help.
This feature took me two weeks to complete and it helped me learn all the third layer algorithms with ease. 

The downloads, instead of dying out as I had feared, were slowly climbing.  
By April 16th, a month after the release I had 66 downloads and by May 1st the number was 555 with a rating of 4.4.
Context sensitive help


minimised help




Kavindu Nuwandika

Among the majority 4- and 5- star ratings, there were 1- star ratings too. I couldn’t understand why. The app was surely better than 1- star.

All the 5- star ratings were accompanied by comments but none of the 1- star rating had any comment, leaving me confused. One day, as I periodically refreshed the developer console, there it was, a 1- star rating with a comment saying “its too slow and hard to control”. I did not understand. I got very angry. I had spent considerable time optimising the speed with which the cube rotates and this guy just trashed all the efforts. The name was Kavindu Nuwandika and I immediately searched for him in Facebook. Luckily, I could easily find him, the profile picture was same. I sent him a friend request introducing myself. A couple of hours later I got a notification saying Kavindu has accepted my friend request. He was a guy from Sri Lanka. Later that day I had a brief chat with him, but was still at loss to understand why he was finding it slow. I was testing on Galaxy S6 Edge+, iPhone 5S and iPad, if I increase the speed even a little more, it would go haywire! Resigning to the fact that I cannot please everyone, I was about to ignore Kavindu but then it struck me - dpi or dots per inch or rather pixel density. It is a measure of how many pixels are crammed into a square inch. It was important because when users move their finger on the screen, user perceivable distance is measured in inches but what I receive in my program is number of pixels moved. I immediately went back to the developer console and looked at the devices giving me 1 star rating, most of them had low dpi. I revived my very old cracked Nexus S and installed the app on it. Rotation was a pain. With one full swipe, the cube would just rotate a bit whereas in my high end phones, it would complete half a rotation. I cursed myself, and put in some code to compensate for the difference in dpi. Then the cube started obeying my finger even in the old Nexus S. I wrote a thank you message to Kavindu and updated the app. In the following days, the number of 1 stars almost vanished and the number of downloads were still on the rise giving me the boost to continue working on the app.

Learnings from other apps

There were many things I did not like in other Rubik Cube apps, most notable, the UI, inability to reset the cube and inability to checkpoint a particular state. Over the following days, I added all these features while making sure the transition from one version to another is smooth. For example, when I added leaderboards, player needs to sign into Game Center. I hate the pop up which comes up abruptly saying “Signing into google play” so I authorised the player only when the player choose to play LeaderBoard shuffle.

Nia Mikkili

Another friend, Nia pinged me and said she wanted to play 4x4x4 and I realised this was missing. I spent a week refactoring my code to accommodate any cube size. In the next update, I started offering 2x2x2, 3x3x3, 4x4x4 and 5x5x5. I can give more but was not sure if anyone would have the patience to solve a 7x7x7 on an app. I kept it on hold. It is ready but just waiting for someone to complete 5x5x5 first.



Monica Reddy

With all these features I was confident I made the best Rubik Cube app ever. I was receiving reviews increasing my confidence. But Monica, Vaishu’s cousin, gave me the next review, not on Google Play but on my face. “The background is too dull, black is so boring”, she said. I intentionally left the background black so that the attention would be on the cube. I would no way add a flashy colour. I decided to ignore her but then when I opened the app, I grudgingly realised that she was right. I never noticed, the background, it was dull, “like a void”, I told myself and this gave me an idea. “Why not add a star field?”, I thought. It would be subtle and yet cover up the void. With particle effects, I can even move the star field! It sure was an exciting idea.
That was my next update, a range of 3 particle effects and the classic void to choose from. The app got an entirely new look. I was happy. I sometimes just gaze at it :). The following images do little justice to the beautiful backgrounds but something is better than nothing!


Blue Magic background

Simple Starfield background

Pink Flower background


After this change, the number of reviews increased and all positive. 


Conclusion

We often love what we create and critic reviews hurt. If I had ignored the reviews, the negative reviews would have kept piling on and my audience would have been smaller or maybe even none, killing the app. But now whenever I get a rating, it is either a 4- or a 5- star.

I am not sure if I would get a million downloads, but now the number is 25000 and I have the satisfaction of creating the best ever Rubik Cube app.

Cheers :-)

No comments:

Post a Comment