Monday, 27 April 2009

Drawing API and back to PureMVC

After some R&D of various types of tile based engines I started work on a simple bitmap drawing API. I had deduced that nearly all tile engine require tiles, tilesets and tilemaps so I drew up some class diagrams and started coding. As you may imagine I aim to make the tile engine render as quickly as possible so I took measures to keep things fast. First of all I did not use Sprites as the foundation of the tiles in fact I use only one display object datatype and that is a bitmap. The bitmap defines my tileset and stores the width and height of the tiles within it. I can create Tile objects from this class or by passing a reference of the tileset to an instance of a Tile class. The tile class simply acts as a pointer on the tileset meaning that a tile doesn't contain any graphic at all.

I bench marked my early engine by blitting 1400 tiles of 50px * 50px to a secondary bitmap and got a steady 60fps on my dev machine (The swf was running at 60fps). I used a primary and secondary buffer by using the bitmap lock( ) and unlock( ) functionality. I have optimizations to make but this was a good benchmark and led me to making a demo that used large areas of alpha transparency. This also showed good performance but there is a many optimizations I wish to make so I will provide benchmark test results after I make these changes.

Today I set up a new project environment in FlashDevelop and I started to work on the PureMVC framework in order to create a basic structure for my game project. I also spent time looking over a couple of tutorials regarding UI implementations since I want to build from FlashDevelop rather than having to build my app from the Flash IDE. Even though I have worked on and contributed to the AS2 PureMVC framework, I ported both the AsyncCommands classes and the StateMachine classes from AS3 a few months ago, I do have more to learn about the UI outside of the Flash IDE and I will need to keep reading since most tutorials are written in Flex or exceptionally vague.

Anyway, as soon as I get the UI implementation how I want it I will start to roll out some technical demos but until then I'm going to keep reading vague tutorials until something clicks :D

Gary Paluk

0 comments:

Post a Comment