Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2003:
[Freeciv-Dev] Re: (PR#3936) introducing native coordinates
Home

[Freeciv-Dev] Re: (PR#3936) introducing native coordinates

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#3936) introducing native coordinates
From: Jason Dorje Short <vze49r5w@xxxxxxxxxxx>
Date: Sun, 06 Apr 2003 16:08:42 -0500
Reply-to: jdorje@xxxxxxxxxxxxxxxxxxxxx

Raimar Falke wrote:
To understand native coordinates it is necessary to understand
iso-maps. And the latter is the problem. I did never understood
them. Please be gentle with me.

Understanding iso-native coordinates does require understanding iso-maps.

This is what I think iso-maps are: they are a normal map rotated by
45° (pi/4). I think that you also need to rotate the directions (enum
direction8) for this.

The rotation is -pi/4. That way when the iso-view GUI rotates things by pi/4 it looks flat.

The directions *are* rotated, yes. Note that the DIR_D[XY] arrays would have to be changed for native coordinates, and they would be different between iso and non-iso maps. The conclusion is that native coordinates are not good for local operations like moving in a single direction, and these are best done in map coordinates.


Side note: other projects use isometric coordinates as their *only* coordinate system. For instance Freecol does this, and I've read several articles about it. The disadvantage of this is:

- Even for an iso-map, isometric coordinates as not good for some things. Look at freecol's implementation of the map_distance() function, for instance.

- This would not work for non-iso maps, which freeciv uses (and wants to continue to use).

How far is this from the truth? If this is near the truth why can't we
just leave the storage the same of the tile and just change all the
other operations (direction to dir_dx/dir_dy offset and so on)?

Also can you help me with these:

Very close.

Normal map (with non-iso tileset):
 012
 345
 678

Normal map (with iso tileset):
   0
  3 1
 6 4 2
  7 5
   8

Iso-map (with non-iso tileset): is this possible at all?  It should
look like this:

   0
  3 1
 6 4 2
  7 5
   8

Not quite - the rotation is -pi/4, and the coordinates are not sparse. So it is

   25
  148
 037
  6

Remember, this is non-iso view so each tile is oriented cardinally.

but how can this be mapped to a compact grid? Both of

   0
   31
...
and
   0
  31
look wrong.

See below.

Iso-map (with iso tileset): ??
  0 1 2
   3 4 5
  6 7 8

Yep, this is the natural iso-view (as used by the GUI) of the isometric map I wrote above.

From here, it is easy to map into a compact grid just by dividing the X (or Y) dimension by 2. So we get

  012
  345
  678

Which is the "native" representation. It is "native" not because it is the most intuitive, but because it is the easiest system to work with for most (non-local) low-level operations.

jason



[Prev in Thread] Current Thread [Next in Thread]