Today i got the contract for book deal from APress. In order to get my royalties and don’t have them taxed twice (one by the US gov. and once by the Austrian Gov.). This is governed by so called income tax treaties between the US and foreign countries like Austria. I had to go on a hunt of forms and articles. To make a (very) long story short here’s what you do if you are not a US citizen and sign a deal with a US publisher:

  • Get form W7 from the IRS. This form is issued so that the IRS hands you a so called ITIN (Individual Tax Identification Number).
  • Go to the IRS homepage and find the income tax treaty between the US and your respective country. Scan the treaty for an article on royalties. In my case (Austria) this was article 12
  • Check the box labeled a) in the W7 form and fill out the rest of the form accordingly (name, address).
  • Check the box labeled h) in the W7 form and fill in “Exception #2″
  • In the “additional information for a) and f)” fields specify your country and the article number
  • Now put that filled out and signed form in an envelop along with a copy of your driver’s license or passport as well as a copy of the signed contract with the publisher and send it to the IRS (the address can be found in the instruction section of the W7 form
  • Wait for the IRS to send you your ITIN which should take between 4 and 6 weeks
  • Having received your ITIN go search for the W8BEN form.
  • Fill it out according to the instructions and specify your ITIN
  • Send the W8BEN form to your publisher!
  • Write the freakin book
  • Profit!

Note: IANAL, so take that with a grain of salt. You might search for the terms “W8BEN W7″ on google to find the MIT Press page describing the process. With my luck i of course only found this page AFTER i solved this puzzle myself….

Good times!

  • Share/Bookmark
 

Splodey!

Mark Neil was one of the first people to use libgdx and its box2D wrapper earlier this year. He developed an original Android game called Splodey and is now preparing to release it to the market. Go checkout his site at http://www.pointergames.com/ to find out more about Mark’s company and games.

  • Share/Bookmark
 

Help Me Write a Book!

I just finished writting the proposal for the APress book “Beginning Android Game Programming”. This includes the full detailed Table of Contents. I would love the get feedback from you people out there on the contents of the book. You can find the table of contents at http://www.file-pasta.com/file/0/toc.pdf.

What i want from you:

  • What do you think of the structure of the toc?
  • Is there anything missing for a beginner’s book?
  • Is there anything you’d like to see added?

I will send this proposal to Apress tomorrow evening. Maybe i’ll wait till tuesday evening if i get a lot of feedback to integrate. Thanks for any replies!

  • Share/Bookmark
 

Long time no see!

It’s been quiet a while since i last posted on this blog. I’m having constant stress doing a lot of stuff and don’t find my inner zen at the moment to sit down and do anything Android or game development related. So here’s a roundup of what i’ve been up to.

I’m currently working on something very interesting at work which i’ll try to explain in as little text as possible: Given free form text (e.g. a news article) we in the information extraction community want to extract useful data from it. Examples would be instances of locations, organisations or persons which we call named entities. There’s two ways to find such named entities: via a statistical machine learning approach or via a set of rules. The machine learning approach is (mostly) awesome if you happen to have a shitload of ground truth data (text with the named entities marked by a human annotator for example) to learn from. The rule-based approach is tedious to work with and it’s quiet easy to come up with a mess of rules with all kinds of silly side-effects. It allows you to bootstrap your statistical learners though and thus they are still very useful. Both types of extraction system output something called annotations, which are basically segments within a text that encode some information like the name of a person. Other annotation types could be more fundamental, like tokens which mark every word in a text and denote some features of that words, like their part of speech tag and so on.

Now, there’s two ways to write a rule-based information extractor: the hard and the harder way. The harder way means coming up with certain patterns you want to match and create annotations from, e.g. “(TITLE)? (GIVEN_NAME)? SURNAME”, a very simplistic pattern which will not work like this in the real world :p. Once you formulated your patterns on paper you continue by writting them out as a form of hand-written regular expression matcher which operates on annotations instead of characters. Yes, very confusing. The thing is that writting those matchers by hand sucks. For character matching with have our beloved and funny looking regular expressions which express the patterns to be matched in a very concise way. Why not create a regular expression matcher for annotations?

Indeed that’s what others have thought before and they came up with things like the Java Annotation Pattern Engine (Jape) which is part of Gate or Sprout by the DfKI. The former is open source but highly coupled to the Gate internals. The later offers academic licenses for free but has a cost attached to it when you want to use it in a commercial project.

So what will any good engineer do in this case? Fucking reinvent the wheel! My task in the near future will be to implement a backend independant version of Jape, completely open source with no strings attached that one can use in his own information extraction framework. The parsing and creation of the AST is actually already complete (that part only took a few hours today) so i’m left with implementing the actual matcher based on the AST. For this i’ll gladly stand on the shoulder of giants, in this case the giant is called Thompson who first described how to efficiently execute a regular expression matcher in O(nm) (yes, that’s worst case). Russ Cox wrote three awesome articles on the matter, explaining in (extremely well written) detail how one would go about it. He actually wrote the regular expression support for Google Code Search so the man must know what he’s talking about.

Speaking of which, i was contacted by a “big bad company” and asked if i’d be interested working for them. “Of course!” i replied and send over my CV and project portfolio. A nice lady then called me via phone and asked me questions about my unfinished studies and whether i could imagine living in Zürich or London. Said company is known for their long and technical interviews in their hiring process so i’m kind of pessimistic whether i would make it, i’m a bit rusty on my complexity analysis. In any case i’ll make the best of it. Fun times.

I was also approached by APress and asked whether i’d want to write them a book called “Beginning Android Game Development”. I just received the contract draft as well as the proposal form and will meditate over this over the weekend. I’ll most likely accept the offer. Nothing set in stone yet, they’ll also have to accept my proposal. We’ll see about that.

I also started maintaining, fixing and improving the Android app FaceIT by Lior Vankin. Fun times, as the original code base was horrible. We haven’t had any automatic crash reports since the last update so that gives me hope that future maintainance work will get down to a minimum and i can concentrate on adding new features every now and then.

Finally i had a talk with Robert from Battery Powered Games, our most beloved competitor. We plan on adapting the Cal3D format for skeletal animation in the very near future. Some of the code wil be integrated in libgdx in favor of the md2 format, which just plain sucks. I should also get my ass up and start implementing multi-touch this weekend. Everything is set up, i just need to copy and paste 50 lines of code from an old project. No promises at the moment though!

There’s actually a lot more that happened in the last couple of weeks. Starcraft 2 for example… GOD DAMN YOU BLIZZARD!

  • Share/Bookmark
 

I’m working a tiny bit on an application called FaceIT from time to time which uses a shitload of bitmaps in the two activities it consists of. Note that i’m not responsible for the original application but just started fixing some bugs in it a couple of weeks ago. The app suffers from silly out of memory exceptions due to Bitmap data not getting freed as the Bitmap objects in the VM don’t take up enough memory so the GC collects them and frees the native heap memory associated with them (Which the GC knows nothing about). So i poked around a little and found out that there is actually a way to get the native heap memory usage of an app on Android!

android.os.Debug.getNativeHeapSize();
android.os.Debug.getNativeHeapFreeSize();

Both return the respective sizes in bytes. With this it is quiet easy to monitor native heap allocations that happen with say Bitmap instances.

All hail Android! In other news: Collada is a bitch…

  • Share/Bookmark
 

Crash Reports with Acra

I instrumented Newton with the acra library today. Acra registers an UncaughtExceptionHandler (which is also available in desktop Java) and everytime your application crashes bad on a user’s device it send an error report with information such as android version, phone model plus stacktrace to a Google spreadsheet you set up for that purpose. The steps to include this in your application are totally easy:

  • Create the Google spreadsheet as lined out in Arca’s Wiki
  • Create a class that extends CrashReportApplication and implement the getFormId() Method, returning the form id you got from your spreadsheet
  • add android:name=”YourCrashReportApplicationClass” to your AndroidManifest.xml file
  • Crash Reports!

I especially like the solution of using Google spreadsheets for this kind of crash reporting. It also works on devices < 2.2 (down to 1.5) which is a definite plus. Finally you can add your own reports besides standard crash reports at any point in your application. With this feature you could for example log the average FPS of your game.

I used the standard crash reporting facilities of Acra and behold i got crash reports!


java.lang.NullPointerException
at at.knowcenter.pfx.gui.widgets.Label.dispose(Label.java:60)
at at.knowcenter.pfx.gui.Gui.removeWidgets(Gui.java:170)
at at.knowcenter.pfx.gui.Gui.render(Gui.java:136)
at com.badlogic.newton.game.MainMenu.render(MainMenu.java:167)
at com.badlogic.newton.game.Game.render(Game.java:126)
at at.knowcenter.pfx.backends.opengles.OpenGLESApplication.onDrawFrame(OpenGLESApplication.java:317)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:955)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:887)

Now that is nasty. Gui widgets in Newton are initialized in a lazy fashion. If the user is fast enough i try to dispose something which has not been initialized yet.

I hereby fully recommend the use of Acra in your application! The code is solid and doesn't do anything nasty (e.g. send your stats to a 3rd party).

  • Share/Bookmark
 

Deadly Chambers

Fellow developer Robert Green from Battery Powered Games released Deadly Chambers a few weeks ago. It’s an action adventure type of game where you try to escape various levels by shooting anything that gets in your way. It’s a nice pick up and play game and very polished. Here’s the trailer.

I could follow some of Robert’s development over the last couple of months in a couple of talks we had via GTalk. He put a shitload of effort into this game and i think it shows. Along the way i got to know some of the technical details of Deadly Chambers which are quiet impressive for a guy that wrote his first full blown 3D game (Light Racer 3D doesn’t count :) ). Robert’s using a couple of old school techniques which work quite well on all those mobile devices out there. Lighting is mostly static from what i understand. His artist mastered the black art of generating light maps with Blender which gives the levels their nice look. The interesting thing is that the lightmaps as well as the textures are adapted to the device the game runs on, the better the GPU the higher the resolution of the lightmaps and textures. This makes the game run well even on those punny little MSM7200 chips you find in the G1/Hero.

The next piece in the puzzle is animation. Robert uses plain old MD2 interpolated key frame rendering. Modelling was performed in Blender, the export script seems to work nowadays :) . Probably the biggest problem is the collision detection. He too stumbled across the articles by Peroxide and implemented those algorithms, stumbling over the same pitfalls i did. Calculating the intersections between ellipsoids and triangles is a pretty costly computation so you better first filter which triangles you send to the collision detection. For this Robert employed one of the oldest spatial partitioning schemes known as an Octree. You can query which triangles intersect a axis aligned bounding box with such a thing pretty fast so that makes it an ideal candidate for preselecting potential colliders before actually calculating triangle/ellipsoid intersections.

Along with the octree comes a portal system which uses manually placed portals for culling computations. It works pretty well and it seems manually creating the portals is still the way to go as automatic portal generation often needs manual post processing.

For all things GUI Robert went with plain Android GUI programming. I wouldn’t go down that rabbit hole myself to be honest, lacking the knowledge needed to skin and modify the Android GUI so it fits my game programming needs. However, the end result Robert came up with is incredibly well done. One wouldn’t be able to tell that it’s vanilla Android GUI stuff he’s using for his menus. The only place where he uses custom OpenGL GUI things is in game for the HUD and other things.

He included a shitload of input methods for the game, the multi-touch one being probably the most popular (but non-functional on first gen devices). By placing the analog sticks and buttons into opposite corners and some event filtering he was able to somewhat circumvent the multi-touch problems the N1 and Droid have. It is not a 100% perfect, but it’s the best multi-touch implementation i’ve seen so far.

All that being said, the game is really fun and you should check it out. There’s a demo version to get your mouth wet and a paid version for currently 2.99$. The game is great and the developer behind it knows his shit. So go out an buy a copy! Here’s the QR to the market for the full version (Click the QR code if you are on your device):


Btw, all the art and animation was done by Ryan Foss. He has a very interesting blog where he documents the making of Deadly Chambers. Go check it out!

  • Share/Bookmark
 

libgdx release 0.6

It’s been a while since the last libgdx release. Today we celebrate the release of libgdx version 0.6. Lots of bug fixing, especially with respect to the box2d wrapper which seems to be quite robust now.

One new feature is a simple to use AudioRecorder which you can instantiate via the Audio interface.

Another new feature are some changes in the Box2D API. Fear, i only added new stuff and didn’t change old stuff. The most notable additions here are the Box2DDebugRenderer, which allows you to easily visualize your box2d world as well as the implementation of the Body.getTransform() method which is needed if you want to get the position and orientation of a fixture attached to a body. Check out the Box2DDebugRenderer on how that can be used for this purpose. Of course the Transform class is also properly implemented. The rest of the changes are mainly bug fixes.

What’s maybe interesting for many of you out there are the extensive examples for box2d with libgdx that you can now find in the test project. I talked about them in the last post, so i won’t do it again here.

What’s next? libgdx 0.7 will get multi-touch support (which frankly is nothing anyone sane would use at this point in time given the lack of proper multi-touch devices apart from the Samsung Galaxy S and DroidX). Xavier already started on TMX tile map support, i have yet to look into that. Finally the MD2 loader will get included in stock libgdx.

  • Share/Bookmark
 

Libgdx Box2D testbed

I found an hour today to continue working on porting over the original Box2D testbed tests. The ported testbed is very similar to the original one in it’s design. There’s a Box2DTest abstract class which handles things like creating all the rendering resources, mouse input and so on. All tests derive from this class and most often only implement the createWorld() method that populates the world with objects.

The class TestCollection ties all tests together and allows cycling through the tests by pressing the space bar.

Both things are pretty unexciting, porting the tests is also not really that impressive but rather tedious. The last piece in the puzzle is a renderer which can render the physics world. For this i wrote the Box2DDebugRenderer class, located in the main API so you can also use it when trying to debug your games. It uses an ImmediateModeRenderer internally so don’t expect the performance to be stellar.

Here’s a video of the tests ported so far. I could iron out a bug in the PrismaticJoint and a few other things along the way and all seems to work well. Richard of Rokon fame reported a bug in the default CollisionListener which i couldn’t reproduce. The CollisionFilters test also proves that my implementation of that is indeed correct. I could imagine that not being careful with your shorts (16-bit integer you pervert…) might be a problem in Java, so watch out for that.

Video footage taken on my trusty netbook with software OpenGL so the performance sucks a little :)

Libgdx 0.6 will be released on sunday with all those nice fixes. I hope to be able to port the rest of the tests over (won’t port raycasting and presolve tests yet though, that has to wait).

  • Share/Bookmark
 

The saddest thing

  • Share/Bookmark