ok this is only a verry small artical (coz i can see into the future you see), and the only reason im writing it is coz i had a bit of a problem with loading arrays fast enough for my new level editor (yes, newer than the one ive most recently uploaded).
The main problems were, saving an array that was a small enough file, and loading in into the screen quick enough.

These are the ways i kicked those problems in the ass!!

Saving array as a small file:

Ok the reason this one was a problem was because my level editor has 6 layers when editing. These are background 1,background 2,obsticals,forground,Objects, andtile properties. btw.

My levels where 5 screens long and 5 screens down (320*240) and each square was 16*16 therefore there was quite alot of squares.. Alough my new level editor has double, and still saves the files a hell of a lot smaller.

Pretty much it came down to useing the "array object" to save my files rather than the "ass array object", which compresses just beautifly! But i like useing the array object while we are using the level editor, so what i did was when you go to save the level:
run a x y and z loop that sets the position of the array to the loop index of each one. and if that array position holds a bit of data we save it to the ass array object at a delimited key called "arrayx - arrayy - arrayz" (you get the idea)
So its only saveing what it needs to save and not all the crap inbetween!

So rather than haveing a level that was about 2 megs, the same level came to about 20kb!!


loading the level fast enough:

Ok this one was a bit of a bitch, but after staying awake at night to much it clicked.

Just let me tell you how i used to load a level:
on clicking load: run loopX(200times)
on loopX run loopY(150times)
on loopY run loopZ(6times)
on loopZ run loopCheckTile(1time) and set the array position to the xyz loop index
on loop checkTile(depending on tile) lay the background object. or event object.

Ok.. so whats happening is its going through every single array position looking for a bit of data, and if it finds it create it.


takes freaking ages (about 10 seconds i counted for a not to big level)

So i thought how about making it only look in the places where there IS tiles?

I thought about it a lil and i figured it out... alot comes down to event ordering and stuff... if you want me to actualy say the sysntax and all that jazz i will, but for now im just gona say how i did it roughly.

Ok when it saves the level, (youknow running through all the squares) we have another ass array object that takes in the actual X Y and Z positions as a delimeted string, and puts them into a list. Like:
1 = 32,45,3
2 = 15,6,3
3 = 7,7,7,

so its saving the places where the data is held rather than the data itself. Now the only other thing is on each loop we count up a number that says how many there are.
so the file would look like this:
1 = 32,45,3
2 = 15,6,3
3 = 7,7,7,
number of keys= 3

Now to load it (this is more complicated than you might think.
The first thing is when you click load, we clear the arrays and delete all the ojects that are on the screen at the moment, then load in the files, then we start a loop:

on click "load":
start loop "buildLevel" assarray("number of keys") times

now we have to use varables coz the loop indexes dont work in this situation for some reason.
on the loop we set the varables to the delimeted string of the ass array object. So the first delimeted string would be the X, the second Y, and the third Z.
Then we have another varable which increments each time the loop happens.
Now :

on loop "buildLevel":
set the position of the x y and z array to the delimeted string of the list of data addresses.
and check for tiles with a loop "checkTile"

This is a very simple overveiw... but in short the idea is:

Rather than looking through every array position for data. jump to where we know the next bit of data is, then skip to the next one.
And we do that by saving the addresses of these bits of data in a seperate file.

There you go. If you would like a tutorial or for me to upload an example i will. but i cant be botherd if no ones intrested or doesnt need it. I thought i better write it down anyway, coz i had to figure it out and no one was tell me how to do it.

By the way i did a test:
OLD way of doing it: 11 seconds to load level
New way: not even one second.

Just to prove it makes a difference lol.
Enjoy, and dont eat yellow snow.