1

I am in the process of creating a board game. So far, I have designed the cards in TikZ and they look fun. However, I am not sure how to draw the gameboard in TikZ and I could not find much related help by searching in TeX.SE. The game contains two boards; one in which the cells are arranged in a linear way (in the shape of a rectangle), and another with cells arranged in a circular manner (in the shape of concentric circles). I have hand-designed the boards and they look like this:

Rectangular Gameboard Circular Gameboard

The first four cells (numbered 1, 2, 3, 4 in the outermost layer of the circular board) have been divided into 5 sub-cells each (1.1, 1.2, 1.3, 1.4, 1.5, 2.1, 2.2, $\dots$, 4.4, 4.5) shown in the rightmost column of the rectangular board (with the exception of 4.5, which lies in the second column). I want to create a digital design for the boards and I can probably do it in some SVG-supporting software (like Figma), but I am really interested to learn how to do it in LaTeX, especially in TikZ. Even if I can get help with the design of a small portion of the boards, I can find my way to change the codes and complete the whole design. I am clueless how to even start the TikZ code and any help would be really appreciated.

2 Answers 2

6
+100

In the images, there does not seem to be a consistent pattern in which tiles touch each other in the circular vs rectangular boards. Chalking that up to the difficulty of doing this by hand... I assume you want something that is consistent layout in both. So, effectively we are projecting a ribbon of tiles onto a kind of polar coordinates.

MWE

\documentclass[margin=5mm]{standalone}
\renewcommand{\familydefault}{\sfdefault}
\usepackage{tikz}
\definecolor{R}{HTML}{ff0000}
\definecolor{G}{HTML}{00cc66}
\definecolor{B}{HTML}{0066ff}
\definecolor{Y}{HTML}{ff9900}
\definecolor{P}{HTML}{ff00ff}
\newlength{\X}\setlength{\X}{10mm}
\newlength{\Xmax}\setlength{\Xmax}{10\X}
\newcommand{\Nmax}{36}
\newcounter{tile}\newcounter{layer}
\tikzset{
  shape/.style = { fill=#1, draw=white, thick, },
}
\newcommand{\rect}[6]{% x, y, w, h, color, label
  \draw[shape=#5] ({#1},{#2}) rectangle ++({#3},{#4});
  \node at ({#1+#3/2},{#2+#4/2}) {#6}; }
\newcommand{\slice}[6]{% r0, r1, d0, d1, clr, label
  \draw[shape=#5] ({#3*360}:{#1}) 
    -- ({#3*360}:{#2}) arc ({#3*360}:{#4*360}:{#2})
    -- ({#4*360}:{#1}) arc ({#4*360}:{#3*360}:{#1});
  \node at ({(#3*180+#4*180)}:{#1/2+#2/2}) {#6}; }
\newcommand{\rectslice}[3]{% total N this layer, i/N this tile, color
  \stepcounter{tile}
  \pgfmathtruncatemacro\Ntile{1+\Nmax-\thetile} % compute the tile number
  \rect{(\thelayer\X)}{(\Xmax*#2/#1)}{\X}{(\Xmax/#1)}{#3}{\Ntile}
  \begin{scope}[xshift=12\X,yshift=\Xmax/2] % controls relative placement
      \slice{(\thelayer-1)}{\thelayer}{(#2/#1+.25)}{(#2/#1+1/#1+.25)}{#3}{\Ntile}
  \end{scope}}
\begin{document}
\begin{tikzpicture}[x=\X,y=\X]
  \stepcounter{layer}
  \rectslice{4}{0}{R}
  \rectslice{4}{1}{G}
  \rectslice{4}{2}{B}
  \rectslice{4}{3}{P}
  \stepcounter{layer}
  \rectslice{8}{0}{R}\rectslice{8}{1}{R}
  \rectslice{8}{2}{G}\rectslice{8}{3}{G}
  \rectslice{8}{4}{P}\rectslice{8}{5}{P}
  \rectslice{8}{6}{P}\rectslice{8}{7}{Y}
  \stepcounter{layer}
  \rectslice{12}{0}{R}\rectslice{12} {1}{R}\rectslice{12} {2}{R}
  \rectslice{12}{3}{G}\rectslice{12} {4}{P}\rectslice{12} {5}{P}
  \rectslice{12}{6}{P}\rectslice{12} {7}{B}\rectslice{12} {8}{B}
  \rectslice{12}{9}{Y}\rectslice{12}{10}{Y}\rectslice{12}{11}{Y}
  \stepcounter{layer}
  \rectslice{8}{0}{R}\rectslice{8}{1}{P}
  \rectslice{8}{2}{P}\rectslice{8}{3}{G}
  \rectslice{8}{4}{B}\rectslice{8}{5}{B}
  \rectslice{8}{6}{Y}\rectslice{8}{7}{Y}
  \stepcounter{layer}
  \rectslice{4}{0}{P}
  \rectslice{4}{1}{G}
  \rectslice{4}{2}{B}
  \rectslice{4}{3}{Y}
\end{tikzpicture}
\end{document}

Result

result

5
  • 1
    I like it! I would play that game.
    – Sandy G
    Apr 10 at 3:38
  • 1
    :) it's giving me Inferno vibes. Apr 10 at 15:03
  • This is awesome, thank you! I guess I will be playing around with this until I get the shapes that I want. It was a big challenge for me to design this manually on cardboard and that is why the pattern seems inconsistent. The only important pattern is the number of cells in each layer/column. My only concern is how to start numbering the cells in the circular board from the outermost layer so that the last cell is located at the center. Apr 11 at 5:22
  • 1
    Sounds good. I've updated the code and solution to have the numbering start in the outermost layer. However, now you have to specify the largest number (36). I also rotated the circular board to match the photo. Apr 11 at 5:50
  • I changed the \rectslice command so I could manually label the cells. It took me a while but I got exactly what I wanted. I'm going to post the result as an answer here. Apr 11 at 17:35
1

Thanks to Jesse's answer, I got the result that I was looking for. I have changed the colors and the labeling (in the \rectslice command), but the code is essentially the same.

\documentclass[margin=5mm]{standalone}
\renewcommand{\familydefault}{\sfdefault}
\usepackage{tikz}
\definecolor{G}{HTML}{58E359}
\definecolor{B}{HTML}{3859C1}
\definecolor{Y}{HTML}{F5F26D}
\definecolor{P}{HTML}{DB86D8}
\definecolor{R}{HTML}{E35858}
\definecolor{BK}{HTML}{000000}

\newlength{\X}\setlength{\X}{15mm}
\newlength{\Xmax}\setlength{\Xmax}{10\X}
\newcommand{\Nmax}{116}
\newcounter{tile}\newcounter{layer}
\tikzset{
  shape/.style = { fill=#1, draw=white, thick, },
}
\newcommand{\rect}[6]{% x, y, w, h, color, label
  \draw[shape=#5] ({#1},{#2}) rectangle ++({#3},{#4});
  \node at ({#1+#3/2},{#2+#4/2}) {#6}; }
  
\newcommand{\slice}[6]{% r0, r1, d0, d1, clr, label
  \draw[shape=#5] ({#3*360}:{#1}) 
    -- ({#3*360}:{#2}) arc ({#3*360}:{#4*360}:{#2})
    -- ({#4*360}:{#1}) arc ({#4*360}:{#3*360}:{#1});
  \node at ({(#3*180+#4*180)}:{#1/2+#2/2}) {#6}; }
  
  
\newcommand{\rectslice}[4]{% total N this layer, i/N this tile, color, label
  \stepcounter{tile}
%   \pgfmathtruncatemacro\Ntile{1+\Nmax-\thetile} % compute the tile number (not used here)
  \rect{(\thelayer\X)}{(\Xmax*#2/#1)}{\X}{(\Xmax/#1)}{#3}{#4}
  \begin{scope}[xshift=14\X,yshift=\Xmax/2] % controls relative placement
      \slice{(\thelayer-1)}{\thelayer}{(#2/#1+.25)}{(#2/#1+1/#1+.25)}{#3}{#4}
  \end{scope}}
  
  
\begin{document}
\begin{tikzpicture}[x=\X,y=\X]
  \stepcounter{layer} % Layer 6
  \rectslice{4}{0}{G}{GO!}
  \rectslice{4}{1}{G}{100}
  \rectslice{4}{2}{G}{99}
  \rectslice{4}{3}{G}{98}
  \stepcounter{layer} % Layer 5
  \rectslice{16}{0}{G}{97}
  \rectslice{16}{1}{G}{96}
  \rectslice{16}{2}{G}{95}
  \rectslice{16}{3}{R}{94}
  \rectslice{16}{4}{R}{93}
  \rectslice{16}{5}{R}{92}
  \rectslice{16}{6}{G}{91}
  \rectslice{16}{7}{G}{90}
  \rectslice{16}{8}{BK}{\color{white}89}
  \rectslice{16}{9}{BK}{\color{white}88}
  \rectslice{16}{10}{B}{\color{white}87}
  \rectslice{16}{11}{B}{\color{white}86}
  \rectslice{16}{12}{B}{\color{white}85}
  \rectslice{16}{13}{Y}{84}
  \rectslice{16}{14}{Y}{83}
  \rectslice{16}{15}{Y}{82}
  \stepcounter{layer} % Layer 4
  \rectslice{23}{0}{G}{81}
  \rectslice{23}{1}{G}{80}
  \rectslice{23}{2}{G}{79}
  \rectslice{23}{3}{G}{78}
  \rectslice{23}{4}{P}{77}
  \rectslice{23}{5}{P}{76}
  \rectslice{23}{6}{R}{75}
  \rectslice{23}{7}{R}{74}
  \rectslice{23}{8}{R}{73}
  \rectslice{23}{9}{G}{72}
  \rectslice{23}{10}{G}{71}
  \rectslice{23}{11}{BK}{\color{white}70}
  \rectslice{23}{12}{BK}{\color{white}69}
  \rectslice{23}{13}{BK}{\color{white}68}
  \rectslice{23}{14}{BK}{\color{white}67}
  \rectslice{23}{15}{BK}{\color{white}66}
  \rectslice{23}{16}{B}{\color{white}65}
  \rectslice{23}{17}{B}{\color{white}64}
  \rectslice{23}{18}{Y}{63}
  \rectslice{23}{19}{Y}{62}
  \rectslice{23}{20}{Y}{61}
  \rectslice{23}{21}{B}{\color{white}60}
  \rectslice{23}{22}{B}{\color{white}59}
  \stepcounter{layer} %Layer 3
  \rectslice{32}{0}{G}{58}
  \rectslice{32}{1}{G}{57}
  \rectslice{32}{2}{P}{56}
  \rectslice{32}{3}{P}{55}
  \rectslice{32}{4}{P}{54}
  \rectslice{32}{5}{P}{53}
  \rectslice{32}{6}{R}{52}
  \rectslice{32}{7}{R}{51}
  \rectslice{32}{8}{R}{50}
  \rectslice{32}{9}{R}{49}
  \rectslice{32}{10}{G}{48}
  \rectslice{32}{11}{G}{47}
  \rectslice{32}{12}{BK}{\color{white}46}
  \rectslice{32}{13}{BK}{\color{white}45}
  \rectslice{32}{14}{BK}{\color{white}44}
  \rectslice{32}{15}{BK}{\color{white}43}
  \rectslice{32}{16}{BK}{\color{white}42}
  \rectslice{32}{17}{B}{\color{white}41}
  \rectslice{32}{18}{B}{\color{white}40}
  \rectslice{32}{19}{Y}{39}
  \rectslice{32}{20}{Y}{38}
  \rectslice{32}{21}{Y}{37}
  \rectslice{32}{22}{B}{\color{white}36}
  \rectslice{32}{23}{B}{\color{white}35}
  \rectslice{32}{24}{Y}{34}
  \rectslice{32}{25}{Y}{33}
  \rectslice{32}{26}{Y}{32}
  \rectslice{32}{27}{B}{\color{white}31}
  \rectslice{32}{28}{B}{\color{white}30}
  \rectslice{32}{29}{B}{\color{white}29}
  \rectslice{32}{30}{B}{\color{white}28}
  \rectslice{32}{31}{B}{\color{white}27}
  \stepcounter{layer} % Layer 2
  \rectslice{22}{0}{P}{26}
  \rectslice{22}{1}{P}{25}
  \rectslice{22}{2}{P}{24}
  \rectslice{22}{3}{P}{23}
  \rectslice{22}{4}{R}{22}
  \rectslice{22}{5}{R}{21}
  \rectslice{22}{6}{R}{20}
  \rectslice{22}{7}{R}{19}
  \rectslice{22}{8}{R}{18}
  \rectslice{22}{9}{Y}{17}
  \rectslice{22}{10}{Y}{16}
  \rectslice{22}{11}{Y}{15}
  \rectslice{22}{12}{Y}{14}
  \rectslice{22}{13}{Y}{13}
  \rectslice{22}{14}{Y}{12}
  \rectslice{22}{15}{Y}{11}
  \rectslice{22}{16}{Y}{10}
  \rectslice{22}{17}{B}{\color{white}9}
  \rectslice{22}{18}{B}{\color{white}8}
  \rectslice{22}{19}{B}{\color{white}7}
  \rectslice{22}{20}{B}{\color{white}6}
  \rectslice{22}{21}{B}{\color{white}5}
  \stepcounter{layer} %Layer 1
  \rectslice{20}{0}{P}{4.5}
  \rectslice{20}{1}{P}{4.4}
  \rectslice{20}{2}{P}{4.3}
  \rectslice{20}{3}{P}{4.2}
  \rectslice{20}{4}{P}{4.1}
  \rectslice{20}{5}{R}{3.5}
  \rectslice{20}{6}{R}{3.4}
  \rectslice{20}{7}{R}{3.3}
  \rectslice{20}{8}{R}{3.2}
  \rectslice{20}{9}{R}{3.1}
  \rectslice{20}{10}{Y}{2.5}
  \rectslice{20}{11}{Y}{2.4}
  \rectslice{20}{12}{Y}{2.3}
  \rectslice{20}{13}{Y}{2.2}
  \rectslice{20}{14}{Y}{2.1}
  \rectslice{20}{15}{B}{\color{white}1.5}
  \rectslice{20}{16}{B}{\color{white}1.4}
  \rectslice{20}{17}{B}{\color{white}1.3}
  \rectslice{20}{18}{B}{\color{white}1.2}
  \rectslice{20}{19}{B}{\color{white}1.1}
\end{tikzpicture}
\end{document}

Gameboards

3
  • 1
    Nice! :D looks great. Out of curiosity, do the colours denote terrain types or something? Apr 11 at 19:28
  • Thank you! The color of a cell denotes the dietary preference of the cell. The green ones represent, well, the most "green" diets, and the black cells are the most carnivorous. The cells of the rectangular board are all located on Earth, whereas the circular board covers the whole cosmos (the inner layers represent planets in the Solar System and the cells of the outermost layer correspond to exoplanets and stars beyond the heliosphere). Apr 11 at 22:04
  • I posted something about it here if you are interested! Apr 12 at 8:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.