Hello, I’ve been trying to think about ways to use pokitto’s full res with 16 colors while being smart about the ram limit, came up with a proposal because unfortunately it involves messing around with asm lcd code, and I have no clue, so this will need a blessing, some healthy chats and then someone with that skills to go ahead and do this for us all, if we agree it’s the way to go.
Here goes the rumble:
First off, the idea is that we have tiles, 8x8, stored in a map.h file, I’ll simply call this the map.
BackgroundMap: this is a region of the map defined by 4 ints, X, Y, Width, Height.
It acts like a clear-screen, it’s drawn at every refresh, without a buffer, directly uploading pixels to the lcd. The tiles in the bufferCanvasRegion are marked with -1 to know they will be skipped at this stage.
BufferCanvas: the smaller, the more ram you have left for your game, this area is set at compile time and allows for maps to be drawn, scrolled, and sprites to be placed arbitrarily within this region.
MarginOffset: we have 4 pixels that can’t be tiled, they would be set to a palette color, and with an offset value it could be decided if they are all to the right, to the left or split.
DynamicTiles: having the backgroundMap just as a fixed background would make it a useless decoration, we could have a dynamic array of ints to indicate which tile of the backgroundMap will be swapped with another tile from the map at the next refresh.
The lcd upload routine would look up this array before placing a tile of the backgroundMap on screen.
This would allow to use the background map for scores, dynamic text and what not.
The more tiles you want to swap, the more ram you’ll use, I think the array will need a 16bit int to be split between background tile id to swap and new map tile id to use, but at least you get to be smart about it and decide when to use this or not.
SpriteList: sprites are drawn on the bufferCanvas by specifying tiles from the map and x-y offsets, the lcd routine won’t even know about them.
What do you guys think? yay or nay?