Jump to content


Isometric Grid question


  • You cannot reply to this topic
2 replies to this topic

#1 kraz007

    New Member

  • Members
  • Pip
  • 1 posts

Posted 16 January 2008 - 06:43 PM

I'm working with a Flash developer on a turn-based game that's based on an isometric grid. In terms of technology, the game is similar to Dofus (www.dofus.com), i.e. the map is a single JPEG with the grid being an overlay. Characters move from one tile to the next, etc.

We have a "conceptual" problem regarding the matrix that describes the grid.

Here's the two approaches:

The developer suggests that he rotates the normal grid (consisting of squares) 45 degrees. Since the map is a rectangle, this means that the grid will have to be a LOT bigger than the map itself.

See: http://www.digitalboys.com/grid.gif (map is in red)

My problem is that we'll have to store info for tiles (be it zeroes) that we don't need. The other issue with this approach is that I'd rather have tiles that have a 2:1 ratio (width:height). So rotating a square grid won't work.

The way I look at it, the grid should be like that:
http://www.digitalboys.com/grid.jpg

We don't need all the partial rhombi, so we only keep info for the elements 1-8.

I'd appreciate any feedback from the experts who have already done isometric games. How do you apply the grid when you have a rectangular map?

#2 monjardin

    Senior Member

  • Members
  • PipPipPipPip
  • 1033 posts

Posted 17 January 2008 - 07:31 PM

To get a 2:1 ratio he needs to rotate by arctan(0.5) along the horizontal axis after doing the 45 degree rotation along the vertical axis. This is a typical "isometric"/axonometric projection used in 2D games.
monjardin's JwN Meter (1,2,3,4,5,6):
|----|----|----|----|----|----|----|----|----|----|
*

#3 geon

    Senior Member

  • Members
  • PipPipPipPip
  • 893 posts

Posted 23 January 2008 - 12:43 PM

kraz007 said:

My problem is that we'll have to store info for tiles (be it zeroes) that we don't need.

There is no reason to have unused tiles, other than for the convenience of the programmer. It's simple to just store the tiles in the order that they are numbered in the illustration you used:
http://www.digitalboys.com/grid.gif

But why care? Are your worlds so big that it would be wasting any significant amount of memory? Don't think so. Just do what is easiest for the programmer.

And the size and aspect ratio of your tiles are completely irrelevant for the data structure storing the world data. It's all about tweaking some offsets in the rendering loop.

I wrote a little hexagonal tile renderer in PHP a few weeks ago, and believe me; its easy.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users