More fun with hexes and approaches

Started by
4 comments, last by wwwHexAttackCom 17 years ago
Guys, okay, we standardized on a layout for hexes. For some reason, that was a bit of a debate even though it really shouldn't matter. In the end, we decided on a 0,0 at the center with the flat sides north and south. North of 0,0 is 0,1 0,2 and then 0,3. Right of 0,0 (and sharing a side with it) is 1,1 and 1,0 (just below 1,1). Okay, so we've essentially come up with 3 different ways to move around the hex map and I'm curious if anyone has any input on which of these ways is best overall, if it doesn't matter at all, or if another way is best. Say you want to move from 0,0 up one hex to 0,1 and then make a slight left up to -1,1. In the game you can move one of several ways and some move you, in a single turn, across several hexes. The first approach was to do this in steps. We broke these down so that step one was to keep your facing the same and move to 0,1. Step two was to turn left 60 degrees and move up to -1,1. This works as a "single" move but seems ... a bit too simplistic. The next method was a functional method to get there in one step. Every move could have a "modifier" based on the facing you're at. So each move would have six different facing modifiers. The move I mentioned above would look like this: (Facing starts at 0 or due North and goes to 5 which is 300 degrees) If Facing 0, X-1, Y+1 Facing -1 (turn 60 degrees left from your starting facing) If Facing 1, X+1, Y+2 Facing -1 If Facing 3, X+2, Y+1 Facing -1 ....and so forth. This gets you there in one immediate move but also seems a bit convoluted. Another member suggested the use of a base number system and multiplayer that he thought would work were you created the facing table once and then each move would have a multiplier applied to that single 6 entry table. That would be even more efficient but I couldn't get it to work when the non-diagonal paths came into play (like the above move). I might not have gotten the idea down entirely though. Any thoughts?
Advertisement
Just to be clear what your asking, your hexes are laid out like in the bottom-left quadrant of this screenshot?

Basically, Yes.

......0,1
-1, 0......1,1
......0,0
-1,-1......1,0
......0,-1

Can't really draw a hex map here...

If you look at the numbers above and ignore the dots, that's pretty much the layout.
Oh, so, y coordinates increase upwards? I'd consider that backwards.
So did I but I lost that argument as I wasn't the one that was going to have to work with the hexes as much as the others. Thankfully it seems to math works regardless as long as we all stick to the same core mapping.... hehehe

You can see in my initial posts that I had the X going upwards and it made sense to me but....
For my game the path finding created a list of Loc's then...
for each newLoc
-get newAngle from currentLoc to newLoc
-face newAngle
-move to newLoc
Admin [HexAttack

This topic is closed to new replies.

Advertisement