Level Counter

Story: 60, Challenge: 0.

Monday, May 7, 2012

First steps with libgdx

Pachinguys is my first android game. and to build it I've decided to use a library called libgdx.

obviously it has been a struggle to get accustomed to a new game library (after years of XNA).

here's what I found so far :

cons :
libgdx uses a bottom left origin point for graphics and a top left origin point for input, this is annoying and confusing. the creator of libgdx stated that this was a choice based on the fact that when we imagine Mario jumping we think of his y value increasing. while this is true, the fact that we have different origins for input and graphics makes it IMHO moot.

libgdx gives you a built in screens system. which is very nice and works well. however the way its implemented means that screens that are not in the foreground continue to run their update and render methods, which to me was very unintuitive and caused unexpected slowdown issues.
there also seems to be no proper way to disable screens. once a screen is created it will exist and run forever. even if no longer in the foreground. while update and render functions can start with an "am I the foreground screen?" check, this is an ugly solution.

pros :
as anyone who has developed for the android without an android device can tell you, the android emulator is dreadful. it is slow to start and runs at a frame-rate of about 5. using it hinders development significantly to the point of rage quitting the entire project.
this is where libgdx shines. libgdx enables you to build two concurrent projects, one for the android and one for the desktop (based on openGL). both projects use the same source and only differ in their entry point. letting me focus on actual game development and testing it normally on my desktop.
graphics, files, input and many other device specific aspects are abstracted by libgdx to a single unified handler. for example input can be read from either a mouse or a touchscreen, accordingly, by libgdx, and delivered to me as an abstracted touch event.

2 comments:

  1. Hmm, that's cool.

    Is libgdx focused on games or is it more general-purpose?

    ReplyDelete
  2. its game oriented. you could do UI stuff with it too I guess but there are simpler tools around for that.

    ReplyDelete