Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 06-21-2011, 07:38 AM   #1
Registered User
Join Date: Aug 2008
Posts: 21
Default Saving and loading large 2d arrays?

Im trying to save/load a 2d array containing "Tiles". So far Iv saved it out as
an XML file. But when i load the xml file and loop through it to populate the new 2d array, flash freeze up for about 3-5 secs depending on how many variables i pull out of the xml. The 2d array itself are 67x67, making the xml 4489 "tiles" long.

Is there a better way to save/load large levels without using a database?
LarsHolen is offline   Reply With Quote
Old 06-22-2011, 04:24 PM   #2
Senior Member
dialectric's Avatar
Join Date: May 2006
Location: USA
Posts: 614

I have heard of people encoding data as png or bmp using setpixel, saving the image, then loading the image, and using getpixel to pull the data back out of the image. Your image would probably be 67x67 pixels, which would load fairly quickly, but the conversion process of pulling the data back out using getpixel might be quite slow.

if all the levels are the same size, and you have less than 128 different tiles,
one long (4489 characters long) string of ascii characters, with each ascii char representing a different tile, would save and load much faster than xml.

- dialectric
dialectric is offline   Reply With Quote

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 02:27 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.