April 19, 2010

(0) Comments

Rectangle Packing is Hard! Part 2

Brad

In the first post, we looked at some of the difficulties of rectangle packing and how the easy algorithms can fail. While the recursive algorithm can work well for lots of similarly-shaped rectangles, it falls apart when we have fewer rectangles or a large variety of shapes. So I decided to start from scratch, trying to come up with an algorithm which could sort the rectangles below:

More »

March 13, 2010

(0) Comments

Rectangle Packing is Hard! Part 1

Rectangle packing, or 2D box packing (or bin packing), is a pretty common problem in computer graphics. Plasma needs a good rectangle packer because most GL ES hardware only supports textures with sides that are powers of 2, and this isn’t an acceptable limitation. Our current solution is to pack all bitmaps into one big texture which meets any hardware requirements. Then we can just draw the parts of the texture that the frame requires.

So, how can we efficiently pack a bunch of bitmaps into one big image?

More »

March 6, 2010

(1) Comment

Parallax Scrolling Demo

One of the really neat features of Plasma is the way in which it handles multiple background layers. By drawing backgrounds on top of each other, we enable some cool effects such as Parallax Scrolling. Check out this demo video:

More »

February 27, 2010

(0) Comments

The Plasma Engine?

Brad

The Plasma Engine is a hobby project of mine to make writing games in Android easier. Specifically, I’m targeting 2D hardware-accelerated games. Plasma is ideal for action/adventure type games, but will work well for puzzle games, board games, etc.

Android is already a really slick platform for writing software. So where does Plasma fit in?

Android does a great job of providing a fun development environment. The emulator is great and debugging on real hardware is a breeze. It has several shortcomings though, especially when it comes to game development. For example:

  • The Garbage Collector will hog the CPU for up to several hundred milliseconds each time it needs to clean up (more on this in a later post)
  • OpenGL ES is fast, but it isn’t easy to work with 2D objects. Textures need to have widths and heights which are powers of 2. Drawing very simple objects, such as squares, requires several GL calls. Adding more advanced features like rotation, fading, etc only complicate things further.
  • The Android OpenGL implementation is not complete and some of the limitations aren’t well documented. It took hours to figure out that GLUtils.texSubImage2D didn’t support compressed bitmaps and to find a good workaround.

In addition to the problems with writing games on Android specifically, there are other issues which get in the way of a game developer and their game. Handling physics, especially with regard to timing, can be tough. Keeping track of all your sprites is a headache. Detecting collisions involves writing a bunch of code, with lots of room for error. Even getting text onto an OpenGL surface is a lot more complicated than it should be.

Plasma is meant to get around these limitations and make it easier for game developers to go make games. I’m very excited about the progress so far, and will keep updating this blog with notes and updates as we approach the first public release. Please check back often!