Now my code is working I've taken another big step forward and got the game running on my physical device rather than in an emulator. It's a lot easier to set up debugging on a device than I was expecting. It did break when I upgraded my Hero using the new Android 2.1 OTA update, but reinstalling HTC Sync fixed it.
So now I have Plasma Duel running on my phone. You can't do much yet apart from move paddles around the screen, but from now on progress should happen a bit quicker.
I've spent a few days now trying to get a very bare minimum framework for the game started. As is my manner I coded a fair amount of the setup stage of the game before I attempted to run it. Of course it crashed as I mentioned in my last post. To debug that crash I gradually commented out more and more code until all I had left in the project was the engine setup code and an instruction to put a single sprite on the screen. It still didn't work.
There was a lot of head scratching, researching of the Eclipse debugging tools and general background reading in search of a solution. No matter what I did, nothing showed up on the screen when the game was executed.
I finally found the problem. In my code I referred to a subdirectory called "textures" and on disk that folder was named "Textures". The hardest to find problems are often the simplest ones. On a positive note I'm now a lot more comfortable with debugging using Eclipse.
This session I attempted to get my bricks and bats displaying on the screen. Bricks are arranged in 2 walls, each wall consisting of five rows of six bricks. The fifth row being elevated some distance above the player's paddle to create an obstacle between the two player's paddles. Not all the bricks will be present depending upon which level is loaded but for now I am trying to display every brick.
The paddles should (theoretically) be quite simple to display, just draw their sprite on the screen in the right location. I didn't set things up quite so simply in my C++ version of the game however. A paddle can expand, shrink and grow lasers, the sprite is made up of not one but up to 9 different texture parts because of this. I'm attempting to reproduce this method in the java Android version. I will find out whether it works once I can get it running.
The outcome of my game engine deliberations is that I have decided to use LibGDX. It's probably the best known Android game engine and has a nice community in its forums. The developer is very active as well and open to suggestions. That could be very useful in future.
I had a short coding session today in which I set up my library code stub and then created classes for my paddles and bricks. Paddles are based upon a sprite class and bricks based upon a basic texture class. Next step is to load some textures and draw them in on the screen. Luckily I already have most of the texture assets I will need from the Windows Mobile version of Plasma Duel.
I started the the development process by reading up on the various game engine libraries that exist for the operating system. There are not many to choose from, three or four possibilities. I also had the option of creating my own engine but that's not really my area of expertise and I hate reinventing the wheel. The other reason for using a ready made game engine is that it can provide me with access to OpenGL without having to do the coding myself.
In the end I'm using LibGDX, it's a nice library with a great community and even has a fair bit of documentation.
Earlier journal entries can be found in my "Nova Dawn Development Journal" which is separated from this journal as its focus is on game development for the Windows Mobile platform.
Continue to Nova Dawn Development Journal