We Publish Kids Card Games for Droid Phones

Saturday, April 24, 2010

Briscola 1.0 now on Android Market!

I finished Briscola 1.0 today and it is available on Android Market. For those not familiar with Briscola, it is one of the most popular Italian card games and is played with the Italian deck of 40 cards. It is a really fun game that combines luck and skill. At the start of the game a trump card is selected (the briscola card). Each trick is won by the highest briscola card played. If no briscola is played, then the highest card of the leading suit wins. Unlike hearts, you do not have to follow suit.

In Italy each region has its own deck of cards with wonderful and sometimes intricate images. For this game I created simple images for the cards that are easy to read on small device screens.

Some geeky details :)

So this is my first android application and it was really fun to write. It took about 3 weekends of work (and some evenings in between). The android development environment is very nice :)

The graphics for the cards are very simple (I am not a graphic artist). I used the free Paintbrush program for the mac (http://sourceforge.net/projects/paintbrush/) to produce the png's for the application. For the next version I will have more professional graphics produced by a third party.

I wanted this game to be available on Android 1.5 (example the Motorola Cliq), so I built the application using minimum SDK version 3. Unlike other card games I've seen, I wanted mine to support both portrait and landscape modes, so I handled the onWindowFocusChanged method to recalculate the positions of the cards and lay them out again. Here is a snippet of my code:

public void onWindowFocusChanged(boolean hasFocus) {
if (hasFocus) {
// we have the focus again

I also found that android is very willing to swap out the application whenever it sees fit, but by handling the onSaveInstanceState and onCreate methods and bundles, I didn't need to handle any of the (several) android activity state transitions. Also the game object only keeps data (i.e. card values and positions), never any pointers to android objects. This way the game can come and go and still refresh itself nicely. The android objects such as views are obtained on the fly with findViewById calls and never kept around in my code.

protected void onSaveInstanceState(Bundle outState) {

public void onCreate(Bundle savedInstanceState) {
handler = new Handler();
layout = (RelativeLayout) findViewById(R.id.RLayout);
if (savedInstanceState == null) {
game = new Game(true, true, false);
} else {
game = new Game(savedInstanceState);

Android localization support is very easy - just make sure all the strings are in strings.xml for the appropriate language. I coded this application from the start to support English and Italian.

Next steps:

* Support android 1.6
The graphics don't look that great on high definition devices (at least in the emulators), so I want to create an update with all 3 flavors of graphic images, hdpi, mdpi and ldpi, and have them made more professionally :)

* Improve the opponent logic
The opponent (computer) is currently an intermediate level player that does not remember which cards have been played. I want to add more intelligence to make the game more challenging :)

* Add option to play in couples
Briscola is very fun to play in teams, so I want to add this possibility on the phone without going yet to an online version.

* Other
Hopefully I'll get some (positive) feedback and will make improvements that people will enjoy :)

Thanks to Francesca Zonin and Alice Zorzan for their help in the Italian translations.

Buon Divertimento!

No comments:

Post a Comment