# Isometric

• 03-04-2003
Drealoth
Isometric
Over the march break, a couple of friends and I want to start a MMORPG (call me ambitious).

Anyway, we wanted to create our game with an isometric view, similar to Dransik [www.dransik.com] (yeah, I know it's not really isometric...).

I figured that I could just store the tiles in a 2d array, or 3d if I wanted to make layered tiles, which I probably will, and then slant it. Now my question is: How do I translate the mouse coordinates to whatever grid square (diamond) it is over. I can get it within one, but not exactly. Exams are coming up, so I've been too busy studying to work on it.

Thanks for any help
Martin
chesterfield_warped@hotmail.com
• 03-04-2003
jdinger
Try the isometrix engine to get an idea. The best book for iso games is Isometric Game Programming with DX 7 by TANSTAAFL. Even if you don't plan to use DX for the game the teaching on isometric principles work with any graphics API.
• 03-06-2003
VirtualAce
Well there is an easy trick you can use - I think that Sid Meier used this in one of the Civs or something.

In a paint program draw a section of isometric tile just as it would appear in the game. Now assign a unique color to each section of the tile. Now during the game when the user clicks on any isometric tile, you can use that bitmap to determine if you need to adjust the row and column positions to correctly match the map (2d array) that is in memory.

For instance if we assign green to the center of the tile then we know that if the user's mouse falls on the green section of our bitmap - we do not alter the map coords. Let's say that the upper left most triangle of our bitmap is blue. If the user's mouse lands on blue then we know we must subtract 1 from the column in order to get the correct coords. So in reality you are really only checking the mouse against a 2D grid - the grid size is the size of your bitmap which represents one whole isometric tile surrounded by 4 other isometric tiles. When you retrieve the mouse coords you can find the relative position of the mouse as it relates to that bitmap - retrieve the color - and alter the row,column coords accordingly.

I shall attempt to draw this in text - here goes.

Code:

```B=Blue (0,0,255) R=Red(255,0,0) G=Green(0,255,0) P=Purple(255,0,255) Bl=Black(0,0,0) .................. .      /\      . .  B  /  \  Bl  . .    /    \    . .    /      \    . .  /        \  . .  /          \  . . /            \ . ./      G      \. .\              /. . \            / . .  \          /  . .  \        /  . .    \      /    . .  R  \    /  P  . .      \  /      . .      \/      . ..................```
So if we straighten the grid out so that is is simply a top down type grid we have this.

When mouse lands on:
• Blue(B) - subtract 1 from column
• Purple(P) - add 1 to column
• Black(Bl)- subtract 1 from row
• Red(R) - add 1 to row

Keep in mind that my isometric tile is a bit elongated but it should give you the general idea. Kinda hard to represent with text graphics. Hope this helps.
• 03-06-2003
jdinger
Also, check out TANSTAAFL's site (isohex.net, i think). He has a chapter you can download for free from the book I mentioned. That chapter covers mousemapping.
• 03-07-2003
frenchfry164
Quote:

(((MSVC 6))&&(DirectX 7)||(OpenGL))
Are you trying to say you use MSVC 6 and either DX7 or OGL? The way you wrote it would be wrong, wouldn't it? Since it goes left to right, it would check if MSVC6 and DX7 are both true, if so it comes out as 1. Then it does an OR on that 1 and OGL. I think this would achieve the effect though:
Code:

`((MSVC 6) && ((DirectX 7) || (OpenGL)))`
Correct me if I'm wrong.
• 03-07-2003
jdinger
hehe. you got me. my logic was screwed up on that one. :(

going fix it now....

how's that? :)
• 03-08-2003
LouDu
wow now we are sig checking
:p
• 03-08-2003
frenchfry164
yeppers!:D
• 03-08-2003
LouDu
:o :o :p :p :o :o :p :p