Thread: Isometric

  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    5

    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
    [email protected]

  2. #2
    Used Registerer jdinger's Avatar
    Join Date
    Feb 2002
    Posts
    1,065
    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.

  3. #3
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    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.

  4. #4
    Used Registerer jdinger's Avatar
    Join Date
    Feb 2002
    Posts
    1,065
    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.

  5. #5
    In your sig...
    (((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.

  6. #6
    Used Registerer jdinger's Avatar
    Join Date
    Feb 2002
    Posts
    1,065
    hehe. you got me. my logic was screwed up on that one.

    going fix it now....

    how's that?

  7. #7
    |<o>| <--cyclopse LouDu's Avatar
    Join Date
    Mar 2003
    Posts
    137
    wow now we are sig checking
    Languages <> C++, HTML

    /*The Ledgend of Ludlow Coming to a PC Near
    You intro Cinenmatic Needed email me of
    Reply to one of my threads if you can make
    one, thats decent. */

  8. #8
    yeppers!

  9. #9
    |<o>| <--cyclopse LouDu's Avatar
    Join Date
    Mar 2003
    Posts
    137
    Languages <> C++, HTML

    /*The Ledgend of Ludlow Coming to a PC Near
    You intro Cinenmatic Needed email me of
    Reply to one of my threads if you can make
    one, thats decent. */

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Battlestone (Isometric RPG)
    By Bedlam in forum Projects and Job Recruitment
    Replies: 5
    Last Post: 02-14-2008, 03:15 AM
  2. Tile editor isometric test
    By VirtualAce in forum Game Programming
    Replies: 1
    Last Post: 01-01-2007, 08:39 AM
  3. Mapfile for Isometric Tile maps
    By Wraithan in forum Game Programming
    Replies: 12
    Last Post: 09-29-2006, 12:48 AM
  4. Isometric Tile Engine using DirectX
    By Wraithan in forum Game Programming
    Replies: 3
    Last Post: 07-17-2006, 12:16 PM
  5. Isometric Game Engine
    By Sunny in forum Game Programming
    Replies: 0
    Last Post: 06-21-2002, 02:31 AM