   Tile game question.
  I''m using DirectDraw to write a tiled game.I have a relatively simple question:I have many tiles, all different sizes.  I want them all to be loaded into memory (they are small).  What would the best way to store them be?  Is it a problem if I create a DirectDraw surface for each one?  Is there a lot of overhead in doing that?  Does it work?  Please help this newbie!-g  
  As for creating a surface for each tile I don''t think this will cause any problems, but may take up a little more memory and the fact that you have to worry about a larger number of surfaces.  ;  I guess I''ll try this.  What does everybody else do?  ;What I''ve done in the past is create a direct draw surface for each tilesize, and put all like-sized tiles in one surface.So, I''d have a surface for each size: I''d put all my 32x32 tiles in one surface, all my 16x16 tiles in another surface, all my 64x64 tiles in another one, the 16x32 tiles in yet another one, etc, etc ... It works well. For me anyway.;  Another thing you can do is group the tiles by their type - all terrain tiles in one bitmap, terrain objects such as rocks, trees, etc in another, building bitmaps in another, etc. Use a tile header file to keep track of what''s where so you know how to read them in.Is this the reason your tiles are different sizes, because they''re for different things?    Breakaway Games;  I found having many small surfaces slows down the performance of DirectDraw, im guessing this is because DirectDraw checks the variables and states of every surface after every flip (or something along those lines).The way I do it is have all my 32x32 tiles on one 640x480 surface and use source rects when blitting. Its also a good idea to keep your tile surfaces in powers of 2 (i.e. 512x512) just in case you wish to convert from DDraw to D3DX 2D sprites.      Game Download  ZeroOne Realm ;  I don''t know how many different tiles you got, but why notstore all in one surface (if not to many), and then use a struct to describe each tile. If you have more tiles than what fits on one surface you can use an array and store the index for the surface that the tile belongs to.Struct TileType{//   char surface;   // surfaceindex   int x,y,dx,dy;}It saves a LOT of memory and performance compared to you suggestion.  ;  I also do what necator suggests, but I suggest you use rects to store the location data rather than with ints. If each tile struct has a rectangle predefined, it is a very easy matter to use this rect in your blit call,Zen  