isometric hex grid?
monkeygoat

Hello,

Just purchased and have been playing around with the isometric plugin. I am looking at extracting the fallout 2 sprites and playing around with a personal project. Fallout 2 uses a hexagonal grid for movement and I was curious if there was any way to support this. I didn't see anything obvious in the API so I assume it would not out of the box. If you have any pointers on how I could go about adding this support I'd love to hear it!

Gio

Hi

You are right, it isn't supported out of the box. It is something that we do want to support at some point, but it is a fairly big change.

There are several aspects that you would need to change to make it work:

1. In the isometric plugin, in terrainBehavior.js, there are functions to convert from world coordinates to grid coordinates and viceversa. This will need to take into account the position and shape of hex cells, and it's slightly tricky - there is a pretty good explanation of the maths here and here. This is probably the most difficult bit. When you change these, I think the positioning of the hex tiles by the iso plugin should just work automatically.
2. In iso.js, there is a main loop function that updates the grid position for moving objects. This will need to be changed and is fairly simple once you've completed step 1. You could also ignore the existing code that checks for floating-point errors when moving diagonally - it no longer applies when moving on a hex grid, so it's  actually simpler :)
3. Pathfinding. There is a function called findPath. This defines an array of "neighbors" for each cell, and that's the only bit that needs changing. Bear in mind that this list, however, may be different depending on whether you are on an even or an odd row of your hex grid.

All in all, it isn't too difficult, but I wouldn't say it is easy either and to be honest I would only attempt this when you are really quite familiar with how the iso plugin work (maybe after making a simple game or two with square cells).

Like I said, it's something we would like to look into at some point. Unfortunately it's fairly low priority at the moment, as we need to finish the visual editors for wade and wade.iso first :)

monkeygoat

wow thanks for the detailed & quick response! Yeah I've been reading up on how other engines do it *just* incase :>. I'll stick with the grid for now and see if i can get it to work as-is. Thanks again!