Complete.Org: Mailing Lists: Archives: freeciv-dev: August 1999:
Re: [Freeciv-Dev] Suggestion: FreeCiv on a Hex!
Home

Re: [Freeciv-Dev] Suggestion: FreeCiv on a Hex!

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Falk Hueffner <falk.hueffner@xxxxxxxxxxxxxxxxxxxxxxxx>, freeciv-dev@xxxxxxxxxxx
Subject: Re: [Freeciv-Dev] Suggestion: FreeCiv on a Hex!
From: Andy Black <ablack@xxxxxxxxxxxxxx>
Date: Wed, 18 Aug 1999 19:55:54 -0600

At 12:15 PM +0200 8/16/99, Falk Hueffner wrote:
>"Michael A. Rouse" <mrouse@xxxxxxxxxx> writes:
>

[snip]

>
>> Second, replace the square tiles and movement with hexagonal tiles
>> and movement.
>
>Well, that would be really difficult, since the grid structure is
>hardcoded in many, many places in the source, and using a hexagonal
>grid would be a bit clumsy with the poor tools C has for abstract data
>types. I guess I would rather rewrite it...

I think the 2d array with holes would work best, however the holes might
not be needed IF the curent rectangle map was used.  However, if a
spherical map was used, we would need to create a new way to store the data.

rectangle example:
the array looks like
abcde
fghij
klmno

and the grid looks like

a     c    e
    b    d
f     h    j
    g    i
k     m     o
    l     n

if h is the hexagon in quesstion, it's neghbors are (clockwise from the
top) c, d, i, m, g, b
other examples: a is boardered by b & f, c is boardered by b, h & d, f is
boardered by a, b, g & k, k is boardered by f, g, & l

Clear enough?

when looking at the cell boarders, you would look at the folowing array
positions [x-1, y-1], [x, y-1], [x+1, y-1], [x-1, y+1], [x, y+1], [x+1,
y+1]


>> Conceptually, the first suggestion could be accomplished by coding for the
>> triangular mountain fractal (one of the oldest fractal types, where you get
>> an equilateral triangle, randomly adjust the midpoints, draw an interior
>> triangle, adjust *its* midpoints, and repeat), combining twenty of them
>> into an icosahedron, and then warping the icosahedron onto a sphere.
>
>The idea to use an icosahedron is pretty good, because it makes
>movement more realistic. The problem is, how does one project the
>sphere onto the screen? The player would likely want to have any tile
>centered; near the edges of the icosahedron distortions would be
>unavoidable. Real 3D projection with texture mapping would be a bit
>overkill, and it would introduce distortions, too.

forget 3d maping, just use a standard hexagonal grid. the grid would be
drawn as folows
squares used are x and a-g, x is an unknown square
         x/a a a\x
x/b b b\a a a/c c c\x
x\b b b/d d d\c c c/x
x/e e e\d d d/f f f\x
x\e e e/g g g\f f f/x
         x\g g g/x

for graphics, you translate each leter or leter pair into a square on the
current grid, with the combination squares like each quadrant of the
squares on the folowing diagonal map diagonal map.

      x/a a\x
x/b b\a a/c c\x
x\b b/d d\c c/x
       x\d d/x

for keypad movement, 7 is up/left, 8 is up, 9 is up/right, 1 is down/left,
2 is down, 3 is down/right, - rotates the map ccw, + rotates the map cw.
If a tile is duplicate in the view, just highlight in a color like you do
with city worker regions.  that shouldn't happen unless you are on a very
small map.  theroretically you could look at the map sideways or upside
down if you rotate the map, but that would happen if someone crossed the
south or north pole and emerged on the other side of the world.

Is this confusing?

Andy

>       Falk




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