Saturday, November 11, 2006

Multiplayer Boggle using Flash MX - WEBoggle!

I'm working on multiplayer version of Boggle game using Flash. This will allow players to play at the same time in real time.

For Boggle lovers, this is something to watch out for. Keep visiting my site for updates and look for WEBoggle ;-)

Actually, to avoid having issues I called my game Web Joggle!

Wednesday, November 08, 2006

Clownfish Games goin' multiplayer!

After spending few months of research and development, I finally finish the basic multiplayer engine for my website. Now, the new Clownfish Games website is up and running!

What's New?

- Added new chat panel so you can chat while playing.
- Disabled guest score posting to be fair with the registered players.
- Monthly featured players based on the highest score for the month.
- Monthly Top 50 Players to give chance to other players.

And more surprises and cool features coming soon...

Friday, November 03, 2006

JDBC/MySQL Communications link failure - SOLUTION

While working on my Java Game Server, I came across a frustrating error. The JDBC and MySQL connection will fail after 8hrs of being idle. Meaning after 8hrs, any succeeding connection request will throw an exception:

com.mysql.jdbc.CommunicationsException
Communications link failure due to underlying exception

I've been figuring out what's wrong so I tried searching the web for a work around or solution. Below are the possible solutions:

1. Increase the MySQL wait_timeout value (in seconds) to a ridiculously big value (Example: 1 year = 31,536,000 secs) in \etc\ my.cnf config.

2. Use JDBC connection polling. There are lots of free code availabe on the net. Go google ;-)

http://pdf.coreservlets.com/CSAJSP-Chapter18.pdf

3. My simple solution is to register the driver whenever you need to get the connection and unregister after using it. You also need to create a thread to keep the connection alive every hour.

I believe it will be clearer if I'll post my code here:

class ConnectionKeepAlive extends Thread
{
private Database m_database;

ConnectionKeepAlive(Database database)
{
this.m_database = database;
}

public void run()
{
while(true)
{
try
{
sleep(Constants.TIME_ONE_HOUR);
}
catch(InterruptedException ie) {}

m_database.connectionKeepAlive();
}
}
}

//==============

public class Database{

ConnectionKeepAlive m_keepAlive = null;
ConnectionPool m_connectionPool = null;

Database()
{
try
{ m_connectionPool = new ConnectionPool(Constants.JDBC_MYSQL_DRIVER, Constants.JDBC_MYSQL_URL,
Constants.JDBC_MYSQL_USERNAME,
Constants.JDBC_MYSQL_PASSWORD,
Constants.JDBC_MIN_POOL_SIZE,
Constants.JDBC_MAX_POOL_SIZE,
true);
}
catch(Exception e)
{
System.exit(1);
}

m_keepAlive = new ConnectionKeepAlive(this);
m_keepAlive.start();
}

public synchronized Connection getConnection() throws SQLException
{
return m_connectionPool.getConnection();
}

public synchronized void connectionKeepAlive()
{
Statement statement = null;
Connection conn = null;
String query = "";

try
{
conn = getConnection();
statement = conn.createStatement();

query = "SELECT CURRENT_DATE()";
}
catch(Exception e) { }
finally
{
try
{
if (statement != null)
{
statement.close();
}

if (conn != null)
{
m_connectionPool.free(conn);
conn.close();
}
}
catch(Exception e) { }
}
}
}


Disclaimer: Use at your own RISK. I am NOT responsible for any damage that this code will cause in your PC. Good luck ;-)

Wednesday, November 01, 2006

Now it's official!

I took me a while to think of a good name for my mascot. And while typing this, I realize that I should give him a very simple name.

Finally, it's official, I'm going to call him... Mr. Clownfish!

So what is Clownfish Games?

Clownfish Games is a 'personally owned' website. It is a place to play free online multiplayer games, chat and make new friends. Apart from having simple but elegant, fast-loading games, it has a remarkable key feature: 100% FREE TO PLAY!

http://www.clownfishgames.com

This domain name was inpired by Pixar's movie - Nemo! I want something cute and fun mascot on my website so I came up with a 'clownfish' idea. My friend created the clownfish mascot using 3DSmax, Photoshop and Flash and it turned out great.