Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Drawing a background of tiles
#4
Hi!

That is not exactly true in tilengine. It doesn't create any huge surface and blit portions of it, as other 2D engines do. What is held complete in RAM is the tileset (the set of individual graphical tiles) and the tilemap (the arrangement and attributes of tiles). But the tilemap requires just 4 bytes per tile, and as it was done in the old days, the picture is composed in realtime fetching scanlines of tiles as the tileset data says. So you can build your stupidly huge 2D game in a small amount of RAM. Tilengine keeps track of the memory used by all loaded assets (tilesets, tilemaps, spritesets, palettes and animations) and you can query it with the TLN_GetUsedMemory() function at any time. For example, if you check it with the "platformer" example loaded (the one with the Sonic 1 assets, multi parallax scroll and animated tiles and palette), it yields about 143 kilobytes. As with classic 2D systems, what takes memory is the amount of different tiles, not the map size.

Or as another example, imagine you have a tileset that is 16x16 in size, with a screen resolution of 640x360 (TilenginePythonPlatformer does this). A map of 20 screens wide and 3 screens tall would be just 211 kbytes: (640*20) * (360*3) * 4 / (16*16) = 216,000 bytes. Add the size of the tilemap: each 16x16 tile takes 256 bytes (1 byte per pixel), if your tileset for that map is composed of 1,024 unique tiles (that's arcade quality), that's just another 256 kbytes. In contrast, the tileset of the foreground layer in Sonic world 1 is less than 352 unique tiles, and that one is a graphically rich game...

If you use tilengine for your next project, you'll have super easy scroll and low memory footprint with graphically rich huge maps  Smile
Reply


Messages In This Thread
Drawing a background of tiles - by Domarius - 10-02-2018, 10:14 PM
RE: Drawing a background of tiles - by megamarc - 10-08-2018, 06:58 AM
RE: Drawing a background of tiles - by Domarius - 10-08-2018, 01:49 PM
RE: Drawing a background of tiles - by megamarc - 10-08-2018, 05:52 PM
RE: Drawing a background of tiles - by Domarius - 10-10-2018, 01:40 PM
RE: Drawing a background of tiles - by megamarc - 10-24-2018, 05:05 PM
RE: Drawing a background of tiles - by Domarius - 10-30-2018, 03:50 PM
RE: Drawing a background of tiles - by megamarc - 10-31-2018, 04:36 AM
RE: Drawing a background of tiles - by Domarius - 11-02-2018, 11:23 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)