   Get ISO tile from x, y
  I previously implemented a map for my 2d rts as a simple square-tiled map.  I have decided to go back and make it isometric, using diamond tiles.  I have gone through the tuts in the references section, and I still have one question.  Is using a Mouse Map really the best way to get a given tile at a x, y position?I don't have any height maps or anything to worry about on my map, so is there a simple way to get a tile from a given world x, y coordinate?  For example, user clicked at world-location 250, 400, what tile is this?The main reason I ask is for pathfinding.  Before when i used square tiles all of my pathfinding nodes were the same size and shape as my map tiles.  So I assume it would be the same for iso maps?  If so, in A*, when getting the Adjacent tiles, it seems like a lot of work to have to use a mouse map to find the adjacent tiles*.* Side Note: I have thought about calculating the 'neighbors' at run time for each path node. This way I don't have to do get each one when finding a path.Any tips or references would be appreciated.I'm using C#/XNA, and my tiles are 64x32, diamond shaped.Thanks,Jeff   
  I'm not sure if this would work, but i drew a quick picture and this is what i came up with.If the map is square it too is the diamond shape with 2 60degree corners and 2 120 degree corners.Call one of the 60 degree corners the map origin, and vectors pointing to the 120 degree corners the x and y basis vectors.So to compute the XY map coordinate you'd first subtract the map origin from the world point (the clicked point), to get a local map point. Then you'd dot the local map point with your x y basis vectors to compute the XY map coordinate.Each tile will be spaced a particular distance along these basis vectors. You'll just need to divide the XY map coordinate by this interval to compute the index, then you should be able to look it up easily in your map table.   ;  When you say map are you referring to the mouse map or the world map?Now that I think about it I'm drawing my map kind of funny.  In most Iso games (Age of Empires for example) the map is displayed as a diamond (like in the mini map, with blank space in each of the 4 corners), AND it has diamond shaped tiles.  I am actually using diamond shape tiles, but drawing them in a square.  Here is the best I can do for a pseudo map without a screen shot (I'm at work).\\//\\//\\//\\//\\///\\//\\//\\//\\//\//\//\\//\\//\\//\\/\/\\//\\//\\//\\//\//\//\\//\\//\\//\\/\/\\//\\//\\//\\//\//\//\\//\\//\\//\\/Will this method work?  Or should I change it to a diamond map as well?EDIT:  Haha, apparently it was trying to interpret my backslash as part of a carriage return, so I had to end each line with a forward slash   ;\\//\\//\\//\\//\\///\\//\\//\\//\\//\//\//\\//\\//\\//\\/\/\\//\\//\\//\\//\//\//\\//\\//\\//\\/\/\\//\\//\\//\\//\//\//\\//\\//|\\//\\/I tried to illustrate the world map origin | and bolded the map basis vectors. If i understand your drawing correctly, could you do a MsPaint drawing?I really dont know how you're storing your map, so i'm not sure exactly how you'd want to compute indices. If you could make a small illustration showing the tiles numbered with their index, we might be able to help you come up with an algorithm to compute it.I'm not familiar with a mouse map btw.   ;  I store my map in a simple 2D Array.  Here is a quick sketch I did of how the tiles would look on a really small map.  The coords are world coordinates.The array for this map would look like this (where 1 is the texture ID):1 1 11 1 11 1 11 1 11 1 1One thing I should note is that the world coordinates for a given tile are actually the top left corner of the Square texture. So the coordinate for tile is actually located at X:Since I'm still in the process of moving this from a square-tiled map to an iso map, I may have to change this so that the coordinate of the tile is at the center?  Suggestions?Here is an article that talks about the mouse map, its at the very end of the article.http://www.gamedev.net/reference/articles/article747.asp   ;  You didnt provide a very useful example since the map is just entirely the same value. Number your map from 1 to NUM_TILES, and then put that number on the tile diagram. As if each tile had different texture id, and those textures just contained their ID.It's super handy to have this kind of map available for debugging. To turn on rendering the indices of the map, rather than the texture data.I need to figure out your mapping from the graphics to the map. I wont need your physical coordinates, just the relationship of the indices.This would be a sane mapping:0,  1,  2,   3,  4,5,  6,  7,   8,  9, 10, 11, 12, 13, 14,15, 16, 17, 18, 19I can see your mapping now, I would highly recommend switching to mine or the conversion formula will be much more complex. Also rotating would probably suck balls with yours, just a hunch.In my mapping, the camera is always looking in a combo direction, such as NW, NE, SE, SW. That way rows and columns are aligned to NS and WE, it makes rotation very simple as well as mapping the mouse to the map. Not to mention adjacency info is trivial to compute.   ;  I'm going to go ahead and switch to the technique you have.  It's something I had considered anyways.Sorry I didn't see that you wanted the tile index.  I assume you mean indices as in what location in my array they are? The indices for my map would be:Edit:  every odd row is shifted a half tile width to the right.and from file it wold be:0,0  1,0  2,00,1  1,1  2,10,2  1,2  2,20,3  1,3  2,30,4  1,4  2,4 Not sure if this is what you want though.  Judging by what you have I'm either way off or you store your indices in a List, not an array?  You also mentioned rotation, mine is 2D and won't be rotated at all, simply scrolled up or down.  Also, what order is yours drawn in?  Wouldn't the order of your tiles be drawn:4, 3, 9, 2, 8, 14, 1, 7, 13, 19, etc.?Maybe I'm just confusing myself...haha.Any way back to my original problem, going by how your map is set up, how do you get a tile from x,y coords?Thanks for your help and patience so far.   ;  You're correct in the drawing order.Here is the updated diagram:The algorithm is://map variablesVector C; //world point of corner of mapVector X, Y; //unit vectors pointing in direction illustratedfloat iX, iY; //length of tile along X and Y axisint xSize, ySize; //size of map in tilesint clickMap(const Vector &worldPoint){ Vector localPoint = worldPoint - C; Vector isoPoint(Dot(localPoint, X), Dot(localPoint, Y));  if (isoPoint.X > 0 && isoPoint.Y > 0) {  int xIndexT = isoPoint.X / iX;  int yIndexT = isoPoint.Y / iY;  if (xIndexT < xSize && yIndexT < ySize)   return xIndexT + yIndexT * xSize; } return -1;}You can still rotate in isometric, there is just a limited number of view orientations. You just reorder the tiles and draw the rotated version of each tile map.   ;  There is another thing you might consider:Later on you might want to use an algorithm such as A* to do pathfinding.Of course you can use an (isometric) 2 dimensional array to store the map information but when you want to add information such as travelingspeed and reachability you might be better off with by storing the map in a network structure which also allows more complex structures such as multiple floors. This could be an extra layer or could entirely replace the two dimensional array.   