Apr 19, 2013

Nametables and Attribute tables made easy! I was hesitant to try this because of how GM automatically updates itself sometimes, but I'm pleased to say my latest hypothesis has thus far panned out.

GM's tiles are essentially a nametable at their heart. When you place a tile in the room, GM stores at that tile's address the background index, left-side coordinate, top-side coordinate, x, and y. What this means is so long as you don't delete the background index, all the tile data remains in the room no matter what you do to the background itself.

Suppose you loaded up a tileset containing all the TSAs for Cagliostro Manor and designed all your rooms that would use that tileset (remember, one tileset per room). All the tiles have their data stored in the GMK now and will index back to that Caligostro Manor tileset. Even if you set the tileset to be just 1x1 px in size, GM only cares if the background_index is the same. You can thus design your rooms with background0 set to use the set of TSAs for that room, go to the next room and set background0 to the TSAs for that one, and so on and so on, then set background0's dimensions to 1x1. Create background1 and leave it blank.

You could then store with your game a set of files that specify which GIF files to load into background1 (although this could be easily set in the Room Settings), which palette entries (0 through 3) are used in each TSA (as defined by their coordinates in background0) and the metatiles used, and which tiles are used in each metatile as defined by their coordinates in background1. You could then use draw_background_part() to display the tiles.

Since this would need to be processed each step, this is probably a bit slower than just using tiles. If any of you want to test out the feasibility of such a system though, feel free to contact me about it.

No comments:

Post a Comment

©TheouAegis Productions™. Powered by Blogger.