# Where to store game level data?

**URL:** <https://forum.kirupa.com/t/where-to-store-game-level-data/307564>\
**Category:** programming\
**Created:** [April 6, 2010, 4:21am UTC](https://forum.kirupa.com/t/where-to-store-game-level-data/307564 "2010-04-06T04:21:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aziraphael](https://avatars.discourse-cdn.com/v4/letter/a/c4cdca/32.png) [@Aziraphael](https://forum.kirupa.com/u/Aziraphael)\
**Post date:** [April 6, 2010, 4:21am UTC](https://forum.kirupa.com/t/where-to-store-game-level-data/307564/1 "2010-04-06T04:21:47Z")

</div>

Hello, I am a long time reader, first time poster.

I have been working on a tile based game. By tile based, I mean the level is composed of tile parts that are all the same size and fit together to make the level. Each level is stored in an array like this.

```auto

        public var lvlArray1:Array = new Array(
            1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
            1,0,0,0,0,0,X,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
            1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
            1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
            1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
            1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
            1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
            1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
            1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
            1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
            1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
            1,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,
            1,1,1,1,1,1,1,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1,
            1,1,1,1,1,1,1,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1,
            1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
            1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
        );

```

So a 1 becomes solid brick. A 2 becomes a ramp and the X is the hero etc.

At the moment this array is in the main AS file. My question is A) Where should I put this kind of information assuming I plan on having lots of levels. And B) if I put it externally, by what method should I retrieve it. Should I use XML for example, and if so, how would I best go about loading in an array of so many values.

I think whatever method I use, it would be best if the data can be laid out in a square, as above, for easier editing.

Cheers, I hope this all makes sense.
