Skip to content

Instantly share code, notes, and snippets.

@transientlunatic
Last active April 29, 2021 20:56
Show Gist options
  • Save transientlunatic/5c6927a07a0f8caf0d30201a95d05648 to your computer and use it in GitHub Desktop.
Save transientlunatic/5c6927a07a0f8caf0d30201a95d05648 to your computer and use it in GitHub Desktop.
Hexagons for map-making in the Traveller RPG
%
% x=3*(minimum size)/2
% x=\sqrt{3/4}*(minimum size)/2
%
\usetikzlibrary{shapes.geometric}
\usetikzlibrary{calc}
\def\hexdia{1cm}
\def\x{1.5*(\hexdia/2)}
\def\y{sqrt(0.75)*\hexdia/2}
\begin{tikzpicture}[x=\x,y=\y]
% some styles
\tikzset{
box/.style={
regular polygon,
regular polygon sides=6,
minimum size=\hexdia,
inner sep=0mm,
outer sep=0mm,
rotate=0,
draw
}
}
\foreach \i in {0,...,5}
\foreach \j in {0,...,5} {
\node[box] at (2*\i,2*\j) {};
\pgfmathsetmacro\a{int(2*\i)};
\pgfmathsetmacro\b{int(2*\j)};
\node (\a,\b) at (2*\i,2*\j) [] { };
\node [color=gray] at (\a,\b) {\a,\b};
\pgfmathsetmacro\a{int(2*\i+1)};
\pgfmathsetmacro\b{int(2*\j+1)};
\node (\a,\b) at (2*\i+1,2*\j+1) [] {};
\node [color=gray] at (\a,\b) {\a,\b };
\node[box] at (2*\i+1,2*\j+1) {};
}
\node [
\end{tikzpicture}
%
% x=3*(minimum size)/2
% x=\sqrt{3/4}*(minimum size)/2
%
\usetikzlibrary{shapes.geometric}
\usetikzlibrary{calc}
\usetikzlibrary{positioning}
\def\hexdia{2cm}
\def\x{1.5*(\hexdia/2)}
\def\y{sqrt(0.75)*\hexdia/2}
\begin{tikzpicture}[x=\x,y=-\y, ]
% some styles
\tikzset{
box/.style={
regular polygon,
regular polygon sides=6,
minimum size=\hexdia,
inner sep=0mm,
outer sep=0mm,
rotate=0,
draw
}
}
\def\astart{17}
\def\bstart{11}
\def\south{Tlaiowaha}
\def\north{Pax Rulin}
\def\east{Tobia}
\def\west{Dpres}
\foreach \i in {0,...,3}
\foreach \j in {0,...,9} {
\node[box] at (2*\i,2*\j) {};
\pgfmathsetmacro\a{int(2*\i)};
\pgfmathsetmacro\b{int(2*\j)};
\pgfmathsetmacro\alabel{{int(\astart+\a)}};
\pgfmathsetmacro\blabel{{int(\bstart+\j)}};
\edef\nodename{\alabel\blabel};
\node (\nodename) at (2*\i,2*\j) [] { };
\node [color=gray] at (\a,\b-0.7) {\small \texttt \nodename};
\pgfmathsetmacro\a{int(2*\i+1)};
\pgfmathsetmacro\b{int(2*\j+1)};
\pgfmathsetmacro\alabel{{int(\astart+\a)}};
\pgfmathsetmacro\blabel{{int(\bstart+\j)}};
\edef\nodename{\alabel\blabel};
\node (\nodename) at (2*\i+1,2*\j+1) {};
\node [color=gray] at (\a,\b-0.7) {\small \texttt \nodename};
\node[box] at (2*\i+1,2*\j+1) {};
}
\draw [ultra thick] (-0.695,-1) rectangle (7.695,20);
\node at (3.5, 20.6) [text centered] {\textsf{\south}};
\node at (3.5, -1.6) [text centered] {\textsf{\north}};
\node at (-1, 9) [text centered, rotate=90] {\textsf{\west}};
\node at (8, 9) [text centered, rotate=-90] {\textsf{\east}};
% Third Imperium
\foreach\sector in {2411, 2312, 2211,2212,2213,2313,2412,2413} {
\node [box, fill=red, opacity=0.4] at (\sector) {};
}
\newcommand\waterplanet[8]{
\node [circle, fill=blue] at (#1) {};
\ifthenelse{\equal{#8}{}}{}{ \draw [ultra thick, color=#8] (#1) ellipse (.8cm and .8cm) };
\node [above = .7 of #1] {\tiny \texttt{#2}};
\node [right= .07 of #1] {\tiny {#4}};
\node [below= .8 of #1] {\small {#5}};
\ifthenelse{\equal{#6}{G}}{\node [above right= .07 of #1] {\tiny {#6}}}{};
\ifthenelse{\equal{#7}{T}}{\node [above left= .07 of #1] { {$\star$}};}{}
\node [above = 1 of #1] {\small \textsc{#3}};
}
\newcommand\planet[8]{
\node [circle, draw=black] at (#1) {};
\ifthenelse{\equal{#8}{}}{}{ \draw [ultra thick, color=#8] (#1) ellipse (.8cm and .8cm) };
\node [above = .7 of #1] {\tiny \texttt{#2}};
\node [right= .07 of #1] {\tiny {#4}};
\node [below= .8 of #1] {\small {#5}};
\ifthenelse{\equal{#6}{G}}{\node [above right= .07 of #1] {\tiny {#6}}}{};
\ifthenelse{\equal{#7}{T}}{\node [above left= .07 of #1] { {$\star$}};}{}
\node [above = 1 of #1] {\small \textsc{#3}};
}
\waterplanet{2020}{B534754-9}{Oghma}{NaHu}{B}{G}{F}{};
\waterplanet{2120}{C577436-5}{Marduk}{NaHu}{B}{G}{F}{};
\waterplanet{2219}{E655796-4}{Borite}{NaHu}{B}{G}{F}{};
\planet{1719}{E7A08B9-8}{Ace}{NaHu}{E}{N}{}{yellow};
\waterplanet{1818}{C9D6778-9}{Number One}{NaHu}{C}{G}{}{};
\waterplanet{1919}{B534320-7}{Thebus}{NaHu}{B}{G}{}{};
\waterplanet{2018}{D8867BB-1}{Noricum}{NaHu}{D}{G}{}{yellow};
\waterplanet{1816}{A6236A6-A}{Salif}{NaHu}{A}{G}{}{};
\waterplanet{1715}{D561250-6}{Homestead}{NaHu}{D}{G}{}{};
\waterplanet{2116}{A4343500-F}{Theev}{NaHu}{A}{G}{T}{yellow};
\waterplanet{2216}{B433334-B}{Palindrome}{NaHu}{B}{G}{}{};
\waterplanet{2115}{B100477-C}{Vume}{NaHu}{B}{G}{}{};
\planet{2213}{B550444-A}{Realgar}{}{B}{G}{T}{};
\waterplanet{2314}{B76A787-7}{Chalchiutlicue}{}{B}{G}{}{};
\waterplanet{2113}{BAF889D-B}{Dolberg}{}{B}{G}{}{yellow};
\planet{2211}{A540A98-E}{Albe}{}{A}{G}{}{};
\waterplanet{2411}{C431210-B}{Cordillon}{}{C}{G}{}{};
\end{tikzpicture}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment