Reducing File Size
Continuing on from yesterday I created some new structs that could hold just the right data for the tilemaps. I was surprised how tiny the tilemap file became. There were some bugs in it, because I was doing some calculation wrong. But even then the file shrank from 7MB to 180KB. After fixing the bugs I got the right data, but it also shrank even further to a mere 93KB. That’s a huge win and I wish I could reduce the memory footprint like that as well. Though let’s first try to load the data back into the game. However I can’t know if it worked if I don’t change anything first. So I have to expand the editor a bit so I can place some tiles in the tilemap. Shouldn’t be too hard since I already have a SetTileValue function.

On my way back home I wanted to see if I could implement modifying a tilemap. Turns out it was as easy as I said. I already had the pointer to the tile. So after adding some buttons to click and turning on some old code, I could modify the tiles. I think nothing special has to happen when changing the ID of a tile at least. And the ID determines what kind of tile it is.

I also resaved the tilemap to the file. Changing the file size from 96KB to 98KB (so it wasn’t 93KB like I said above). Which means the changes probably worked, as I scribbled some random tiles in empty spaces. The next step is to load the saved tilemap. Maybe I will do it this weekend, but I am already satisfied enough with what I achieved this week to be honest 🙂

Last modified: April 7, 2023