Tag Archives: network

Freebloks-1.5 for PC available

While I have frequently improved and updated the network compatible Android version of Freebloks, I have always neglected the Windows version. The Android version gained features like player names and the ability to choose the colors to play with. While the Windows and Android version always stayed compatible, the PC version simply did not offer these features to connecting Android devices or when connecting to a dedicated server.

Now Freebloks-1.5 for Windows is available, which lets connecting Android devices use all features and offers the player to choose his colours as well as to choose a name (which is not displayed in the game but on connected Android devices). If you frequently play Freebloks over the Internet, it is recommended to download the new version here:

isatapd package for android

I created and published an android app that bundles my ISATAP client daemon and provides a configuration front end. To run the binary on android, it requires root access, i.e. a rooted device or phone.

Screenshot_2013-09-26-10-41-13On my Galaxy S3 with Cyanogenmod 10.2 I successfully get a IPv6 address using the app. đŸ˜€

If you have a rooted phone and an ISATAP infrastructure close by, please feel free to give it a try:

The app is open source, with code being available on GitHub: https://github.com/shlusiak/isatapd-android

The source tree also contains a pre-compiled isatapd binary to be used in your own distribution or scripts.

Much improved AI speed for Freebloks for Android using jni

For the port of Freebloks 3D to Android I rewrote all code from C to Java. While that was working fine and resulted in greatly simplified networking code, the speed of the AI was not so great. It took up to 10 seconds on a fairly powerful SGS 2 for the computer to find a good move.

I was trying to move the CPU intense routines of the AI to C again, using jni as a bridge between Java and C. The simple network routines should stay in Java.

But the transfer of relevant game data to C and back to Java turned out to be very ugly, yet the solution was incredibly simple:

The Freebloks code was always split in two parts, the GUI/client part and the AI/server part, with the client and server always communicating using network sockets. Yes, even the single player version starts a network server and connects to localhost. The original source code always contained a package for running a dedicated server.

It was incredibly easy to copy the dedicated server code into my project, compile the C code with the NDK and connect it to Java with only a single jni call. It was running out of the box, with almost no change of the original C code at all! Since the server is running in a thread started from the native C code, there is no additional jni call neccessary and no data transfers except for the sockets.

The average duration for the AI to calculate a complete game dropped from 87 sec to 28 sec on my SGS 2. The version 0.0.2 in the Google Play Store supports ARMv5, ARMv7 and x86. Grab it now! You may also download a free apk file here.

And please don’t forget to give feedback.

Screenshot_2013-02-11-14-27-24

manually enabling deflate filter

Oh my, my webhoster has the deflate output filter disabled by default, that enables gzip compression of outgoing content. This is important for huge xml/json data from webservices that travel over mobile networks and easily reduces used bandwith to up to 10%.

Putting this in my .htaccess did the trick:

AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript

You can analyze the traffic with Wireshark, Firebug or use an online tool:

Make sure, your mobile app sets the Accept-Encoding of the request accordingly.

 

First playable version of Freebloks for Android

Freebloks-0.0.1_pre1.apk

I just pushed a first playable version of Freebloks for Android, a port of Freebloks 3D to the Android system. It’s a very early development version and very rough, but you can start a single player game and join a network game and place stones. The user interface still needs a lot of love, but I might push a preview version on Google Play soon. Please get involved on GitHub, if you want to contibute.

Here are two screenshots:

 

T-Mobile ate my EXIF-Headers

I was debugging my Frupic Android app the other day, trying to rotate images according to the orientation stored in their exif headers.

The necessary Android class ExifInterface(String filename) to read exif information from local files was quickly set up, but I couldn’t get it to report the correct orientation, it always returned ORIENTATION_UNDEFINED (0).

After debugging my code for a while on my physical device, double and triple checking on my PC that the file to be downloaded actually contained correct exif information, I found out that the file on the phone was about 2kb smaller than the file on the PC and on the server.

I knew my phone was downloading the file over my German T-Mobile data connection, believing that T-Mobile does not touch the files when requesting the image directly. I also knew that T-Mobile does replace image URLs in HTML files to be able to cache requested images on a server close by and I also knew they might compress them. I assumed, T-Mobile would not binarily alter a file if it is directly requested.

Browsing to http://speed.telekom.de (only available from within their mobile data network), customers are able to alter the behaviour of T-Mobile’s transparent HTTP proxy:

  • Compress Picture- and Video transfers (this reduces quality and filesize)
  • Optimize transfer without loss in quality
  • No optimazion

Default is to optimize the transfer without loss in quality, which apparently does remove all exif headers from downloaded images but is also told to remove comments from HTML code and doing other micro optimazion stuff.

While I can choose to enable exif headers for slightly more traffic, it’s clear that my Android App can not rely on the exif information being available, unless the images are downloaded over SSL. I guess I am just one of few who have actually hit this limitation and I do not mind it being there. Could have saved me a lot of debugging time though.

google.cn in IPv6 world

Google China recently added AAAA records to it’s domains:

# host www.google.cn
www.google.cn has address 209.85.148.160
www.google.cn has IPv6 address 2a00:1450:4001:c01::a0

Google China does not offer search results through google.cn anymore since March 2010, redirecting their users to google.com.hk, which does not have AAAA records enabled.

Fortunately maps.google.cn still is available, generating lots of IPv6 traffic:

# host maps.google.cn
maps.google.cn is an alias for ditu.google.cn.
ditu.google.cn has address 209.85.148.160
ditu.google.cn has IPv6 address 2a00:1450:4001:c01::a0

This gives hope for this year’s World IPv6 Launch Day, June 6th, 2012. đŸ™‚

Android App for HRW IT-Monitoring

Android App
HRW IT-Status in Google Play Store

Android is an interesting platform and it’s easy and fun to develop for. My first app is a very simple tool to query the IT-Monitoring state from the University of Ravensburg-Weingarten, as also available on their public website:

http://www.hs-weingarten.de/web/rechenzentrum/dienststatus

In the background, a complex Icinga installation provides the necessary data, making it available through a public XML interface.

The app is available in the Google Play Store (former Android Market)
https://play.google.com/store/apps/details?id=de.saschahlusiak.hrw.dienststatus

Source code is also available on GitHub:
https://github.com/shlusiak/HRW-Dienststatus

Homepage over IPv6

On June 8th, 2011 my webhoster participated on the World IPv6 day, making my homepage temporarily IPv6-enabled. Shortly after they went productive, so all my subdomains, the homepage, this blog and even the ftp have IPv6 records enabled by default.

www.saschahlusiak.de has address 80.67.17.142
www.saschahlusiak.de has IPv6 address 2a00:1158:0:300:8e72::1

Only the email servers don’t run IPv6 yet, but I’m sure that’ll come. Welcome to the future. đŸ™‚