Handmade Hero»Forums»Code
70 posts
innovation through irritation™
Movement on spherical vs toroidal tile map
Edited by d7samurai on
You do it like this:

http://i.imgur.com/YnfT3uE.png

The only special case is if the hero is at the very upper, leftmost PIXEL and then moves perfectly diagonally up/left - which you solve by translating such a move to be up OR left (and similarly for the other corner pixel positions). It doesn't really matter because you'll end up (i.e. still find yourself) at the "pole" either way.
70 posts
innovation through irritation™
Movement on spherical vs toroidal tile map
Edited by d7samurai on
Essentially, you take the traditional way of mapping a sphere to 2D (like if you were to make a globe out of paper) - http://www.gma.org/surfing/images/gores.gif - and "inflate" each eye-shaped vertical strip into a tall rectangle:

http://i.imgur.com/lkrWhE5.png

Since as a player you ever only see the world locally, in discrete 'screens', you don't have to worry about the distortion that *would* happen in a corresponding 'proper' geometrical mapping (the same reason you don't have to worry about distortion with a full-on toroidal mapping in this context).
Stefan
20 posts
Movement on spherical vs toroidal tile map
Edited by Stefan on
I'm sorry if this is a stupid question, but didn't you just describe a cube?

Edit: Thought about this for a bit more and I realise now that if you were to wrap the tile map around a cube you will have to get rid of a few tiles, since the tile map would have be a cross shape.
70 posts
innovation through irritation™
Movement on spherical vs toroidal tile map
maudrid
I'm sorry if this is a stupid question, but didn't you just describe a cube?

Edit: Thought about this for a bit more and I realise now that if you were to wrap the tile map around a cube you will have to get rid of a few tiles, since the tile map would have be a cross shape.


And because of that, the mapping of geography / wrapping of movement would be completely different.