Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2004:
[Freeciv-Dev] (PR#8487) RFC: hex tilesets
Home

[Freeciv-Dev] (PR#8487) RFC: hex tilesets

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#8487) RFC: hex tilesets
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 11 Apr 2004 12:29:52 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=8487 >

I'd like to get hex tilesets to actually work.

Basically this means an additional parameter or two needs to be added to 
the tileset, and the drawing code needs to have just a few changes to 
work for hexagons.

The only real design question is how the tileset should specify a hex 
tileset.  Recall that there are two types of hexagons: those with the 
"extra" sides on top and bottom (iso-hex), and those with them on left 
and right (hex).

One possibility is that is_isometric in the *tileset* for hex tilesets 
should mean iso-hex (as opposed to hex).  So a normal hex tileset (like 
isophex) would specify something like

   is_hex = 1
   is_isometric = 0
   hex_side = 16

while a hex tileset may specify

   is_hex = 1
   is_isometric = 1
   hex_side = 16

and a normal iso-tileset may have

   is_hex = 0
   is_isometric = 1

Another alternative (inferior, I think) drops the is_hex value.  Then 
hex_side > 0 means a hex tileset while hex_side == 0 means rectangular. 
  This is shorter but not as explicit.

Yet another alternative would have a better method of specifying whether 
the hex tileset is "isometric".  Your typical developer will probably 
have great difficulty telling hex and iso-hex apart, so something like

   is_hex = 1
   hex_width = 0
   hex_height = 16

may be more understandable (the is_hex value is again redundant).  In 
this case is_isometric is ignored for hex tilesets.

I'm not sure which of these is best.  Probably it doesn't matter too 
much.  Any tileset authors have a preference?


In loading (tilespec_read_toplevel) these values are converted into more 
"useful" internal forms:

- Hex tilesets are drawn like isometric ones, so is_isometric (the 
variable in tilespec.h) is always set.

- hex_side is converted into hex_width and hex_height (also variables in 
tilespec.h).  These values are used in drawing the map grid.  So the map 
grid is basically drawn like an octogon, except that 2 of the side 
lengths are always zero (or 4 of the side lengths, for rectangular 
tilesets).

All told it shouldn't be very hard.  The only drawback is a few dozen 
extra lines of code.  If nobody has any suggestions I'll go ahead with a 
patch.  (See also PR#7481, which includes a partial implementation.)

jason




[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#8487) RFC: hex tilesets, Jason Short <=