Tuesday, December 20, 2011

Sample XiangQi (Chinese Chess) written with PlayN

Got a bit of time and start off writing a simple sample app of XiangQi (Chiness Chess in PlayN), following is a few screenshots of it.

Its a simple 2 player game, using simple json to transfer data between client and server running off servlet in GAE

I think PlayN is a framework with pretty good potential, just like any new framework it needs time to mature and settle in I guess. Too bad the apk generated doesn't run on an emulator, I'll need to find an actual device to try things out :-(

Picture 1
Picture 2



PlayN will not run in Android Emulator :-(

Tried deployed one of the simple game wrote using PlayN and was popped up with this
12-21 03:58:12.579: ERROR/AndroidRuntime(372): FATAL EXCEPTION: GLThread 10
12-21 03:58:12.579: ERROR/AndroidRuntime(372): java.lang.IllegalArgumentException: No configs match configSpec
12-21 03:58:12.579: ERROR/AndroidRuntime(372):     at android.opengl.GLSurfaceView$BaseConfigChooser.chooseConfig(GLSurfaceView.java:825)
12-21 03:58:12.579: ERROR/AndroidRuntime(372):     at android.opengl.GLSurfaceView$EglHelper.start(GLSurfaceView.java:981)
12-21 03:58:12.579: ERROR/AndroidRuntime(372):     at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1326)
12-21 03:58:12.579: ERROR/AndroidRuntime(372):     at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1180)
12-21 03:58:12.608: WARN/ActivityManager(75):   Force finishing activity com.tmjee.playn.xiangqi.android/.XiangqiActivity
12-21 03:58:12.618: WARN/WindowManager(75): Failure taking screenshot for (216x135) to layer 21030
Oh my god, looks like games written in PlayN cannot be tested in an emulator :-( looks like the emulator is not supporting the necessary OpenGL stuff .... Ouch !!! ....

Sunday, December 18, 2011

Nice article for implementing AI on games

Came across this nice little article about implementing AI in games basically chess-like games. Worth a read, so here it is.

Monday, December 12, 2011

XHR call results in browser doing an OPTIONS method request

This issue got me bugged for a while, XHR request when inspected in firebug seems to be sending out a HTTP OPTIONS method. If this happened to you, suggest the first thing to check is if the XHR is trying to do a cross-domain request, apparently 127.0.0.1 and localhost are being treated by my firefox as being cross-domain. I always thought cross-domain was not possible with XHR but apparently things changed and it is actually possible now (that's if you have control of the server you are trying to 'cross-domain' to) cause it involves sending bunch of Accept-* headers back. In a nut shell, the browser might sent an HTTP OPTION method request to find out if that piece of resource is allowed to be 'cross-domained'. Googleling gives me the followings

Sunday, December 4, 2011

mvn eclipse:eclipse failed to work

I found that

  mvn eclipse:eclipse
do not really work well when you've got multiple modules in your maven structure like PlayN, spitting out the following error
   Failed to execute goal org.apache.maven.plugins:maven-eclipse-plugin:2.8:eclipse (default-cli) on project playn-archetype 
Request to merge when 'filtering' is not identical. 
After some digging and trying out, it seems that specifying a specific version of maven-eclipse-plugin seems to make it happy, guessing maven gets confused when trying to resolve which maven-eclipse-plugin to use in the process. Anyway here's the one that works for me

   org.apache.maven.plugins
   maven-eclipse-plugin
   2.6