Diff for Game Maker: flattening a room's tile layers to a surface at runtime

Sat, 03/31/2012 - 17:52 by LSat, 03/31/2012 - 17:55 by L
Changes to Body
Line 1 Line 1
-This is just a proof-of-concept GML code thing I did for rdein. What it does is this: when you start a room, it draw all of the room's tiles to a surface or series of surfaces, then destroys the tiles. Then it draws the surfaces in place of the tiles. Drawing a few large surfaces is theoretically faster than drawing 1000s of individual tiles, each with their own specific top, left, width, and height values.+This is just a proof-of-concept GML code thing I did for rdein. What it does is this: when you start a room, it draw all of the room's tiles to a surface or series of surfaces, then destroys the tiles. Then it draws the surfaces in place of the tiles. Drawing a few large surfaces is theoretically faster than drawing 1000s of individual tiles, each with their own specific top, left, width, and height values.
 +
 +If your game involves a lot of room transitions then this may be a bit wasteful. In that case you would, in your game's final build, export the surfaces to image files, then import them back into your game and use those instead of either the tile layers or this method.

Revision of Sat, 03/31/2012 - 17:55:

Game Maker: flattening a room's tile layers to a surface at runtime

This is just a proof-of-concept GML code thing I did for rdein. What it does is this: when you start a room, it draw all of the room's tiles to a surface or series of surfaces, then destroys the tiles. Then it draws the surfaces in place of the tiles. Drawing a few large surfaces is theoretically faster than drawing 1000s of individual tiles, each with their own specific top, left, width, and height values.

If your game involves a lot of room transitions then this may be a bit wasteful. In that case you would, in your game's final build, export the surfaces to image files, then import them back into your game and use those instead of either the tile layers or this method.

AttachmentSize
TileSurfacer.gmk85.47 KB