I am embarking on a rewrite of an AS2 tile engine that I made in March 2008 whilst I was sunning myself in Thailand. Since then I worked at a small Flash development company making betting games where I spent some time learning design patterns, the PureMVC framework and AS3. In fact the company I worked for allowed me to contribute to PureMVC with ports of the ASyncCommands and StateMachine classes :DI'm starting a new year stint working on my own full time project and it shall require an AS3 tile engine. I've been involved with tile engines since the very early Flash days ( Flash 4 ) where MCs were used to represent tiles but Flash has evolved a lot since then and now that AS3 and its DisplayObject data types are available there is a much more realistic concept of creating a tile engine with the capabilities of it being able to run the other required parts such as pathfinding & line of sight algorythms, AI routines, battle mechanics and time-based animation routines... the list goes on.
Today is just an introduction and I'm simply performing R&D over at GameDev but I shall be posting progress reports and info regarding the build of this engine but I can give you an insight to my thoughts so here goes.
The first part of this project is to research fast ways of doing things, luckily for me it seems that the method of copying pixels that I used in my old tile engine has been tested thouroughly and I was on the right track since Michael Grundvig of Electotank had done some testing with the same copypixel technique that I used in my AS2 engine and his findings confirmed that it is a very fast method for drawing images to the screen.
Next up, my new design pattern knowledge came into play when I was looking at the way that older machines used a block of memory to store the tiles. Back then tile structs were created to point at the positions in memory that a particular tiles data existed at. My thoughts were to do the same thing. I could create a Tileset object to act like a memory block that holds a DisplayObject. Tile objects could then be instantiated with a reference to its Tileset object. The Tileset object is in charge of the tiles height and width meaning that a Tile object has no graphical asset to hold and no knowledge of its width or height, this should be very fast and easy on RAM allocation.
I am going to check out some source code of other tile engines to determine how they have approached this and I will let you know my findings in my next post.
Have fun and keep checking back :D
Gary Paluk
0 comments:
Post a Comment