Jump to content
  • Advertisement
Sign in to follow this  

Blitting Architecture Help

This topic is 4783 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

If this question is more appropriate for Isometric Land, can the admin please move it there? Thanks! I need help in writing some blitting algorithms with inheritance. I don't know what patterns people use via inheritance to allow sub-classes to blit to the same bitmap; how do you all handle it? -------------------- Need some context? Background Flash Player 8 and 8.5 now support blitting. In the past, you'd just use sprites (Flash's MovieClip), and nest your tiles in that in a base class. A sub-class could then draw non-player character sprites. A further sub-class could then deal with moving the character; whether centered Final Fantasy 3 style, or move him as well. The upshot of this was that it didn't take a lot of code to do this, and it made your tiles, character animations, etc. extremely flexible from an art sense, and code wise was pretty easy to tweak and manage. Performance blew. We're talking 96% CPU to scroll a max tile map of 25x25 tiles that are 16x16 pixels in size, masked at 160x120. Blitting Now, with Flash Player 8 and 8.5, you can utilize bitmap objects, with all the lovely pixel manipulations you want, effects included. Combine that with bitmap caching, and definable scroll rects, and suddenly, you're doing the above using 0-2% CPU. However, even just replacing the tile engine with that, and keeping the sprites, you're CPU skyrockets yet again. My Challenge So, again, I'm realizing the sprites, as well as the character sprite all need to be blitted to keep the performance good. I've been using double-buffering, drawing everything to an offscreen bitmap that isn't shown, and then when done, copying the pixels from that to 1 on-screen bitmap. This works great for the tilemap, but... not sure how to handle this for sub-classes; do I expose the bitmap data as a public class variable, and allow them to access it? Do I override the super-class's render method, and intercept it to blit my own things to it before the re-rendering is called? How do people handle this in other languages? Thanks if you can help.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!