How can I constantly update my tile map while moving around?
If you did this with one large map file, you'd have to loop through said map file constantly, and that sure doesn't sound good. I imagine that the best way to do this is to divide your world map up into cells made up of a certain size of tiles. You'd stitch these together; maybe using a 2D array where each position points towards a cell file or something, then when your player moves towards a new cell, the engine knows to load that cell and unload older ones. I thought about doing this back when I was using MMF2 but I'm lazy and never get anything done huehuehue <img src="smileys/smiley9.gif" border="0" align="middle">
EDIT: Alternatively, you could easily just name the cell after the coordinates of the cell in world space e.g. "0,0.map" "0,1.map" etc, and have the game search for the appropriate cell file based on its name when you enter that cell. Would be easier on the processing, too.
What is the best object used for backdrops? Why is that the case?
I see the way you're doing it right now is loading an image for every single tile, meaning VRAM usage is going to inflate very quickly at very large map sizes and cause the map loading process to hang the entire application. This is obviously not a viable solution :(
I think the best way (performance-wise) to do tile-based maps is using only one image for a tileset which is comprised of every single tile you plan to use in your map side-by-side. The image is then loaded into the Tiled Background object and is shared among every instance of the object, then tiles can be picked using the image offset function. But even this method has its problems:
- The image offset function only works for textures sizes that are a power of 2. Obviously this isn't too big a deal, if you're using irregular tile sizes there can be some blank space you can program your game to ignore.
- At runtime, loading a new texture into the Tiled Background object causes it to gain a unique texture. Either we have to set the object's texture in-editor as a game resource or, once again, VRAM usage inflates and the game hangs as a result of trying to load an entire tileset into every single tile.
- I also tried to solve the above problem using the Texture Setter object. Unfortunately, it doesn't affect Tiled Background objects. So much for that idea.
I think this is the method konjak uses in The Iconoclasts, but as far as I know it doesn't use external tileset images, the tiles are presumably stored in the game resources.
You could also try using a sprite object to load every tile image you're going to use into a new frame for the sprite object at the beginning of runtime, then when you're creating a new tile, instead of loading the texture into it, you're just setting the animation frame. I think this method also causes VRAM usage to inflate and locks up the game for a while, but not as much as if you were loading textures into objects individually, since you're only loading the texture for a tile once. Also, since you can't add new animation frames you have to add a whole ton of empty frames in the editor and there'll be a hard limit to how many tiles you can use as a result.
I can't think of any other way to do it. Sorry if I can't be any more helpful. Maybe we should ask r0j0hound why the texture setter doesn't work on tiled BG objects? If it did, things would be so much easier :(
Will invisible tiles consume VRAM as well?
Yeah. It's best to have your loader ignore blank spaces instead of trying to create a blank tile there.