   flood filling for my game editor
  I''m creating a 2D game/world editor, and I''m trying to implement the flood fill feature, so you don''t have to manually place tiles one by one.i''m lost as to how i would find the area bound by a different tile (analogous to pixels of a different color in MSPaint).any help is appreciated.thanks! 
  surely some of you have created your own game editors with this feature?yes i admit this is also a *bump* bost ;  It''s simple to implement but hard to explain without a lot of code. So lookup "scanline algorithms" and "rasterization techniques". ;  thanks!  ;  Or if you''re lazy you can always go for the recursive approach, using real recusrion or with your own stack. ;  just google for flood fill algorithms or something ;  A simpler to understand, and marginally slower in implementation way to do it is to use depth first search on the pixels, but you will need O(n) metadata for it to work.   George D. FiliotisI am a signature virus. Please add me to your signature so that I may multiply.;  One of the easiest way is to take the color of your starting pixel,  look if it''s neighbours have the same color, and for the neighbours that do, repeat the same thing.... ;  simple, but not very efficient. but it''s for an editor... void floodfill(x, y){    Tile T = GetTile(x, y);    int neighbours[4][2] = { { -1, 0 }, { 1, 0 }, { 0, -1 }, { 0, 1 } };    for(int i = 0; i < 4; i ++)    {   int dx = neighbours[i][0];   int dy = neighbours[i][1];   if (GetTile(x+dx, y+dy) == empty_tile)   {   GetTile(x+dx, y+dy) = T:   floodfill(x+dx, y+dy);   }}};  I''ve also seen the A* algorithm used for flood filling.But yes, you want to take the value of your starting tile and find all connected tiles with the same value.BTW, I thought at first that oliii''s technique was just infinitely recursive, but it works because when you floodfill the neighbours you''ve changed your own value, so they don''t floodfill you back. It does risk a stack overflow if the area is large...The A* approach is to ''pathfind'' to a tile not on the map (i.e. an unreachable tile) while constraining yourself to tiles with the same value as the original one. The algorithm will touch every connected tile with the same value (I think they end up on the closed list) so you can just process that list and flip them all quickly. 