   DirectDraw/Tiling
  Hello, I am looking for some advice or an area in which I should look in.Before replying please note this is a piece of University work therefore I strictly want advice, no code.I am creating a Tanks game (Like this one: http://www.mathsisfun.com/games/tanks.html) in C# using Direct Draw (As per the Assignment requirements).However, I am not sure how I would draw multiple instances of the same tile (Size approx 2x2px) without the game slowing to a measly 6FPS.At the minute my Tiling array is as follows, For example:String[,] sSolidTiles [100, 500];This array is then loaded in with the "Tile" Objects name, Example:String[0, 0] = "MP001", Or "Tile.Name = MP001"I then have this in a loop so it draws one tile to the Backbuffer at a time. I am using a list to store my instantiated tiles and then calling .Find and adding a delegate to return the tile with the correct name of which is in the current position in the array, here is a code extract:-----------------------------------------------------------------------------  int iCurrentX = _iMAPSTARTX;  int iCurrentY = _iMAPSTARTY;  for (int iCRow = 0; iCRow < iFrostDataRow; iCRow++)  { for (int iCColumn = 0; iCColumn < iFrostDataColumn; iCColumn++) {if (sMapFrostData[iCRow, iCColumn] != "0"){    frmMain._sfBACKBUFFER.DrawFast(iCurrentX, iCurrentY, frmMain._sTILELIST.Find(delegate(Tile o) { return o.TileName == sMapFrostData[iCRow, iCColumn]; }).ToSurface(), DDraw.DrawFastFlags.SourceColorKey | DDraw.DrawFastFlags.Wait);}iCurrentX += frmMain._iTILEFROSTWIDTH; } iCurrentX = _iMAPSTARTX; iCurrentY += frmMain._iTILEFROSTHEIGHT;  }-----------------------------------------------------------------------------I'm not sure if there may be a faster, more efficient way of looking up the right tile that correspond with the value in the selected point in the multidimensional array.Things to note before replying are:-These "Surfaces" NEED to be referrable, meaning I can add them too a list so I can create some kind of "Crater" in them when a player fires.-These "Surfaces" NEED to allow room for expansion (Meaning easy to adjust).-These "Surfaces" Must be done in a way in which I can efficiently add Collision Boxes too themNOTE, These tiles are drawing the lower surface of the game (The Floor).Thank you very much for your time, And I would appreciate some intelligent responses./John   
  Bump ^_^   ;  May I suggest a different method?Render the terrain to a texture.How slow would it be to read a pixel color from the texture? (I guess not so slow).So make your collision detection a simple color check. If you hit terrain, then you have to destroy the terrain:Render only the terrain, render the destroyer stuff onto it in background/clear color (a circle for example, but can be any arbitrary shape: lines, and you have created a earth-cracker weapon), then copy the image back to the terrain texture buffer.I doubt that this would be slower than a DOS VGA getpixel stuff, which I did (same kind of game). And it was smooth/fast.I hope it makes sense.BTW I made a pretty cool tank game, and finished it too, so I guess I could give you some advices.   ;  Thank you very much for your input.I'm going to put your theory to work now and see what I can come up with./John   ;  Okay, I have found the solution. Thanks to user "szecs", thank you!I have drawn a .BMP map using a Solid Color Key at Position X, Y. And a Transparent Color Key at Position X, Y.I have then stored these in the map class for that current map.Now when I want to create a crater, I draw a circle that is filled with the same color of which my background is.I would like to ask one question if I might, Now I can create a Crater, This is STILL only another surface on top of my old surface, The Pixel Collision detection works perfectly although I would like my tanks to be able to move in the craters so they are true areas of nothingness.I am just wondering if I have to check Collision Detection against the Craters AND the Map, or there is a way to Merge the "Crater" Surface with the "Map" Surface.*EDIT*Done, For other people if they come accross this same problem I merged two layers by going to their original source, the Bitmap. I converted this to an Image then used the Graphics.DrawImage() method on it, this allowed me to draw a Crater on top of my Map image, You then just redeclare the Bitmap used in creating the surface and hey presto you have a crater on the surface itself./John[Edited by - 02goswej on April 26, 2010 6:37:37 AM];  That's the way to do it.I tried to say that, but I don't know SDL/Surface etc.I hope it works fast enough. If you have questions about other parts of the game, you will certainly get help here (I'm curious about how will you make the terrain collapse...)   ;  Couldn't you do it on GPU?I mean store the terrain as a texture. I guess there's a way to read directly from the texture object. On terrain destruction you could draw the texture as a quad, draw the void onto it, then copy the resulting image (frame-buffer) back to the texture. To speed it up, copy only the rectangle that encloses the new void.You have to draw the terrain for display anyway, So no need to have two pieces of it. Or maybe I misunderstood your post.Even better, use offscreen buffer for the terrain destruction.   