The first array is the tile array, which distinguishes which tile which tile from the tile image to draw like:
//Array #1--map tiles 0,0,0,0,0,0,0,0,0,0, 0,9,9,9,9,9,9,9,9,0, 0,9,9,9,9,9,9,9,9,0, 0,9,9,9,9,9,9,9,9,0, 0,0,0,0,0,0,0,0,0,0
Where 0 tells it to draw a wall, 9 is a floor tile.
The second array draws any objects/items on a layer above the map.
//Array #2--items 0,0,0,0,0,0,0,0,0,0, 0,44,44,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,52,0,0,0, 0,0,0,0,0,0,0,0,0,0Where 0 means draw nothing while 44 and 52 are index numbers of tiles from a sprite sheet of items to draw.
While yet the 3rd array determines which tiles are passable or walkable. 1 means impassible, 0 means passable.
//Array #3--physics 1,1,1,1,1,1,1,1,1,1, 1,0,0,0,0,0,0,0,0,1, 1,0,0,0,0,0,0,0,0,1, 1,0,0,0,0,0,0,0,0,1, 1,1,1,1,1,1,1,1,1,1,
For testing purposes I just multiplied the above arrays 50x wide and 100 times long to make a map 500x500 (250k tiles). I found that it worked best up to 500x300 (150k entries in each array).
The actual physical size of having an array 150k entries long is almost 3 megabytes of text, while the actual code to draw the map is a few hundred kilobytes.
I want to make basically roguelike maps, and am wondering how they go about generating the arrays. Like clearly I could just randomly add 150k entries, but the edges of rooms wouldn't have walls, they'd be randomly everywhere.
Ideally I'd use some pre-defined "pattern" arrays for individual rooms, and just randomize "seeds" in the jumbo arrays which determine the index locations to add my pattern arrays.
Anyone have any ideas? You can see what I'm talking about here (runs best in chrome browser) http://simplehotkey....Tiles/main.html


















