Jumper Pathfinder not working on Hexagonal Grid [HELP PLEASE]!

Hellow Guys! Can someone help me get the pathfinder works right on my hexagon grid?

This is How its looking starting from 5,6 to 7,2. Seems weird right? =(

Captura_de_Tela_2014_11_13_s_12_33_17.pn

And another problem: 

It seems that when I set the Y coordinate for 10 or 11 does not work ! And in the rest of the grid coordinates are valid despite being doing a strange way.

Captura_de_Tela_2014_11_13_s_12_36_52.pn

Here is the full code. The pathfinder is working on hexmap-module.lua.

Google Drive link:

https://drive.google.com/file/d/0B4gkRQY2H_o6ZUIwV2VJeFhKSzA/view?usp=sharing

Anyone please?

I didn’t even know Jumper supported Hex grids. I’d suggest you pose the question to Roland Yonaba through the github project, because he would most likely be the one most knowledgeable on the subject.

Hey, OP.

Here’s some good reading material on hex grids.  

http://www.redblobgames.com/grids/hexagons/

I wired up jumper to a hex grid a few months back, it took a bit of research, and my solution was only for a specific type of coordinate system (odd-r) i believe

I may have gone about it the long way, but i wound up making a  3d array , and a bunch of helper functions to convert from one coordinate system to the others… (there’s some good info in the red blob games articles)

In jumper, it was mostly a matter of  changing a 'neighbor ’ function  to look at all six neighbors, in stead of the 4 it usually looks for.  If you haven’t made that mod already, you may get a wonky path back.

r.delia

I`ve already read Reblobgames blog about hex grids but I still cant get it work.

Do you have the project you made with modified jumper working on you hex grid?

rodrigopalmei

Just checked, and yes, I do still have the project. It’s even worse than I remember. :wink:

First, it was specifically for odd r horizontal layout, pointy topped, not flat topped like yours. :frowning:

This was a key part though, creating two different offset tables with all 6 neighbors listed for both even and odd rows: (your offset values will be different)

added to jumper.grid.lua 

[lua]

    local straightOffsets = {

        {x = -1, y = 0} --[[W]], {x = 1, y =  0}, --[[E]]

        {x = 0, y = -1} --[[NW]], {x = 1, y = -1}, --[[NE]]

        {x = 0, y =  1} --[[SW]], {x = 1, y =  1}, --[[SE]]

        – no n/s movement    (pointy tops)

    }

    

    local straightOffsetsEvenRow= {

        {x = -1, y = 0} --[[W]], {x = 1, y =  0}, --[[E]]

        {x = -1, y = -1} --[[NW]], {x = 0, y = -1}, --[[NE]]

        {x = -1, y =  1} --[[SW]], {x = 0, y =  1}, --[[SE]]

    }

[/lua]

Then you’d have to change the  Grid:getNeighbours function to check for even / odd rows,  and apply the proper offset table to populate the neighbours table.

I Still didn’t get it work.   :frowning:

Anyone please?

Anyone please?

I didn’t even know Jumper supported Hex grids. I’d suggest you pose the question to Roland Yonaba through the github project, because he would most likely be the one most knowledgeable on the subject.

Hey, OP.

Here’s some good reading material on hex grids.  

http://www.redblobgames.com/grids/hexagons/

I wired up jumper to a hex grid a few months back, it took a bit of research, and my solution was only for a specific type of coordinate system (odd-r) i believe

I may have gone about it the long way, but i wound up making a  3d array , and a bunch of helper functions to convert from one coordinate system to the others… (there’s some good info in the red blob games articles)

In jumper, it was mostly a matter of  changing a 'neighbor ’ function  to look at all six neighbors, in stead of the 4 it usually looks for.  If you haven’t made that mod already, you may get a wonky path back.

r.delia

I`ve already read Reblobgames blog about hex grids but I still cant get it work.

Do you have the project you made with modified jumper working on you hex grid?

rodrigopalmei

Just checked, and yes, I do still have the project. It’s even worse than I remember. :wink:

First, it was specifically for odd r horizontal layout, pointy topped, not flat topped like yours. :frowning:

This was a key part though, creating two different offset tables with all 6 neighbors listed for both even and odd rows: (your offset values will be different)

added to jumper.grid.lua 

[lua]

    local straightOffsets = {

        {x = -1, y = 0} --[[W]], {x = 1, y =  0}, --[[E]]

        {x = 0, y = -1} --[[NW]], {x = 1, y = -1}, --[[NE]]

        {x = 0, y =  1} --[[SW]], {x = 1, y =  1}, --[[SE]]

        – no n/s movement    (pointy tops)

    }

    

    local straightOffsetsEvenRow= {

        {x = -1, y = 0} --[[W]], {x = 1, y =  0}, --[[E]]

        {x = -1, y = -1} --[[NW]], {x = 0, y = -1}, --[[NE]]

        {x = -1, y =  1} --[[SW]], {x = 0, y =  1}, --[[SE]]

    }

[/lua]

Then you’d have to change the  Grid:getNeighbours function to check for even / odd rows,  and apply the proper offset table to populate the neighbours table.

I Still didn’t get it work.   :frowning:

Anyone please?