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
 

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 signed a contract today with Handmark, partner of a lot of OEMs and carriers, mainly in the U.S. from what i could gather. They will likely bundle it in some form with future Android devices, or publish it on their own market targeted at Sprint customers. No real details where given. In any case, any publicity is good publicity.

I know i’ve been kinda slow with additions to libgdx lately. Rest assured, i still work on it, albeit i only iron out some bugs and slowly but steadily increase the test coverage of Box2D. The next release (0.6) is scheduled for next sunday, it adds some small but important modifications to the Box2D wrapper along with a debug renderer for testing (which should only be used on the desktop! it’s slow on devices! TAKE NOTE!).

The future of libgdx looks as follows: i’ll add the mod player capability available in Andengine (yes, i too can “steal” code :) ), add support for the TMX tile map format, clean up some dirty interfaces/classes (camera classes, i’m looking at you!), include the MD2 loader i wrote back in January for the tutorial (with fixes from Moritz, thanks!) and try my hands on a wrapper for Bullet. I’ll also stop being lazy and add a multitouch handler for Android so the pointer parameter of the InputListener methods are of actual use. Don’t expect any miracles on devices such as the N1 or Droid though, their touch screens still suck!

All this (expect the bullet wrapper) should be done by the end of august if all goes well and my work load at my day job decreases a little. I’d love to get some other people on the board which could help me out, but i guess the libgdx community is more or less non existant at this point :)

  • Share/Bookmark
 

Javascript Game Development

Youtube put an easter egg in their new player allowing you to play Snake while watching a video. Some guys on Reddit noticed that and an admin asked for a similar game in Flash or Javascript to be shown on their site when no ads are displayed.

So, i never ever put my hands on Javascript, for some reason i don’t like dynamically typed languages. Today i plucked up all my courage and formulated a goal: create a Snake clone in Javascript with the Canvas element. First thing was finding a proper IDE after messing around for a bit in Notepad++. I used the first one that came up in the Google search called Aptana. It comes in two flavors: as an Eclipse plugin or a stand-alone IDE. I used the later, not wanting to polute my current Eclipse installation. Next i had to hunt down some info on Javascript itself as i no idea how to use it. Mozilla has a nice introduction which enlightened me. Javascript is not so bad after all! It’s actually a pretty powerful beast, altough i have to get used to some concepts like prototypes and so on. Now i was ready to tackle the last bit, getting to know the Canvas element and how to get keyboard input. For this i consulted the Javascript reference of the W3C school. And that was pretty much all i needed. After 3 hours of learning and applying i now have a fully functional snake clone in Javascript :)



Your browser doesn’t support the Canvas element! Update to the latest Firefox, Chrome or Safari!


If you want to include that in your own site use this bit of html to load the script and insert the canvas with the proper size and id:

<script type="text/javascript" src="../downloads/snake.js"></script>
<canvas id="com.badlogic.snake.Canvas" width="300" height="250"><p>Your browser doesn't support the Canvas element! Update to the latest Firefox, Chrome or Safari!</p></canvas>

Not all that impressive graphically but i tried to keep it as clean as possible. You can find the source here. I started documenting it but then gave up as i wanted to have results fast. I don’t know whether this is the recommended way to develop games with Javascript and the Canvas element but it sure worked out for me. I can see how one could easily create a nice library for general game development with Javascript (and indeed there are a couple, just search via Google).

That was fun :p

  • Share/Bookmark
 

Back in the early nineties i got my first PC, a heavy weight 486 DX with 40Mhz. Man was i proud. I was 10 back then and talked my parents into getting my a PC for “school”. They agreed if i was able to come up with a sizeable amount of the price of such a PC. First thing i did when getting it was of course playing all the games i used to play at my uncle’s (a complete gamer nut which had all kinds of systems from old Amiga 500s, to C64 and C128 etc. etc.). This and my Gameboy made me think that it would be extremely cool to create my own games. These were the DOS games though, no Internet for me for years to come no nothing. Only me and my DOS prompt. So i was asking my uncle whether he knew how to create games on the PC. He didn’t as he was only a “user”, never a coder. But he remembered some guy at his work place talking about something called QBasic with which he wrote some small programs for the company. Soon i was finding myself in this awesome interactive blue QBasic IDE. The help menu was incredibly valuable and written in german. And with the Gorillas.bas file i discovered shorty afterwards all hell broke lose. I couldn’t get off the computer anymore and invested most of my free-time for the next 2 years programming “games” in QBasic. At school we finally got a working internet connection which opened another chapter in my coder life. I quickly started using libraries like DirectQB, regularily visited sites like qb45.com and finally started coding a bit in assembler. The day i created my first 3D FPS that was not a raycaster but a polygonal engine was probably one of the best days in my childhood life. Here’s a pic of that game:

Not impressive at all by todays standards but boy was i proud. It had a level editor that a friend of mine used to create the actual levels. He also helped out with the artwork. You can find the original source code here. It will sort of run in DosBox but crash when starting a level. I somehow got bored with all this and started concentrating on girls and making music.

I guess me becoming a coder had a lot to do with the fact that i was not distracted by the internet and all its precaned content in the early days. There’s a lot more easy ways nowadays to produce something awesome with your PC and the standards are a lot higher. Kids just don’t get a lot out of printing “Hello World” to the screen, and i can completely understand that. So i was browsing the web a little and stumbled over this awesome commons licensed book called “Invent your own computer games with Python”. I only skimmed over it but judging from the code and images it feels a lot like what we did in the DOS days. I guess this comes as close to that experience we had as is possible today. So if you got a kid who’s interested in writing his own computer games show him/her that link. It might spawn interest in programming as QBasic and its beautiful blue IDE did for me.

Yes, this is now the official nostalgia week :)

  • Share/Bookmark
 

Lately i got a bit of nostalgia. This might have to do with me turning 27 this year (oh well…). So i checked whether i could find old projects of mine an revive them. Basically i was trying to find things that i could show my kids if i ever happen to have some. Surely they would be impressed by my mighty powers. Probably not though.

Back in 2005 i was completely into compiler construction. I was mostly self-taught, having read the dragon book and some other nice texts. A good friend of mine and me were planning on writing a 32-bit windows Basic compiler (my original background was Qbasic with which i started in the nineties). We failed. Hard. We were using Bison and Flex to generate the initial lexer/parser pair. The syntax of basic is a bitch though so we gave up eventually. Later that year another friend of ours started his own Basic compiler project which resulted in the infamous Freebasic. Blitz and me did some work on it, i mostly just ported over some C-headers so we could use SDL etc. with Freebasic. At some point my interest vanished and i got sidetracked by other stuff, e.g. university.

Later that year i attended a class on compiler engineering just for fun. And boy was it fun! My instructor, Roderick Bloem was the most amazing teacher i ever had. Even the theoretical lectures were fun. In the theoretical lectures we derived various methods and aspects of compilers. He went through it all on the chalk board, even making mistakes that only furthered our understanding of the subject. Besides the theoretical lectures we also had practical assignments. That semester the assignments were aimed at constructing a small C-compiler. We were given an outline of the syntax and a somewhat lacking tutorial on JFlex and Java Cup (this one was given by a tutor, i don’t blame her there’s only so much you can explain in 2 hours). The practical assignments were meant to be done in groups of three and i teamed up with 2 of my friends at university. As they didn’t show any interest i was happy to actually do all the assignments myself. In return they did some assignments in other courses.

After Roderick’s lectures many of the concepts i barely understood before became crystal clear. The hardest part in compiler construction in my opinion is getting the parser right. From there on it’s really a piece of cake. I was so motivated that i did a lot more than was asked for in the assignments, probably stepping on the nerves of Roderick in the process a lot. The resulting compiler was able to compile a subset of C with pointers, integers, floats and chars, the most common control structures, functions and procedures etc. It followed the proper pattern of lexing/parsing, AST construction, intermediate code construction and emission of machine dependent assembler code. It was able to handle stdcall and normal C call convections, honored GCC stack layouts and return value policies etc. I learned so much about the x86 backend of GCC back then, it was just awesome (and i knew i was only scratching the surface). I made the thing work on windows and linux, extended it so it could easily interface with standard C libraries and so on. I continued working on it after the course was over and added structures, unions and so on and so forth. Sadly i only found the source for the final course assignment version which never the less had some nice things in it.

I ended up coding 2 games with it (apart from the boring test cases we had to implement for the assignment), one being a very simple Tron clone using the graphics library that was specifically coded for Freebasic named fbgfx, and the other one being a 3D Pong game using GLFW and OpenGL. Boy was i proud of me back then :)

My enthusiam prompted Roderick to ask me to become the tutor for the pratical course the next year, for better or worse :) . My tiny-c compiler was the base for the assignments that semester. People were asked to extend it with some C++ features like classes and single inheritance and all that nasty v-table stuff. Those poor souls.

While it might not be of particular use to anyone i want to post the source code of it here. It’s written in Java, using JFlex and Java Cup, utilizes some Mingw binaries for the final assembler and linker stage etc. Here’s the source, most of it is documented but to be honest i wouldn’t take it as a prime example of how to write a compiler. I just learned Java back then and it really shows. It do a lot of it differently today. I was 21, i didn’t know better (altough i was pretty cocky in the news group it seems judging from the archives…). You can find a couple of binaries, most notably the tron and pong 3D thing in the examples folder along with the sources of the examples. The sources for the compiler are in the src/ directory.

After that semester i somewhat gave up on my studies and joint my current workplace. I haven’t finished my bachelor degree yet, i guess i’m just a lazy bastard. I regret that a little. So take it from an old wise guy: finish your degree!

  • Share/Bookmark
 

Forums!

Yes, we finally have a nice phpBB forum. I know, i know, phpbb is not exactly known for it’s superb security but it’s the only one i’m comfortable with. In the navigation bar at the top of this site you’ll find a new entry called “Forum”. Click on it, register and post away. The forum sports subforums for our games, libgdx, general development stuff as well as a talk box were you can rant about anything that comes to mind. Behave nicely over there!

  • Share/Bookmark
 

Asus Eee 1101HA and OpenGL

So i bought an Asus Eee 1101HA in december last year. It came preloaded with Windows 7 (and had a small boot partition with the Vista loader on it, go figure…). Up until today i was more or less satisfied with it’s performance. Developing via Eclipse was possible. Overall it felt a little sluggish but as i was used to that in my 486 days with Windows 98 i didn’t mind.

Not so anymore. The poor thing doesn’t have OpenGL drivers due to a major fuck up by Intel (which bought the GPU core for the GMA 500 from PowerVR) and their Windows 7 drivers are full of shit. I played around a little with GLDirect but that didn’t work out either. I know from the specs that the chip supports OpenGL 2.0 so i turned to Linux. I had a bit of luck there once i got those Poulsbo drivers working. However, they are still a bit buggy so i went back to Windows 7 (due to some C# stuff i do, and yes Mono sucks…).

Today i tried to install Starcraft and Warcraft 2 BNE and both refused to work. DirectDraw seems to be completely borked on Windows 7 for that chipset. There’s no official support for Windows 7 for those games by Blizzard so i decided to do the unspeakable: install Windows XP. And holy shit, that poor Eee is now useable! It’s extemely fast at least when compared to Windows 7 hell and i also found proper yet experimental OpenGL drivers for XP. The OpenGL extension viewer by Realtech VR is now happy and show’s me what the chipset is actually capable of.

I’m now going to try Warcraft and Starcraft again. Maybe i even try some libgdx stuff and see whether that finally works. All hail! And fuck you Intel!

OMG SUCCESS!!

OMG FAILURE!
Well, Direct Draw seems to work now but OpenGL is still extremely borked. Dear Google show me the way to proper drivers!

  • Share/Bookmark
 

At work we are using Maven2 to manage all our interproject and external dependencies. Combined with the automatic build system Continuum and Archiva for repository managment we got a pretty solid basis to manage all our code and builds.

So i’m used to working with this kind of enterprisy environment (altough i sometimes want to beat the crap out of Maven as well as Continuum). All our projects in SVN are pure code and resources with pom files that one can use to setup projects for ones prefered IDE (i like Eclipse, some use Idea, others use Netbeans). Also, there’s not a single binary in SVN which is a “good thing”(tm).

So why am i such a lazy bastard when it comes to libgdx? Not only do i not use any dependency managment but i also commit binaries to SVN!

There’s a couple of reasons. I don’t use Maven as i think that in it’s current state a fullblown dependency managment system is overkill. Maven also doesn’t play to well with building native code which libgdx has quiet a lot of. I know there’s ways to get native code compilation going, but frankly it’s a big pain in the buttocks. I simply don’t want to invest that much time to get all this going on multiple platforms.

The binaries are in the SVN as a lot of people want to use the latest and greatest without waiting for me to package everything up properly. Now, one could argue that people could build stuff themselves. That is true to some extend but setting everything up is often beyond what one would be willing to do.

I know those are actually lame excuses. I’m aware of the lack of a proper build system, just so you know :) . If somebody wants to step up and help me out with this just drop me a mail!

  • Share/Bookmark