DROID CARDS
We Publish Kids Card Games for Droid Phones

Friday, August 13, 2010

Briscola Free now available

Three weeks ago I released Briscola Free and it now has more than 1000 downloads (yeah!).

Thanks to goapk.com for Chinese translations - the game is available on their website as well (http://market.goapk.com/application.php?s=1829). Now game localizations include Italian and Chinese (simplified and traditional).

The game is ad based. After trying some ad services I settled on Millennial Media for now (http://developer.millennialmedia.com/).

Enjoy :)

Wednesday, May 19, 2010

Lose Your Sock upgrade and new Italian version Ruba Mazzetto

I finally was able to release the upgrade to Lose Your Socks. Now you can play in landscape as well as on portrait mode. Also I did some enhancements ...okay I fixed some bugs and now it's all rock solid! I also have the Italian version with the original title "Ruba Mazzetto". Unfortunately I couldn't do it in "Lose Your Socks" with the localization strings, because I had to change the graphics and also I wanted to be recognized by its real Italian name. In my next game, which is all American I will use the localization. In fact, I am working on a new game of cards for kids, available in the next few weeks...time is the essence :)

In Droid Cards we like to give some geeky details, always in the spirit to give back to the community out there.

For the change of orientation:
I don't allow the application to be restarted by the OS. Instead I add this line to the manifest.xml file within my activity tag:
android:configChanges="keyboardHidden|orientation"
This allows for a callback when the device's keypad is open or in any change in screen orientation.
In my activity code, I override the callback:
@Override
public void onConfigurationChanged (Configuration newConfig)
{
//I keep track of the orientation with a member variable,
if(orientation != newConfig.orientation)
{
setContentView(R.layout.main);
game.changeOrientation(newConfig.orientation);
}
orientation = newConfig.orientation;
super.onConfigurationChanged(newConfig);
}
In this way in the changeOrientation function I have to redo only the layout for the new orientation, but I don't need to store any settings or game values because the app never quits.

Other point, I changed the Help and About Buttons to be Dialog boxes instead of lame views (yes, they were lame and they created issues). Actually I wanted to create a Custom Dialog without a title box and with a different font size and color. But I wanted the functionality of the AlertDialog. So as described on http://developer.android.com/guide/topics/ui/dialogs.html I use the LayoutInflater and expanded my Custom view. But I didn't want to have buttons and I wanted the user to be able to click on the dialog to dismiss it.

private void displayAboutDialog() {
final AlertDialog.Builder builder;
final AlertDialog alertDialog;

LayoutInflater inflater = (LayoutInflater)this.getSystemService(LAYOUT_INFLATER_SERVICE);
View layout = inflater.inflate(R.layout.aboutdialog,(ViewGroup)findViewById(R.id.ScrollViewAboutDialog));
//save a pointer to the the relative layout inside the scroll view
View aboutview = (View)layout.findViewById(R.id.RRlayoutAboutDialog);
//then create
builder = new AlertDialog.Builder(this);
builder.setView(layout);
alertDialog = builder.create();
//now set the listener
aboutview.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View v) {
// TODO Auto-generated method stub
alertDialog.dismiss();
}
});
alertDialog.show();
}
I hope this will be useful to you. Any comments will be greatly appreciated.

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:

@Override
public void onWindowFocusChanged(boolean hasFocus) {
if (hasFocus) {
// we have the focus again
game.calculatePositions();
game.layoutCards();
}
super.onWindowFocusChanged(hasFocus);
}

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.

@Override
protected void onSaveInstanceState(Bundle outState) {
game.storeState(outState);
super.onSaveInstanceState(outState);
}

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
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!

Wednesday, February 24, 2010

New Card Game for Kids! LOSE YOUR SOCKS

Hi Kids,
I have a new game for your Droid phone. It's called "Lose your socks". It's based on the popular Italian game "Ruba Mazzetto" or "Cava Camicia", which means "Lose your shirt" and it is similar to "War".
It has special graphics for splash, win and lose screens.
The graphics go to the rhythm of beautiful music composed by Lars Hidde from Rivery Sound Studios.
The menu allows to start a new game or change sound settings with several sound options.
Download it now on your Droid phone from Google Android Market and try it out!

How to Play:
The objective of the game is to win all the cards.
Each player takes a turn placing a card on the table until one of the players puts down a card with number 1, 2 or 3.
In this case, the opponent has to put down 1, 2 cards according to the value of the special card. The player that played the special card wins the whole pile.
This rule changes if the opponent responds with a special card as well. In this case the opponent does not have to put down more cards and it is the other player's turn to put down 1, 2 or 3 cards.
The game ends when one of the players gets all the cards.