Tile map rendering

I just created an example of how to render single screen tile maps with Corona.
You can read explanation and full source at:
http://pixels.ph4.se/2010/10/tilemaps-with-corona-part1/

Will follow up with scrollable tile maps. [import]uid: 10454 topic_id: 3149 reply_id: 303149[/import]

Great example! I was considering a similar approach (looping through arrays to output specific tiles) until Corona gets full tilemap support, perhaps via a third-party solution like “Tiled” (www.mapeditor.org).

To repeat what I wrote a few days ago on the subject, I might also consider layering multiple tilemaps, each using different “grid sizes”. For example, you could build 3 arrays instead of just 1 array. The first uses 160x160 pixel images, the second 80x80, and the third 40x40. In the largest grid size, you’d place big expansive areas… large areas of brick, ground, grass, whatever. Thus, one “supersize” tile (a separate image file) consists of 4 “small” tiles, but it takes the place of 4 separate sprites in the Corona engine… a memory saving approach, I’m guessing. Then you’d move to the next array, “medium” (80x80) and fill in some other tiles as needed. Finally, you’d finish out the level design using small 40x40 tiles, but instead of 96 of them, there would probably be half that number (or less!) depending on how much area you’ve painted in the previous maps.

Eventually, all of the tiles would be fused together in a DisplayGroup() so they could be moved around as a single unit.

I look forward to your scrolling tiles approach!

Brent
[import]uid: 9747 topic_id: 3149 reply_id: 9301[/import]

I’ve written a follow up now.
http://pixels.ph4.se/2010/10/tilemaps-with-corona-part2/

Will continue writing from time to time.
Probably about other things too, like sprite bleeding. [import]uid: 10454 topic_id: 3149 reply_id: 9535[/import]

have you made any attempts at integrating physics. I’m wondering if the box2d engine is actually optimized for only testing nearby objects etc and you can define the whole world up front, but visibly you need to optimize the rendering as per your example. Not sure how this would work with Corona and your method since the physics is usually tied into separate visible display objects, but your scroll method is reusing objects [import]uid: 6645 topic_id: 3149 reply_id: 12964[/import]