How to set/determine a tile's clickable region?

Contribute, display and discuss art and tilesets for use in Freeciv here.
Post Reply
Treefingers
Posts: 20
Joined: Fri Nov 08, 2013 11:40 pm

How to set/determine a tile's clickable region?

Post by Treefingers »

Quick background: I'm building a hi-res (128px-wide) hex tileset. Iso perspective for the art, but using the "non-iso" (i.e. flat sides) orientation in the tilespec.

Anyone know what determines a tile's hotspot? I've got all my test graphics the right size and lined up properly. But for some reason, the actual clickable are of my tiles is about 20px higher than it should be. It seems to be the right shape, though. And I've checked the maths and whatnot, so I'm all but certain I've got the vertical metrics set correctly.

My basic tile graphic is a 128x128, with a 128x84 hexagon set tight to the sides and 4px from the bottom of the bounding box (so 40px from the top). I've used this basic structure for everything except the coastlines.

All the visible tile graphics (special resources, upper tile layers, user_attention cursor) line up appropriately when based on my standard tiles. So my guess is that the hotspot is placed automatically with values derived from some graphic's dimensions, but does anyone know which one? I'm not about to go messing with all my grid dimensions if someone already caught that goose (or found that needle, if you prefer).

Thanks, folks!
Treefingers
Posts: 20
Joined: Fri Nov 08, 2013 11:40 pm

Re: How to set/determine a tile's clickable region?

Post by Treefingers »

Made a very simple tileset to test this out. I tried a number of values of bounding boxes around my base hex to see if I could get the hotspot and visible hexes to align. My base hex fits in a bouding box of 128x84, with 42px vertical sides. The only way I could get the hotspot and hex to align is when the top of my hex's bounding box is 19px from the top. The bottom margin has no effect; I can have it tight to the hex or 100px and the hotspot does not shift.

There seems to be some kind of hard-coded relation here. And I can't see any obvious relation between the 19px margin and any of my other values. So trial and error seems the order of the day. To avoid headaches, make sure you figure this out early when starting a new tileset.

And if anyone can explain this, or knows a spec property that can shift it directly, I'd really appreciate understanding what's going on here.
Post Reply