Hexagonal Grids

Implement hexagonal grid algorithms for coordinate conversions, pathfinding, and rendering.

1|Updated Dec 23, 2025
One-click install
npx skills add https://github.com/15195999826/LomoMarketplace --skill hexagonal-grids
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Hexagonal Grids
Source: https://github.com/15195999826/LomoMarketplace/tree/main/plugins/hex-grid/skills/hexagonal-grids
Command: npx skills add https://github.com/15195999826/LomoMarketplace --skill hexagonal-grids

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This skill provides practical formulas and algorithms to create and manage hex-based boards, including coordinate systems, distances, pathfinding, and rendering.

Core Features & Use Cases

  • Coordinate systems support: offset, cube, axial, and doubled
  • Distance and range calculations
  • Line drawing and hex traversal
  • Hex map generation and pathfinding examples
  • Use Case: Build a hex-based game board and compute distance between two hexes

Quick Start

Start by representing hexes with axial coordinates, compute distance using the max-diff formula, convert to cube for algorithms, and prototype basic pathfinding with a small hex grid.

Frequently Asked Questions about Hexagonal Grids

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement hexagonal grid coordinates for a game board?

Hexagonal grids use three coordinate systems—offset, cube, and axial—each suited to different algorithms. Start with axial coordinates for simplicity, convert to cube for pathfinding and distance calculations, then use offset for rendering. This Skill provides formulas for all three systems and conversions between them.

What's the best way to calculate distance between hexes on a grid?

Hex distance uses the max-difference formula on cube coordinates: distance equals the maximum of the absolute differences across all three axes. Convert your coordinates to cube format, apply the formula, and you have the distance. This method is faster than Euclidean calculations and handles all hex orientations.

How do I implement pathfinding on a hexagonal grid?

A* pathfinding on hex grids requires neighbor queries and hex distance heuristics. Convert coordinates to cube format, query the six neighbors of each hex, and use hex distance as your heuristic function. This Skill includes A* pathfinding examples and neighbor-finding algorithms for all coordinate systems.

Can I draw lines and rings across a hexagonal grid?

Yes. Line drawing traverses hexes between two points using coordinate interpolation. Ring generation creates all hexes at a fixed distance from a center; spiral generation expands outward in rings. This Skill provides algorithms for both, handling edge cases and orientation variations.

What coordinate system should I use for hex grid rendering?

Rendering typically uses offset or doubled coordinates, which map directly to screen pixels. Offset coordinates are the most intuitive for 2D arrays; doubled coordinates avoid fractional values. This Skill covers pixel-to-hex and hex-to-pixel conversions for both systems and handles even/odd row and column parity.

Does this work with different hex orientations and map layouts?

Yes. Hexagons can be oriented pointy-top or flat-top, and grids can use even or odd parity. This Skill handles orientation and parity variations across all coordinate systems, coordinate conversions, distance calculations, and rendering, ensuring robust support regardless of your map design.