So I'm trying to optimize the workload my game has to do. I'm starting with the way things offscreen are handled, like the background.
Would it be better to use 4 different kinds of tiles (like floor, wall, ceiling, floor 2) and just have multiple instances of them? What about using a single pre-made background? Using the Text Blitter object (for dynamic tilesets)?
Hmm.. I never thought of using text blitter for tiles. It doesn't seem like a bad idea.
The least power-consuming way is to just use backdrop objects as background. If you have a tile, just "paste to background" and delete the tile. That's how most klikers make level editors. Objects used as backdrop don't use processing power. The only flaw with that is that you can't move them around.. but you can paste another object on top of it if you want to change the tile.
Disclaimer: Any sarcasm in my posts will not be mentioned as that would ruin the purpose. It is assumed that the reader is intelligent enough to tell the difference between what is sarcasm and what is not.
The Text Blitter method is a really effective one in the long run, but it's a lot of work to set it up. Remember that things can't collide with a single character in the Text Blitter, so all of you object-to-level collisions will have to be done by referencing an external file.
one thing i've noticed with the text blitter is that string appending in MMF is inefficient, its like concatenating in C without a stringbuilder; if you have excessive loops and LOTS of tiles using text blitter, in order to get the string for displaying your tiles, you may have to 'manually' append the characters as bytes via the binary object, using the byte sequence to form the string for your result, instead of appending each character onto the main string a bunch of times. I noticed this when working with my raycasting engine, as attempting to create 60 strings of 26 length each via character appending would drag my system down to 10 fps, regardless of everything else going on.
That's why you set it up in a manner where you don't need much concatenation.
Instead having a spot in the array being each single tile, you have it be an entire screen's worth of tiles, however long that may be. That way you can have four Text Blitters (so as to cover the screen entirely while scrolling) drawing from no more that four points in the array at any time. Retrieve the string, display it as-is, and it's already displaying your level as it should.
Or you can get really fancy and store your level data (by screens again, I'd recommend) as one continuous string of binary data using the Binary Object. 'Course, then you'd have to come up with your own file format...