Tile Map for msx1 scrolling scenario

By thegeps

Master (166)

thegeps's picture

25-11-2018, 19:30

Hi all. I wrote a vertical scrolling routine for msx1. It scrolls pixel by pixel in screen2. But I have a problem. The map i want to scroll is very expensive. in the map every tile is 1 byte. The scrolling is full screen, so every line is 32 bytes long. So for 256 line map I have to use 8Kb of memory. Someone can suggest me how to reduce memory usage for the map?

P.S.: ARTRAG se leggi puoi rispondermi in italiano così facciamo prima (anche se una risposta in inglese potrebbe essere utile a più persone, quindi decidi tu)

Login or register to post comments

By santiontanon

Paladin (750)

santiontanon's picture

25-11-2018, 20:23

Hi thegeps, there are lots of different strategies you can use, it all depends on what works best for your game. A few ideas:
1) Rather than encoding your map tile by tile, use some form of space-optimizing encoding, such as run-length encoding (RLE). If your map has large sections of uniform tiles, this can save a lot of space.
2) You can go one step further and compress sections of your map using a compression algorithm, like Pletter. So, you would have the map compressed in ROM, and decompress chunks of it as you need them. And of course, you can combine RLE + compression.
3) Macro-tiles: rather than store your map using 1 byte per tile, create a collection of "macro tiles" (e.g., 2x2, 4x4 or 8x8 tiles) that are preauthored, and then each byte identifies one "macro tile". This was the standard way to store maps in most games in the 80s. With some Nintendo games making extensive use of this, having even a hierarchy of macro-tiles (macro-tiles made of macro-tiles). And of course, you can combine macro-tiles with compression, and have your maps use a tiny amount of space Smile

But there are many other ideas that people have used, these are just a sample. But I hope it helps! Smile

By santiontanon

Paladin (750)

santiontanon's picture

25-11-2018, 20:26

And speaking of macro tiles, I remember I saw a video a few weeks ago explaining the idea of macro-tiles to save memory in classic games that illustrated the idea very nicely. You can watch it here: https://www.youtube.com/watch?v=ZWQ0591PAxM

By thegeps

Master (166)

thegeps's picture

25-11-2018, 21:46

Hi Santiontanon. Thanks for tour help. Can You tell me where I can get RLE and Pletter or informations about them and fully explanations?

By ARTRAG

Enlighted (6113)

ARTRAG's picture

25-11-2018, 23:01

Pletter is here
http://www.xl2s.tk/

By Manuel

Ascended (15190)

Manuel's picture

25-11-2018, 23:25

Google for run length encoding....

By thegeps

Master (166)

thegeps's picture

26-11-2018, 00:12

Thank you all. I'll take a look Smile

My MSX profile