Monday, October 29, 2007

Apple and Java 6 - I am not getting a MacBook Pro

I am looking to replace an old laptop and get myself a brand new development machine. At first it seemed a no-brainer:

"I'll just get one of those oh-so pretty MacBook Pros"

My wife has owned an iBook for around 2 years. She even paid the money to update to OSX Tiger, and bough the .Mac yearly subscription for the 3rd time now. So despite a few issues she is clearly quite happy with her Mac and continues to throw money at Apple.
Until recently I thought I'd get an apple as well but I changed my mind very quickly in the light of recent events and after a bit of investigation.

So here is why I will not be getting a Mac:

1. I am a Java developer (one of about 5 million apparently) and there is no Java 6 on OSX, not even in Leopard

That's it.

I guess I could buy the MacBook Pro and run Linux (which I've been running so far on my Toshiba Tecra), but for the money I can get better hardware elsewhere. The value for me is in having a MacBook AND OSX. If OSX is out due to lack of Java support, the deal is off.

I'll not make an actual purchase for about 3 months and perhaps in that time Steve will come to his senses and change the company attitude towards Java developers and users in general. And now BEHOLD as I will conclude this blog with a poem of my own making.

Again old saying seems to hold
That all that glitters is not gold
With OSX less Java 6
I'd lose my job, start turning tricks
Apple needs to listen well
Else I'll end up with a Dell

Monday, October 22, 2007

BattleBlocks released ...

Most excellent news :)

Last night we released BattleBlocks (our Tetris clone) and let me tell you, I've spent lots of time "testing" the game :) Even though I didn't write that one (James O'Connor wrote BattleBlocks for us) it is my all time favorite Cotopia game. It is that much more embarrassing that Tomas beat me twice last night and I didn't get a point on him... awell, maybe next time.

In addition to BattleBlocks we also pushed out new versions of all existing games with additional features so check it out ASAP.

- Forum posts have dates attached
- Better in game chat screen
- Can send SMS invites to friends straight from main menu
- Blocking of empty chat messages

Just go to http://cotopia.mobi on your phone, download all the games, and let us know what you think. Many of the changes in this release were based on community comments.

Wednesday, October 17, 2007

11000 players

We celebrate!
So far we have 11000 players. I think that's great, but we want more. If you know about any portal, which could add our games to their catalog, please let us know.

With a little luck, we will be able to announce partnership with a major portal from India soon, so stay tuned.

Other info:
You can read our blog directly from your phone at the address http://cotopia.wirenode.mobi
You can make your own mobile blog and portal at www.wirenode.com. It's very easy, try it!

Saturday, October 13, 2007

EJB3 TimerService spec needs fixing

We've gotten many complaints about our scoring bug: people just leave the game (which they are presumably losing) time-out and do NOT lose any points ... how can this be?

It shouldn't happen and the issue has been fixed.

The error was in a little code of "silly logic" which would create clearner timers but then also kill them before they got a chance to run, the issue was thread related (as usual). How I fixed it?
(Read on if you care about the technical details of the bug in our Java EE system)

Using TimerService we have set up two timers in the EJB3 session beans that manage game creation (matching opponents etc.) and game play (including scoring). These timers execute the @Timeout methods every few seconds to make sure people get their points and there are no stale old games sitting around:


@Stateless
public class GameManagerBean implements GameManagerRemote, GameManagerLocal {

   @Timeout
   private void cleanUnmatchedGames(Timer t) {
     ... clean unmatched abandoned games
   }

   public void startGameCleanerTimer() {
     this.stopGameCleanerTimer();
     this.timerService.createTimer(PERIOD_MS, PERIOD_MS, GAME_TIMER_ID);
   }

   public void stopGameCleanerTimer() {
     for (Iterator it = this.timerService.getTimers().iterator(); it.hasNext();) {
       Timer timer = (Timer) it.next();
       if (timer.getInfo().equals(GAME_TIMER_ID)) {
         timer.cancel();
       }
     }
   }

}

@Stateless
public class PlayManagerBean implements PlayManagerRemote, PlayManagerLocal {

   @Timeout
   private void cleanTimedOutGames(Timer t) {
     ... clean games where one player timed-out or left
   }

   public void startPlayCleanerTimer() {
     this.stopGameCleanerTimer();
     this.timerService.createTimer(PERIOD_MS, PERIOD_MS, PLAY_TIMER_ID);
   }

   public void stopPlayCleanerTimer() {
     for (Iterator it = this.timerService.getTimers().iterator(); it.hasNext();) {
       Timer timer = (Timer) it.next();
       if (timer.getInfo().equals(PLAY_TIMER_ID)) {
         timer.cancel();
       }
     }
   }

}


To be certain that the above @Timeout methods are called by a single timer at regular intervals we have to make sure that one and only one timer of each kind is alive at any one time. Timers are persistent (survive server crash or shutdown) which can be nice but it can also be a pain since it means that if you start a timer every-time your server starts you'll be accumulating them. To make sure that we create timers once per server startup and delete them on server shutdown I put the code into servlet life-cycle methods.


public class MobileServiceServlet extends HttpServlet {
   public void init() throws ServletException {
     this.gameManagerBean.startGameCleanerTimer();
     this.playManagerBean.startPlayCleanerTimer();
   }

   public void destroy() {
     this.gameManagerBean.stopGameCleanerTimer();
     this.playManagerBean.stopPlayCleanerTimer();
   }
}


You may have noticed that to ensure that only one timer of a kind is alive at a time the startGameCleanerTimer() and startPlayCleanerTimer()methods also delete any old timers which may be around due to server crash. Just to be on a safe side.

All these code gymnastics just to make sure that we aren't starting multiple timers, I hope that the next Java EE spec will include some "on deployment" related features so that this is no longer necessary.

Sunday, October 07, 2007

Scoring fixed

As some of you may have already noticed, we've deployed a new version of Cotopia server, this means that once you accept a game you cannot chicken out without losing or gaining points :)
I am sure that there will be quite a few people happy about this. Soon to follow will be the new MIDlets so keep an eye out for further announcements.

Monday, October 01, 2007

A quick update

Just like I promised in a previous blog entry, I've been working on BattleBlocks and I have a stable version ready .. well stable enough not to break the emulator :) So the time-frame we're looking at for releasing the new version of Cotopia (including all the promised fixes) is about 2 weeks from today.

I am pretty happy about the new release because it seems that many of our naughtier players have been abusing the scoring bug. You know who you are .. rest assured that a fix is coming and the points gained by cheating will be quickly lost if you don't have the skill to back them up :)

In semi-related news, we may be getting more players from India in the near future, I hear a lot of good chess players come from there so brace your selves ...

Friday, September 28, 2007

A small victory for Netbeans Game Builder

I scored myself a cool iPod Nano by demoing NetBeans 6.0 Game Builder :)

The story is as follows:

While working on Cotopia I've realized that the tools available to game developers are pretty limited in the Mobile Java area. There were some attempts at Game API support in an older Nokia toolset, but overall the tools were either pretty crappy or didn't integrate with MIDP API easily enough.

In the beautiful world of open source there was nothing more natural than to write a tool for myself - a NetBeans Mobility Pack plugin called "Game Builder". It is part of NetBeans 6.0 Beta 1 which you can download from here:

http://www.netbeans.org/community/releases/60/index.html

and here are some screen-shots of how the tool works:

http://wiki.netbeans.info/wiki/view/CreatingJavaMEGamesWithGameBuilder

Local Sydney JUG (Java User Group) had a "Lightning Talks" event during which around a dozen speakers had 5 minutes to talk about a Java related subject, then audience voted for their favorite talk. There aew some pretty cool prizes available to the top 3 speakers (some donated by another cool open source company - Atlassian, some by JetBrains, and some usual give-away stuff from Sun). The main prize (in my eyes) was Apple TV, then there were 3 IntelliJ Idea licenses, and iPod Nano.

I didn't get the first place - that was taken by a presented who (i swear) must be a stand-up comedian :) and he without hesitation chose the Apple TV. I got 2nd place (must work on being more funny dammit) and I chose the iPod, I did think about the Idea licenses for a bit but NetBeans 6.0 is just getting so good that I probably wouldn't make much use of them.

It is my hope that soon I'll be able to use Game Builder to create a bigger and better multiplayer game (RPG style) for Cotopia and take our community to the next level.

Casual Gaming Party

I have been invited to casual gaming party to San Francisco Minna Mingle. It was very good event and I have met many great people. Basically everyone from casual gaming industry was there.

Silicon Valley have real advantage, that things are happening here every day. Different conferences, events, parties ...

Monday, September 10, 2007

Attending the TechCrunch20/40 conference

I will be attending TechCrunch20 (now renamed to TechCrunch40) conference in San Francisco this September 17-18.
I also plan to stay for some time in San Francisco (about 4 weeks). If you are there during that time and would like to meet, please contact me at tom@cotopia.com

What's coming up...

Over the past few weeks we've gotten a number of requests to fix bugs and to introduce (in some cases even re-introduce) features. Rest assured - work is under way to bring the functionality players have been asking for.

Here is a list of features that will make it into the next release which will be pushed out together with Battle Blocks:

1. Private games will be back (enable players to search for opponent by name)
2. Ability to access Cotopia WAP directly from main game menu
3. Updated help texts
4. Add date and time to forum posts
5. Ability to send an SMS to your friend with a link to a free Cotopia game download straight from the main menu
6. When searching for an opponent phone will vibrate and display will flash once opponent is found
7. During game play empty chat messages will be ignored
8. Fix for a much hated bug in our scoring system - if you know what it is you'll be happy to see it go away, if not - don't worry about it :)

As I've said before: let us know what you want. Most of the items in the list above are the result of requests from our players. If you find something you hate about our games or think up something you'd really like send us an email or an SMS.