Skip to content

Wrapping does not work near corners #8

@dan-modsi-io

Description

@dan-modsi-io

So, first, love this series of videos. Learning so much. Thanks!

Now, bug report.

When north-south wrapping is turned on the Hex.GetNeighbours() function returns "incorrect" values when the origin Hex is in a corner. Specifically when the origin is 0,0. I have not had time to test the other corners, but given the nature of the issue I imagine they all have the same issue. In fact, my best guess is any coordinate along the north or south borders will suffer from this.

So, on a Rows = 30 by Columns = 40 map, if your origin Hex is 0,0 and you enable East-West and North-South wrapping, then the tiles surrounding 0,0 in function order are

1,0    39,0    0,1    25,29    26,29    39,1

however, the results of Hex.GetNeighbours() are

1,0    39,0    0,1    0,29    1,29    39,1

So we can clearly see the issue is with the two R minus 1 coordinates. If you turn wrapping off you can clearly see why the GetNeighbours values are chosen. The values make sense mathematically with the skewed (rhomboid?) shape. But visually they are incorrect. And from a user's perspective nobody cares about the correctness of the math as their units are jumping all over the board for no apparent reason.

I'll continue to work on this, but I'm not sure if my math skills are up to snuff.

Keep up the fantastic work!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions