PDA

View Full Version : Isometric Grid question


kraz007
01-16-2008, 10:43 AM
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?

monjardin
01-17-2008, 11:31 AM
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.

geon
01-23-2008, 04:43 AM
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.