By: Oscar J Gomez   |   On: December 20, 2012 - 5:56am   |   0 Comments   |   augmented reality, zombie, game

Today I was tasked with putting together a game using augmented reality for an Interactive Computer Graphics course I am taking at the University of Houston. So as to avoid real work I immediately got started. I opened up a sample of AndARToolkit I previously had up and running on Eclipse. ARToolKit is an open source library for marker tracking augmented reality. It is available for many different languages. I utilized the Android version available on Google Code which runs amazingly fast on my Samsung Galaxy Nexus I recently picked up from Verizon.

After looking into the source code seeking out the drawing code and how the program is organized I started moving some code around to organize into a better game environment. Other than reorganizing some structure the first addition I made was enabling touch screen, because if interaction is not possible then it will never be a game. After some forty-five minutes of trying to figure out a working implementation I finally had some success.

//adding touch input
Context mContext = getApplicationContext();
touchView = new CustomView(mContext,null,game);
FrameLayout frame = (FrameLayout)this.findViewById(android.R.id.content);
frame.addView(touchView);

Basically I extracted the existing FrameLayout and added a CustomView class which has the actual touch input through setFocusableInTouchMode(true). So now we are ready to receive finger presses. Next I set out to make a second glyph to utilize multiple marker tracking. One marker will be the game scene and any subsequent markers will be players and items. After searching around I found the old ARToolKit Marker Generator I used before when I was working on a AR university educational game project related to teaching logic gates to Computer Science students.

Anyways I drew up a new marker in PhotoShop and hit the generator. Now with two markers ready to go I can start working on the visuals for the game. For the zombies I will not be using thee dimensional models imported from modeling software. Instead I'll be hand crafting characters like the ones in the ultra successful indie game Minecraft. A couple of rectangular prisms and a cube and we got ourselves a retro looking box enemy.

The cool part is I can skin it just like the Minecraft characters which are stored in texture atlases. The trick is to correctly map each section from the atlas to each flat face of the box character. It is not easy to tell which areas match which side of the character.

So I found this great image from Minecraft Skinning Resources and used it as a reference to correctly line up the texture to my rectangular prism character.

So far I am ten hours into the project and the results are looking pretty good. The clean retro pixelated feel is not quite there, but its good enough in my opinion. If anyone has any suggestions to achieve the nice art style let me know. Later on I may include an importer within the app so fans can upload their Minecraft character's skins into the AR game on their devices.

I finally created a Github account, and just learned how to use it. The project and source code is now available on Github. Next up is animations and actual gameplay. Stay tuned!

comments powered by Disqus