Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 03-03-2012, 03:41 PM   #1
Zanzlanz
Zanzlanz
 
Join Date: Nov 2011
Location: United States
Posts: 12
Send a message via Skype™ to Zanzlanz
Default [AS3] Optimizing a game with a block engine

With AS3, I'm making a game that uses a block engine, meaning it places blocks in an array resembling the appearance of a world.

Not only this, but when you move the camera in the game, areas of blocks that aren't on the screen get removed, and areas that need to be shown are loaded (Using addChild).

It runs smooth when there's only a couple hundred blocks on the screen, but when there's a bit more, than slower computers start to make the game lag a lot.

Is there a way I can efficiently speed up this engine by caching, or going about it in a different way?

If you need additional details, I will be happy to include them.

Here's a link to the .swf on my website:
zanzlanz .com/MineBlocks2 .php
Zanzlanz is offline   Reply With Quote
Old 03-03-2012, 04:59 PM   #2
Xegnma
Member
 
Join Date: Sep 2007
Posts: 84
Default

I couldn't get your demo to work but from the description of your problem you might try using blitting as the basis of your rendering engine instead of using the display list.
Xegnma is offline   Reply With Quote
Old 03-03-2012, 11:16 PM   #3
Zanzlanz
Zanzlanz
 
Join Date: Nov 2011
Location: United States
Posts: 12
Send a message via Skype™ to Zanzlanz
Default

Thanks for the reply Xegnma,

Does "blitting" mean copying repetitive bitmap data over and over again? Is that even possible with Flash AS3?
Zanzlanz is offline   Reply With Quote
Old 03-04-2012, 12:09 AM   #4
Xegnma
Member
 
Join Date: Sep 2007
Posts: 84
Default

Yes, it is. Just do a google search on 'AS3 blitting' and you should have a bunch of tutorials at your disposal.
Xegnma is offline   Reply With Quote
Old 03-04-2012, 12:27 PM   #5
Zanzlanz
Zanzlanz
 
Join Date: Nov 2011
Location: United States
Posts: 12
Send a message via Skype™ to Zanzlanz
Default

Wow this can become a really useful tool. Thanks for the help!

Although I still don't see how it will save me from the dreaded lag?

EDIT: Okay I did some more research and realized that the blitting process puts all of the graphics on 1 bitmap. So yes, it will reduce the strain on Flash. It'll be a huge overhaul to make the world interactive, but I guess this will be a great addition to my game.

Thanks!

Last edited by Zanzlanz; 03-04-2012 at 12:33 PM. Reason: ...after some more research...
Zanzlanz is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:25 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.