Saturday, June 23, 2012

What's wrong with Search in Google Play

What's wrong with the search in Google Play ?

Yesterday, I was looking for something in my sliding tile puzzle called 'Nature Puzzle'.
So I opened Google Play website, and started with a search for 'Nature Puzzle'.

Here is the result :












We have :
* Photo Puzzle Game, NumberPuzzle,
* Nature Puzzles,
* Nature Puzzle,
* Natural Seasons,
* Zoo and Nature Puzzle 2 in 1
* kids Puzzle:Animal

and my game is not listed !

What I don't understand is that I gave the exact name, and I didn't find it !
I looked at the last app (kids Puzzle Animal ) more closely, and there is only 1 occurence of 'natural' in the description.
And the application called 'Nature Puzzle' ( so with the exact same name as mine ), it has the same rating, and less downloads.

Note that
* I'm not complaining here that my application does not have enough visibility : I only published it as a proof of concept of Html5 android applications
* I'm not asking the description of the search algorithms in the Google Play Store !

I'm just amazed that, from a customer point of view, giving the exact name of an application does not bring this application to the top !


Actually, if I specify that I want to search only in Android apps, then my game appears at the 7th rank :


















I even discovered another application named 'Nature Puzzle' ( it now sounds like a very common name ), that is even more badly ranked than mine !


Am I the only one to found it strange ?
Do you feel like there are some reasons, for the customer, not to put the application with the exact name first in the search results ?
Do you understand how the ranking is done ?

Sunday, May 13, 2012

Ghost Recon Future Soldier

It's been a long time since my last update on this blog.

Actually, my Android's developments are only hobby projects. My real job is working on console video games.
 And we've just finished Ghost Recon Future Soldier !
I was very busy finishing the game, so I couldn't really post any more.




But the game is now done, I am really proud of it, the whole team has done an amazing job, so I will now be able to return to more Android developments !

During this time, I could port my 'Word Prospector' game on the Blackberry Playbook, and I started a new project.
More on all this later :)
Now I just want to enjoy the Ghost Recon Future Soldier launch.




Monday, August 8, 2011

Orientation for both phones and tablets

Tablets are now a new component to take into account when programming applications on Android.
And it brings issues with your application orientation...

My game Word Prospector was meant to be played in portrait mode on a phone.
But on tablets, I want it to be played in landscape ( as it feels more natural for tablets ).

But how to achieve that ?

Activity orientation is fixed in the manifest, and you can't have different manifests for different screen configurations.

So how to manage that ?
I found three different ways...

First solution : different apk for different screen configurations

Now that the Android market gives us support for multiple apk, ( see here ), you can use it just to have some differences in the manifest.
So you can have the very same application and only have different orientations in the manifest, and let the market make the work for you.

But having several apk is painful for developers : it's a lot of work to develop, and to maintain.
So I would  not recommend this solution.

Second Solution : have some activity code to manage the orientation

You can impose the orientation of your activity in the onCreate method of the activity, with the setRequestedOrientation( ActivityInfo.SCREEN_ORIENTATION_XXX ) function.

So you can have some code like this :
if ( isXLargeScreen() )
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
else
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

With this code, when there is an orientation change, the activity is destroyed, then re created.
To avoid this destruction / recreation step, that would break the smoothness of the user experience, you have to disconnect the destruction of the activity mechanism.
So you have to add a
android:configChanges="keyboardHidden|orientation"
parameter in the activity declaration in the manifest, and add an empty onConfigurationChanged method.

Now you can even be more flexible.
If you want one configuration ( for instance the tablet one ) to handle both orientation, and the other ( the smartphone ) to handle only one orientation, you can do it :

In the OnCreate method, impose the orientation only for the smartphone :
if ( ! isXLargeScreen() )
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

Then in the onConfigurationChanged, you have to recreate the Activity only when on tablet. And in this case, you have to save the activty state, and restore it, as the classic destruction / creation of the activity is deactivated :

    public void onConfigurationChanged (Configuration newConfig)
    {
        //Log.d("tag", "config changed");
        super.onConfigurationChanged(newConfig);

        if ( ! isXLargeScreen() )
            return;
      
        // CODE FOR ROTATION
        // FOR BIGSCREENS :
        SaveActivityState();
        setContentView( R.layout.MyActivity );
        RestoreActivityState();
    }

Third solution : let's get back to the manifest...

The manifest really is the tool Android developers gave us to handle the orientation...
So my last ( and prefered ) solution is to have two different activities, with different orientation capacities :

        <activity     android:name="LetterGame"
                    android:screenOrientation="portrait"
                    android:configChanges="keyboardHidden|orientation"
                      android:label="@string/app_name">
        </activity>
        <activity     android:name="LetterGameLandscape"
                    android:configChanges="keyboardHidden|orientation"
                    android:screenOrientation="landscape"
                      android:label="@string/app_name">
        </activity>


and to create a MyActivityLandscape class, that just do ... nothing !
It just inherits from MyActivity :

package com.alocaly.LetterGame;

public class MyActivityLandscape extends MyActivity
{
}

Then you just have to choose what activity to launch in the caller activity :

Intent i;
if ( isXLargeScreen() )
    i = new Intent(MainMenu.this, MyActivityLandscape.class);
else
    i = new Intent(MainMenu.this, MyActivity.class);
startActivity( i );

And that's it !!
The onConfigurationChanged function should still be empty, or you can specialize it for your second activity.

Do you see another technique to handle different orientations with different devices ?


And my turn to ask a question :
How can we easily implement an isXLargeScreen method ? ( my current implementation is something I'm really proud of :) )




Thursday, June 2, 2011

An Android Application in HTML5

Hi all,


After my Blackberry / Html5 pause ( see here ) , I decided to port the games I made in Html5 on android.
So the first one is there now : it's called Nature Puzzle, and it's a simple sliding puzzle.

I will soon write another post on this development on android with Html5, but at least, it's here and feasible.
And if some people are interested, I will perhaps open source this simple game...

Although it's a very simple game, the pieces move is not totally smooth on my G1, but on my Nexus One, it's nice.
I will soon try the second blackberry game I made, that was more demanding...



Here is the link
Nature Puzzle on Android Market

And some screenshots :


Sunday, April 17, 2011

The blackberry pause

I have to confess it : I made a small pause in my Android development.
During one month, I developped for the Blackberry Playbook, and it was a rather pleasant experience !

Actually, it started when I read this blog entry from James Becwar.
Blackberry offered a free Blackberry Playbook ( their incoming tablet ) if you developped a application for it.
This was a very tempting offer, so I decided to jump into this challenge !

The challenge :

Actually, the challenge was that I read this blog entry on the 26th of February, and you had to submit your application before the 15th of March...
I only had about 15 days to learn a new language, a new platform, a new submission process, and to develop my application.
All that, while still having to manage my real job, my kids, my wife, my friends...

On top of this, a friend proposed me at the very same time to play a 'Neptune's Pride' play. "Neptune's pride" is a nice strategy online game, that played over 2 to 3 weeks. The things is when the game starts, you only have 4 units, so everyday it takes about 10 minutes to play. But the game quickly becomes more challenging, and more time consuming. Way too much for me ! But I couldn't make myself reasonable, and give up. So I played until the end ( I even won the match :) ! ).

Developping for the Blackberry Playbook :

So I decided to start to develop for the Playbook.
There are two ways one can develop for the playbook :
- Using Adobe Air
- Using Html5

I decided to go the Html5 way : it is free ( I could use an evaluation version for Adobe Air, but I prefer to learn something that  I will use as much as I want ), and I feel like learning Html5 can always be a good thing, for my work, for my android development, for some personal Web develpment, etc...

The tools to develop for the Playbook :

The playbook comes with an SDK, and an emulator that really is a virtual Machine running under VmWare.

Considering the short time I had to develop my application, I decided to stay as far away as possible from the device specific issues, so I decided to choose an application as simple as possible, and that I could develop as much as possible with Chrome.
So I didn't wanted to write files, to use the camera, to use the GPS, or anything like that.
I just wanted to develop in Chrome, and check every day that my development was still working in the emulator.

So the application I chose to develop that a simple sliding puzzle ( also called the 15 puzzle ). Nothing really exciting, but something I really could finish in such a small amount of time.

Developping in Html5

So I started developping in Html5, with Chrome.

Html5 is some Html, css, and javascript.
In my, case, I just took a canvas ( ie a part of the Html page ), and entirely control it in Javascript, from the event response to the display.
So I didn't use the Css at all, I merely used the Html part to create the canvas. So quite all of my development were in javascript.

And to be honest, I was really impressed by this way of developping.
The 'iteration Cycle' - ie the time it takes to make a change in your code, and to check its effects in your application - is really low : you modify your javascript code, and just press F5 in your chrome browser, and voila ! It's done...
It's much better than developping for Android, where the installation phase on the emulator or the real device, and even the compilation phase, for a big application, takes some time.

Chrome contains a full debugger, so tracing a bug is quite easy, and you can even hot change the code !
It also contains some profiling tools, and some tools to monitor the memory usage.
Actually, I was impressed by all the stuff that were in chrome. I only had used it as a (fast) browser, and now I found it was also a valuable develoment environment !!

Obviously, everything is not that easy in the Html5 development world :

Javascript is a strange language:
* not really object ( there is no real inheritance ),
* Actually even creating an object is an strange thing : you create it as a special function !
* sometimes Javascript is not strict enough : if you forget to define a variable as a new one, local to your function ( with the 'var' keyword ), it will use whatever var with the same name it can find in the namespace ( like a global one, or worth, one coming from a caller function ), creating some strange bugs...
* the counterpart of all this strangeness is that javascript is a very flexible langage, so can do crazy things like modifying some methods of an instance of an object at runtime. ( at least for a C++ developper, this is a very crazy thing )
* Chrome optimizes the javascript code, so sometimes, it's hard to debug : the code won't stop at some lines that are actually really executed !
* Chrome is a real development environment, but I still prefer my Visual Studio environment !!!


Developping for the Playbook added some specificities :
* For some reasons, I wanted to use more html5 feature than just using my canvas, and failed. Something as simple as calling specific javascript code with clicking a link didn't work. I didn't investigate, and just put everything in my canvas !
* A lot of features just didn't work, in the real device or in the emulator ( and I don't feel like releasing something without any test ) : sound, videos, orientation support, ...
* The event for managing the touchscreen are a little different from the events for managing the mouse. Nothing really big, but enough to bring me some bugs...


Conclusion :

All in all I was really happy with these development. Actually I manage to create my application in 15 days. At this time, the limit had been postponed to the 31th of March, so I ended up developping another application ( to be honest, I was a little ashamed to only deliver such a simple application as a sliding puzzle ), so I created a coloring game for child, in the next 15 days.

I enjoyed doing these two developments, and could finished them by the deadline.

Some time ago, with some friends from work, we made a kind of context where we were to create a little game prototype during our launch pause. So we only had 1 hour and half to create this prototype.
Actually, I like the idea of developping something as fast as possible.

I would like to do it again, all by myself : to give me the constraint to create a little game in 15 days ( or at least a good prototype ). I always found that some good things were coming from this challenges.

As for the result application, they are some applications I still can be proud of. 
Actually, my older kid likes the sliding game, and both my kids like the coloring game. This is, in my opinion, a really good sign !!!

Now, as this is essentially a Android blog, let's talk a little about more robotic things.
Now that I have two Html5 applications, I will try to port them to Android, and check how easy it it.
Actually, I would like to check if developping directly in Html5 is a viable option for Android, but I really have some big hopes in this area !!


Here are the applications :

The coloring game :




 The sliding puzzle :




































And here are the link to the application for the Blacberry owners that are lost on this Android development blog :