| 1 |
% \section{The \texttt{game} package} |
| 2 |
% \label{sec:package} |
| 3 |
% |
| 4 |
% To make our game components re-usable (in particular when we want to |
| 5 |
% make a VASSAL module), we will put our definitions of counters, |
| 6 |
% board, and charts into a package file called |
| 7 |
% \texttt{game.sty}\footnote{In fact, most of this document is in that |
| 8 |
% file, because it allows us to document the code using \LaTeX{}'s |
| 9 |
% \texttt{ltxdoc} class.} |
| 10 |
% |
| 11 |
% Code shown below is in the package. |
| 12 |
% |
| 13 |
% The first thing we do in the package is to identify the package and |
| 14 |
% load the \textsf{wargame} package. |
| 15 |
% |
| 16 |
% \begin{macrocode} |
| 17 |
\ProvidesPackage{game} |
| 18 |
\RequirePackage{wargame} |
| 19 |
\RequirePackage{colortbl} |
| 20 |
% \end{macrocode} |
| 21 |
% \section{The units} |
| 22 |
% \label{sec:units} |
| 23 |
% |
| 24 |
% We will set-up our units for the game. As noted above, we will make |
| 25 |
% two factions which we will call \emph{A} and \emph{B}. |
| 26 |
% |
| 27 |
% \begin{quote} |
| 28 |
% The NATO |
| 29 |
% App6(d)\footnote{\url{https://nso.nato.int/nso/nsdd/main/standards/ap-details/1912/EN}} |
| 30 |
% symbology defines that friendly and hostile units should have |
| 31 |
% different symbol frames, but as we will make a game for two |
| 32 |
% players, and it seems unfair to label one as \emph{hostile} and |
| 33 |
% the other \emph{friendly}, we will stick with the |
| 34 |
% \texttt{friendly} base frames. |
| 35 |
% |
| 36 |
% Of course, if we were to make a solitaire or cooperative game, we |
| 37 |
% might want to use the \texttt{hostile} base frame for the opponent |
| 38 |
% units. |
| 39 |
% \end{quote} |
| 40 |
% |
| 41 |
% \subsection{Faction styles} |
| 42 |
% \label{sec:package:factions} |
| 43 |
% |
| 44 |
% We will start by defining two \Tikz{}\footnote{The \textsf{wargame} |
| 45 |
% package relies heavily on \Tikz{}. It is highly recommended that you |
| 46 |
% acquaint yourself with \Tikz{}. The manual, including tutorials, is |
| 47 |
% available from \url{https://ctan.org/pkg/pgf}.} styles for our two |
| 48 |
% factions. We will call these \texttt{a} and \texttt{b} (obviously). |
| 49 |
% These will define the colours of all counters of those sides. |
| 50 |
% |
| 51 |
% \begin{macrocode} |
| 52 |
\colorlet{a-bg}{hostile} |
| 53 |
\colorlet{b-bg}{friendly} |
| 54 |
\tikzset{% |
| 55 |
a/.style={fill=a-bg,draw=black}, |
| 56 |
b/.style={fill=b-bg,draw=black}} |
| 57 |
% \end{macrocode} |
| 58 |
% Note that we made the colours \texttt{a-bg} and \texttt{b-bg}. |
| 59 |
% Since we will use these colours a few times, it makes sense to make |
| 60 |
% a single definition which we can then freely change at any point and |
| 61 |
% then automatically have that change propagate everywhere. |
| 62 |
% |
| 63 |
% These styles are shown in \figurename~\ref{fig:faction-colors}. |
| 64 |
% |
| 65 |
% \begin{figure} |
| 66 |
% \centering |
| 67 |
% \begin{tikzpicture} |
| 68 |
% \draw[a] (0,0) rectangle ++(1,1) node[above]{\texttt{a}};% |
| 69 |
% \draw[b] (3,0) rectangle ++(1,1) node[above]{\texttt{b}};% |
| 70 |
% \end{tikzpicture} |
| 71 |
% \caption{Faction colours} |
| 72 |
% \label{fig:faction-colors} |
| 73 |
% \end{figure} |
| 74 |
% |
| 75 |
% Here we have used the colours \texttt{friendly} and \texttt{hostile} |
| 76 |
% defined by the \textsf{wargame} package, even though we said we |
| 77 |
% would not use the corresponding \texttt{hostile} base frame. |
| 78 |
% However, we can use any colours we can define in \LaTeX{} with the |
| 79 |
% \textsf{xcolor}\footnote{\url{https://ctan.org/pkg/xcolor}} package, |
| 80 |
% for example, |
| 81 |
% |
| 82 |
% \begin{verbatim} |
| 83 |
% \definecolor{a-bg}{HTML}{3333ff} |
| 84 |
% \end{verbatim} |
| 85 |
% |
| 86 |
% which will make a light blue colour. |
| 87 |
% |
| 88 |
% Since we intent to make \emph{double-sided} counters, so that units |
| 89 |
% will have two steps (front and back), we also define styles for the |
| 90 |
% back side. These will have lighter backgrounds than the front |
| 91 |
% side. |
| 92 |
% |
| 93 |
% \begin{macrocode} |
| 94 |
\tikzset{% |
| 95 |
a flipped/.style={a,fill=pgffillcolor!50!white}, |
| 96 |
b flipped/.style={b,fill=pgffillcolor!50!white}} |
| 97 |
% \end{macrocode} |
| 98 |
% Note that we use the styles \texttt{a} and \texttt{b} as bases for |
| 99 |
% these styles. Thus, if we make changes to the base styles, they |
| 100 |
% automatically propagate to our flipped styles. |
| 101 |
% |
| 102 |
% \begin{quote} |
| 103 |
% By convention, it is best to name your back-sides of counters and |
| 104 |
% so on the same as the front side, but with `\texttt{ flipped}' |
| 105 |
% appended. It is therefore also a good idea to use that convention |
| 106 |
% for styles and such. |
| 107 |
% \end{quote} |
| 108 |
% |
| 109 |
% The colour \texttt{pgffillcolor} is what ever the current fill |
| 110 |
% colour is (i.e., set by the \texttt{a} and \texttt{b} styles). |
| 111 |
% |
| 112 |
% These styles are shown in |
| 113 |
% \figurename~\ref{fig:faction-colors-flipped}. |
| 114 |
% |
| 115 |
% \begin{figure} |
| 116 |
% \centering |
| 117 |
% \begin{tikzpicture} |
| 118 |
% \draw[a flipped] (0,0) rectangle ++(1,1) node[above]{\texttt{a flippped}};% |
| 119 |
% \draw[b flipped] (3,0) rectangle ++(1,1) node[above]{\texttt{b flipped}};% |
| 120 |
% \end{tikzpicture} |
| 121 |
% \caption{Faction flipped colours} |
| 122 |
% \label{fig:faction-colors-flipped} |
| 123 |
% \end{figure} |
| 124 |
% |
| 125 |
% \subsection{Unit templates} |
| 126 |
% \label{sec:units:templates} |
| 127 |
% |
| 128 |
% In our game we will have two kinds of units: land, and air. |
| 129 |
% |
| 130 |
% Land units represent ground types of different kinds (infantry, |
| 131 |
% armoured, etc.) and have two \emph{factors}: A combat factor (CF) |
| 132 |
% and a movement factor (MF). In addition, for artillery units, we |
| 133 |
% will also specify a range. Each unit will also have a unique |
| 134 |
% identifier, and possibly parent organisational identifier, starting |
| 135 |
% hex, and turn of appearance. |
| 136 |
% |
| 137 |
% Air units provide different kinds of support for the ground units. |
| 138 |
% Since we will make a game on an \emph{operational} level (armies, |
| 139 |
% divisions, brigades), we will give air units a single factor --- the |
| 140 |
% odds column shift (see the combat resolution table later on). |
| 141 |
% |
| 142 |
% Let us first define a template for the ground units. We will call |
| 143 |
% this \texttt{gu} (for ground unit), and it will take 8\footnote{Yes, |
| 144 |
% that's a lot, but we may leave some of them blank. Don't worry, |
| 145 |
% we'll make more short-hands.} arguments: |
| 146 |
% \begin{enumerate}\tightlist |
| 147 |
% \item The unit type |
| 148 |
% \item The lower unit type (e.g., airborne) |
| 149 |
% \item The unit size (echelon) |
| 150 |
% \item The unit identifier |
| 151 |
% \item The parent unit identifier |
| 152 |
% \item The factors (more on this later) |
| 153 |
% \item The starting hex |
| 154 |
% \item The turn of appearance |
| 155 |
% \end{enumerate} |
| 156 |
% |
| 157 |
% \begin{macrocode} |
| 158 |
\tikzset{ |
| 159 |
gu/.style args={#1,#2,#3,#4,#5,#6,#7,#8}{% |
| 160 |
chit={% |
| 161 |
symbol={% Defines the NATO symbol |
| 162 |
faction=friendly, % See note |
| 163 |
command=land, % Ground units |
| 164 |
main={#1},% Unit type(s) (e.g., infantry) |
| 165 |
lower=#2,% Lower type |
| 166 |
echelon=#3,% Size (e.g., division) |
| 167 |
scale line widths, |
| 168 |
line width=1pt, |
| 169 |
}, |
| 170 |
unique={chit/small identifier=#4}, % Unit ID |
| 171 |
parent={chit/small identifier=#5}, % Parent ID |
| 172 |
factors={#6}, % The unit factors |
| 173 |
upper left={chit/small identifier=#7}, % Hex |
| 174 |
upper right={gu turn=#8} % Turn |
| 175 |
} % end of chit |
| 176 |
} % end of gu |
| 177 |
} |
| 178 |
% \end{macrocode} |
| 179 |
% |
| 180 |
% Note the \texttt{unique}, \texttt{parent}, and \texttt{upper left} |
| 181 |
% keys of \texttt{chit} are set to contain a \texttt{chit/identifier} |
| 182 |
% (or \texttt{chit/small identifier}) picture. In general, all the |
| 183 |
% keys of a \texttt{chit} and (and \texttt{natoapp6c}) \Tikz{} node |
| 184 |
% need to be \texttt{pic}\footnote{A small re-usable picture. See the |
| 185 |
% \Tikz{} manual, Chapter~18.} objects. The \texttt{chit/identifier} |
| 186 |
% picture outputs the text (the argument after the \texttt{=}). |
| 187 |
% |
| 188 |
% Note that for \texttt{upper left}, we used the \texttt{pic} |
| 189 |
% \texttt{gu~turn}, which we have not defined yet. Let us define that |
| 190 |
% now. This will be a picture that puts in the turn number when a |
| 191 |
% unit appears. Turn number ``0'' is the ``At-start'' turn, and so we |
| 192 |
% will deal with that specifically. Other turns should just be done |
| 193 |
% normally --- that is, we use another \texttt{chit/small identifier} picture |
| 194 |
% |
| 195 |
% \begin{macrocode} |
| 196 |
\tikzset{ |
| 197 |
gu turn/.pic={% |
| 198 |
\ifx#1\empty\else |
| 199 |
\ifnum0=#1\else% |
| 200 |
\pic{chit/small identifier={#1}};\fi\fi}, |
| 201 |
pics/gu turn/.default=0 |
| 202 |
} |
| 203 |
% \end{macrocode} |
| 204 |
% Note that we set the default value in case we get no turn number. |
| 205 |
% |
| 206 |
% We have put the keys \texttt{scale~line~widths} and |
| 207 |
% \texttt{line~width=1pt} into the \texttt{symbol} (the NATO symbol) |
| 208 |
% part. The latter sets the line width to be a little thicker than |
| 209 |
% usual. This is to make the counters more easily read. The former |
| 210 |
% ensures that if we scale our counters up or done, then the line |
| 211 |
% width will likewise scale\footnote{Other elements scale |
| 212 |
% automatically because of \Tikz{}'s \texttt{transform shape} key}. |
| 213 |
% |
| 214 |
% For the factors, we will use two different \texttt{pic}: |
| 215 |
% \texttt{chit/2 factors} for regular ground units, and \texttt{chit/2 |
| 216 |
% factors artillery} for artillery units. |
| 217 |
% |
| 218 |
% The template is shown in \figurename~\ref{fig:ground-unit}. |
| 219 |
% |
| 220 |
% \begin{figure} |
| 221 |
% \centering |
| 222 |
% \begin{tikzpicture} |
| 223 |
% \chit[gu={infantry,,division,23,2, |
| 224 |
% {chit/2 factors={2,4}},D3,2}];% |
| 225 |
% \end{tikzpicture} |
| 226 |
% \caption{Ground unit template} |
| 227 |
% \label{fig:ground-unit} |
| 228 |
% \end{figure} |
| 229 |
% |
| 230 |
% The image above was made with |
| 231 |
% |
| 232 |
% \begin{verbatim} |
| 233 |
% \begin{tikzpicture} |
| 234 |
% \chit[gu={infantry,,division,23,2, |
| 235 |
% {chit/2 factors={2,4}},D3,2}]; |
| 236 |
% \end{tikzpicture} |
| 237 |
% \end{verbatim} |
| 238 |
% |
| 239 |
% As said above, we will have artillery ground units and other kinds |
| 240 |
% of ground units. Let us make two templates --- one for |
| 241 |
% field-artillery ground units (\texttt{fu}), which has a range, and |
| 242 |
% regular combat units (\texttt{cu}). |
| 243 |
% |
| 244 |
% First the artillery unit type: \texttt{fu}. This takes 8 arguments |
| 245 |
% |
| 246 |
% \begin{enumerate}\tightlist |
| 247 |
% \item The echelon |
| 248 |
% \item The identifier |
| 249 |
% \item The parent identifier |
| 250 |
% \item The combat factor (CF) |
| 251 |
% \item The movement factor (MF) |
| 252 |
% \item The range |
| 253 |
% \item The starting hex |
| 254 |
% \item The turn of appearance |
| 255 |
% |
| 256 |
% \end{enumerate} |
| 257 |
% \begin{macrocode} |
| 258 |
\tikzset{ |
| 259 |
fu/.style args={#1,#2,#3,#4,#5,#6,#7,#8}{ |
| 260 |
gu={% |
| 261 |
{{[fill=pgfstrokecolor]artillery}}, % Type |
| 262 |
,%lower |
| 263 |
#1, % echelon |
| 264 |
#2, % ID |
| 265 |
#3, % Parent ID |
| 266 |
{chit/2 factors artillery={#4,#5,#6}}, |
| 267 |
#7, % Hex |
| 268 |
#8 % Turn |
| 269 |
} |
| 270 |
} |
| 271 |
} |
| 272 |
% \end{macrocode} |
| 273 |
% |
| 274 |
% Note that we pass the options \texttt{[fill=pgfstrokecolor]} to the |
| 275 |
% \texttt{pic} \texttt{artillery}\footnote{To be explicit |
| 276 |
% \texttt{natoapp6c/s/artillery}.} to fill in the artillery symbol. |
| 277 |
% Note that we need to protect this by putting in curly brackets (2 in |
| 278 |
% this case). Similarly, we protect the |
| 279 |
% \texttt{chit/2~factors~artillery} call. |
| 280 |
% |
| 281 |
% \begin{quote} |
| 282 |
% In general, we may pass options (or keys) to a \texttt{pic} by |
| 283 |
% preceeding its name with \oarg{keys}. However, we then |
| 284 |
% \emph{must} protect the it as in |
| 285 |
% \texttt{\{\oarg{keys}\meta{pic}\}}. Further, if \oarg{keys} |
| 286 |
% contains a list of keys, separated by commas, then we need to |
| 287 |
% protect \meta{keys} too, as in |
| 288 |
% \texttt{\{[\{\oarg{keys}\}]\meta{pic}\}}. A little clunky, but |
| 289 |
% that's how \TeX{} works sometimes. |
| 290 |
% \end{quote} |
| 291 |
% |
| 292 |
% And now the combat unit template: \texttt{cu}. This takes 9 |
| 293 |
% arguments. |
| 294 |
% |
| 295 |
% \begin{enumerate}\tightlist |
| 296 |
% \item The type |
| 297 |
% \item The lower type |
| 298 |
% \item The echelon |
| 299 |
% \item The identifier |
| 300 |
% \item The parent identifier |
| 301 |
% \item The combat factor (CF) |
| 302 |
% \item The movement factor (MF) |
| 303 |
% \item The starting hex |
| 304 |
% \item The turn of appearance |
| 305 |
% \end{enumerate} |
| 306 |
% \begin{macrocode} |
| 307 |
\tikzset{ |
| 308 |
cu/.style args={#1,#2,#3,#4,#5,#6,#7,#8,#9}{ |
| 309 |
gu={% |
| 310 |
{#1}, % Type |
| 311 |
#2, % lower |
| 312 |
#3, % echelon |
| 313 |
#4, % ID |
| 314 |
#5, % Parent |
| 315 |
{chit/2 factors={#6,#7}}, |
| 316 |
#8, % Hex |
| 317 |
#9 % Turn |
| 318 |
} |
| 319 |
} |
| 320 |
} |
| 321 |
% \end{macrocode} |
| 322 |
% |
| 323 |
% Again, let us see what that looks like (\figurename~\ref{fig:fu-cu}). |
| 324 |
|
| 325 |
% \begin{figure} |
| 326 |
% \centering |
| 327 |
% \begin{tikzpicture} |
| 328 |
% \chit[cu={infantry,airborne,regiment, |
| 329 |
% 21,2,6,4,E2,}](0,0);% |
| 330 |
% \chit[fu={battalion,23,21,1,3,4,E2,}](2,0);% |
| 331 |
% \end{tikzpicture} |
| 332 |
% \caption{Combat and field artillery templates} |
| 333 |
% \label{fig:fu-cu} |
| 334 |
% \end{figure} |
| 335 |
% |
| 336 |
% The above was made with |
| 337 |
% |
| 338 |
% \begin{verbatim} |
| 339 |
% \begin{tikzpicture} |
| 340 |
% \chit[fu={battalion,23,21,1,3,4,E2,}](0,0); |
| 341 |
% \chit[cu={infantry,airborne,regiment,21,2,6,4,E2,}] |
| 342 |
% (2,0); |
| 343 |
% \end{tikzpicture} |
| 344 |
% \end{verbatim} |
| 345 |
% |
| 346 |
% Finally, we make a template for air units. We will have |
| 347 |
% Close-combat Air Support (CAS \texttt{cas}) and strategic bombers |
| 348 |
% (\texttt{sb}). To make things a little easier for us, we first |
| 349 |
% define a template for all air units. This takes 7 arguments: |
| 350 |
% \begin{enumerate}\tightlist |
| 351 |
% \item The unit type (e.g., \texttt{fixed wing}, \texttt{rotary |
| 352 |
% wing}). |
| 353 |
% \item The upper modifier (e.g., \texttt{F} for fighter) |
| 354 |
% \item The lower modifier (e.g., \texttt{H} for `heavy') |
| 355 |
% \item The unit identifier |
| 356 |
% \item The parent unit identifier |
| 357 |
% \item The factor (column shift) |
| 358 |
% \item The turn of appearance |
| 359 |
% \end{enumerate} |
| 360 |
% \begin{macrocode} |
| 361 |
\tikzset{ |
| 362 |
au/.style args={#1,#2,#3,#4,#5,#6,#7}{% |
| 363 |
chit={% |
| 364 |
symbol={% Defines the NATO symbol |
| 365 |
faction=friendly, % See note |
| 366 |
command=air, % Air units |
| 367 |
main=#1,% Unit type |
| 368 |
upper={text=#2}, |
| 369 |
lower={text=#3}, |
| 370 |
scale line widths, |
| 371 |
line width=1pt, |
| 372 |
}, |
| 373 |
unique={chit/identifier=#4}, % Unit ID |
| 374 |
parent={chit/identifier=#5}, % Parent ID |
| 375 |
factors={#6}, % The unit factors |
| 376 |
upper right={gu turn=#7} % Turn |
| 377 |
} % end of chit |
| 378 |
} % end of gu |
| 379 |
} |
| 380 |
% \end{macrocode} |
| 381 |
% Here, \texttt{text}\footnote{really \texttt{/natoapp6c/s/text}.} for |
| 382 |
% \texttt{lower} and \texttt{upper} is a picture that puts the text |
| 383 |
% given as the argument after the \texttt{=}. The template is shown in |
| 384 |
% \figurename~\ref{fig:au}. |
| 385 |
% |
| 386 |
% \begin{figure} |
| 387 |
% \centering |
| 388 |
% \begin{tikzpicture} |
| 389 |
% \chit[au={fixed wing,B,,A,1,% |
| 390 |
% {chit/1 factor=+2},3}](0,0);% |
| 391 |
% \end{tikzpicture} |
| 392 |
% \caption{Air unit template} |
| 393 |
% \label{fig:au} |
| 394 |
% \end{figure} |
| 395 |
% % |
| 396 |
% The above was made with |
| 397 |
% |
| 398 |
% \begin{verbatim} |
| 399 |
% \begin{tikzpicture} |
| 400 |
% \chit[au={fixed wing,B,,A,1, |
| 401 |
% {chit/1 factor=+2},3}](0,0); |
| 402 |
% \end{tikzpicture} |
| 403 |
% \end{verbatim} |
| 404 |
% |
| 405 |
% As we said, we will have CAS and strategic bomber wings in this |
| 406 |
% game, so we make templates for these. Our CAS will be helicopters |
| 407 |
% (\texttt{rotery wing}) while the strategic bombers are planes. CAS |
| 408 |
% gives a 1 CF, while strategic bombers gives 1 column shift. |
| 409 |
% Arguments are |
| 410 |
% |
| 411 |
% \begin{enumerate}\tightlist |
| 412 |
% \item The identifier |
| 413 |
% \item The parent identifier |
| 414 |
% \item The turn of appearance |
| 415 |
% \end{enumerate} |
| 416 |
% \begin{macrocode} |
| 417 |
\tikzset{ |
| 418 |
cas/.style args={#1,#2,#3}{ % Close air support |
| 419 |
au={% Air unit |
| 420 |
rotary wing, % Helicopter |
| 421 |
,, % No lower, upper |
| 422 |
#1, % ID |
| 423 |
#2, % Parent ID |
| 424 |
{chit/2 factors={1,0}}, |
| 425 |
#3 %Turn |
| 426 |
} |
| 427 |
}, |
| 428 |
sb/.style args={#1,#2,#3}{% strategic bomber |
| 429 |
au={% Air unit |
| 430 |
fixed wing, %Planes |
| 431 |
B, % Bomber |
| 432 |
M, % Medium |
| 433 |
#1, % ID |
| 434 |
#2, % Parent |
| 435 |
{chit/1 factor={+1}}, |
| 436 |
#3 % Turn |
| 437 |
} |
| 438 |
} |
| 439 |
} |
| 440 |
% \end{macrocode} |
| 441 |
% |
| 442 |
% The templates are shown in \figurename~\ref{fig:cas-sb}. |
| 443 |
% |
| 444 |
% \begin{figure} |
| 445 |
% \centering |
| 446 |
% \begin{tikzpicture} |
| 447 |
% \chit[cas={1,2,10}](0,0);% |
| 448 |
% \chit[sb={3,4,}](2,0);% |
| 449 |
% \end{tikzpicture} |
| 450 |
% \caption{CAS and SB templates} |
| 451 |
% \label{fig:cas-sb} |
| 452 |
% \end{figure} |
| 453 |
% |
| 454 |
% The above was made with |
| 455 |
% |
| 456 |
% \begin{verbatim} |
| 457 |
% \begin{tikzpicture} |
| 458 |
% \chit[cas={1,2,10}(0,0); |
| 459 |
% \chit[sb={3,4,}(2,0); |
| 460 |
% \end{tikzpicture} |
| 461 |
% \end{verbatim} |
| 462 |
% |
| 463 |
% \subsection{Specialisations} |
| 464 |
% \label{sec:units:specialisations} |
| 465 |
% |
| 466 |
% We will now make some specialisations of the \texttt{gu} style. |
| 467 |
% These represent headquarters \texttt{hq}, mechanised infantry |
| 468 |
% \texttt{mi}, infantry \texttt{in}, and so |
| 469 |
% on. We do this because we want units of the same kind to have |
| 470 |
% similar factors and so on. Since almost all of our units are |
| 471 |
% battalions, we also code that in. |
| 472 |
% |
| 473 |
% |
| 474 |
% All of these, except \texttt{ff} for field artillery units, take 4 |
| 475 |
% arguments |
| 476 |
% \begin{enumerate}\tightlist |
| 477 |
% \item The identifier |
| 478 |
% \item The parent identifier |
| 479 |
% \item The starting hex |
| 480 |
% \item The turn of appearance |
| 481 |
% \end{enumerate} |
| 482 |
% |
| 483 |
% The style \texttt{ff} precedes these arguments with a single |
| 484 |
% argument for the unit size (echelon). |
| 485 |
% |
| 486 |
% \begin{macrocode} |
| 487 |
\tikzset{ |
| 488 |
in/.style args={#1,#2,#3,#4}{% |
| 489 |
cu={infantry,,battalion,#1,#2,2,3,#3,#4}}, |
| 490 |
mi/.style args={#1,#2,#3,#4}{% |
| 491 |
cu={{armoured,infantry},,battalion,#1,#2,4,4,#3,#4}}, |
| 492 |
ab/.style args={#1,#2,#3,#4}{% |
| 493 |
cu={infantry,airborne,battalion,#1,#2,1,3,#3,#4}}, |
| 494 |
ca/.style args={#1,#2,#3,#4}{% |
| 495 |
cu={combined arms,,battalion,#1,#2,3,3,#3,#4}}, |
| 496 |
ar/.style args={#1,#2,#3,#4}{% |
| 497 |
cu={armoured,,battalion,#1,#2,6,4,#3,#4}}, |
| 498 |
re/.style args={#1,#2,#3,#4}{% |
| 499 |
cu={reconnaissance,,battalion,#1,#2,6,5,#3,#4}}, |
| 500 |
ff/.style args={#1,#2,#3,#4,#5}{% |
| 501 |
fu={#1,#2,#3,2,5,3,#4,#5}}, |
| 502 |
hq/.style args={#1,#2,#3,#4,#5}{ |
| 503 |
cu={headquarters,,#1,#2,#3,0,1,#4,#5}},% |
| 504 |
hqbg/.style args={#1,#2,#3,#4}{ |
| 505 |
hq={brigade,#1,#2,#3,#4}}, |
| 506 |
hqregt/.style args={#1,#2,#3,#4}{ |
| 507 |
hq={regiment,#1,#2,#3,#4}}, |
| 508 |
} |
| 509 |
|
| 510 |
% \end{macrocode} |
| 511 |
% \subsection{The actual units} |
| 512 |
% \label{sec:units:actual} |
| 513 |
% |
| 514 |
% Above we defined templates for the various units. These templates |
| 515 |
% saves us a lot of trouble when defining the \emph{actual} units. |
| 516 |
% Below we will make the units for each faction in the game. We will |
| 517 |
% define them as \Tikz{} styles, just like we did for the templates. |
| 518 |
% |
| 519 |
% \begin{quote} |
| 520 |
% Above we said we want to make double sided counters. We will get |
| 521 |
% back to the back-side (flipped) versions of the counters in a |
| 522 |
% moment. |
| 523 |
% \end{quote} |
| 524 |
% |
| 525 |
% \subsubsection{Side A} |
| 526 |
% |
| 527 |
% Below we will define the units without much commentary. Note that |
| 528 |
% we use the style \texttt{a} for all our units so that they get the |
| 529 |
% right style. Note that we pass the single argument \texttt{\#1} as |
| 530 |
% the turn of appearance to all units. This will be used when |
| 531 |
% generating an \emph{Order of Battle} later on. |
| 532 |
% |
| 533 |
% \begin{macrocode} |
| 534 |
\tikzset{ |
| 535 |
a hq/.style ={a,hq={corps,,,A2,#1}}, |
| 536 |
a 1 hqbg/.style ={a,hqbg={1,,A2,#1}}, |
| 537 |
a 1 1lg ibn/.style={a,mi={I-LG,1,D3,#1}}, |
| 538 |
a 1 1gh ibn/.style={a,mi={I-GH,1,C2,#1}}, |
| 539 |
a 1 2jd ibn/.style={a,mi={II-JD,1,A2,#1}}, |
| 540 |
a 1 1 abn/.style ={a,ff={battalion,1,1,A1,#1}}, |
| 541 |
a 2 hqbg/.style ={a,hqbg={2,,C2,#1}},% |
| 542 |
a 2 1jd abn/.style={a,ar={I-JD,2,A2,#1}},% |
| 543 |
a 2 3gh rbn/.style={a,re={I-JD,2,D2,#1}},% |
| 544 |
a aregt/.style={a,ff={regiment,,,A1,#1}},% |
| 545 |
a f/.style={a,cas={,,#1}},%VR |
| 546 |
a b/.style={a,sb={,,#1}}%SK |
| 547 |
} |
| 548 |
% \end{macrocode} |
| 549 |
% \iffalse |
| 550 |
% KA: A2 Karup |
| 551 |
% HO: A2 Holsterbro |
| 552 |
% HV: D3 Høvelte |
| 553 |
% SL: C2 Slagelse |
| 554 |
% OK: A1 Oksbøl |
| 555 |
% RO: D2 Rønne |
| 556 |
% VR: D3 Værløse |
| 557 |
% SK: B2 Skydstrup |
| 558 |
% \fi |
| 559 |
% Let us draw these units in what looks like an organisational |
| 560 |
% diagram (\figurename~\ref{fig:a-org}). |
| 561 |
% \begin{figure} |
| 562 |
% \centering |
| 563 |
% \begin{tikzpicture} |
| 564 |
% \node[a hq] (a hq) {}; |
| 565 |
% \node[a aregt, below right=10mm and 10mm of a hq] (a aregt) {}; |
| 566 |
% \node[a 1 hqbg, below left=10mm and 10mm of a hq] (a 1 hqbg) {}; |
| 567 |
% \node[a 1 1lg ibn,below right=5mm and -8mm of a 1 hqbg] (a 1 1lg ibn){}; |
| 568 |
% \node[a 1 1gh ibn,below=5mm of a 1 1lg ibn] (a 1 1gh ibn){}; |
| 569 |
% \node[a 1 2jd ibn,below=5mm of a 1 1gh ibn] (a 1 2jd ibn){}; |
| 570 |
% \node[a 1 1 abn, below=5mm of a 1 2jd ibn] (a 1 1 abn) {}; |
| 571 |
% \node[a 2 hqbg, below=10mm of a hq] (a 2 hqbg) {}; |
| 572 |
% \node[a 2 1jd abn,below right=5mm and -8mm of a 2 hqbg] (a 2 1jd abn){}; |
| 573 |
% \node[a 2 3gh rbn,below=5mm of a 2 1jd abn] (a 2 3gh rbn){}; |
| 574 |
% \node[a f, right=10mm of a aregt] (a f) {}; |
| 575 |
% \node[a b, below=5mm of a f] (a b) {}; |
| 576 |
% \draw(a 1 hqbg.south west) |- (a 1 1lg ibn.west); |
| 577 |
% \draw(a 1 hqbg.south west) |- (a 1 1gh ibn.west); |
| 578 |
% \draw(a 1 hqbg.south west) |- (a 1 2jd ibn.west); |
| 579 |
% \draw(a 1 hqbg.south west) |- (a 1 1 abn.west); |
| 580 |
% \draw(a 2 hqbg.south west) |- (a 2 1jd abn.west); |
| 581 |
% \draw(a 2 hqbg.south west) |- (a 2 3gh rbn.west); |
| 582 |
% \coordinate (mid) at ($(a hq.south)+(0,-.5)$) {}; |
| 583 |
% \coordinate (off) at ($(mid)+(1.5,0)$) {}; |
| 584 |
% \draw(a hq.south) -- (mid); |
| 585 |
% \draw(mid) -| (a 1 hqbg.north); |
| 586 |
% \draw(mid) -- (a 2 hqbg.north); |
| 587 |
% \draw(mid) -| (a aregt.north); |
| 588 |
% \end{tikzpicture} |
| 589 |
% \caption{Faction A organisational chart} |
| 590 |
% \label{fig:a-org} |
| 591 |
% \end{figure} |
| 592 |
% |
| 593 |
% Before we go on to side B, we will make a macro that contains a list |
| 594 |
% of all our A side counters. |
| 595 |
% |
| 596 |
% \begin{macrocode} |
| 597 |
\def\alla{{% |
| 598 |
a hq, |
| 599 |
a 1 hqbg, |
| 600 |
a 1 1lg ibn, |
| 601 |
a 1 1gh ibn, |
| 602 |
a 1 2jd ibn, |
| 603 |
a 1 1 abn, |
| 604 |
a 2 hqbg, |
| 605 |
a 2 1jd abn, |
| 606 |
a 2 3gh rbn, |
| 607 |
a aregt, |
| 608 |
a f, |
| 609 |
a b}} |
| 610 |
% \end{macrocode} |
| 611 |
% |
| 612 |
% \subsubsection{Side B} |
| 613 |
% |
| 614 |
% Below we will define the units without much commentary. Note that |
| 615 |
% we use the style \texttt{b} for all our units so that they get the |
| 616 |
% right style. Note that we pass the single argument \texttt{\#1} as |
| 617 |
% the turn of appearance to all units. This will be used when |
| 618 |
% generating an \emph{Order of Battle} later on. |
| 619 |
%` |
| 620 |
% \begin{macrocode} |
| 621 |
\tikzset{ |
| 622 |
b hq/.style= {b,hq= {corps,,,F6,#1}}, |
| 623 |
b lg hqregt/.style= {b,hqregt={LG,,F6,#1}}, |
| 624 |
b lg ibn/.style= {b,in= {LG,,F6,#1}}, |
| 625 |
b k3 hqregt/.style= {b,hqregt={K3,,E7,#1}}, |
| 626 |
b k3 31 abibn/.style= {b,ab= {31,K3,E7,#1}}, |
| 627 |
b k4 hqregt/.style= {b,hqregt={K4,,F10,#1}}, |
| 628 |
b k4 abibn/.style= {b,ab= {NL,K4,F10,#1}}, |
| 629 |
b p4 hqregt/.style= {b,hqregt={P4,,D7,#1}}, |
| 630 |
b p4 41 cabn/.style= {b,ca= {41,P4,D7,#1}}, |
| 631 |
b p4 42 cabn/.style= {b,ca= {42,P4,D7,#1}}, |
| 632 |
b p7 hqregt/.style= {b,hqregt={P7,,D4,#1}}, |
| 633 |
b p7 71 ibn/.style= {b,mi= {71,P7,D4,#1}}, |
| 634 |
b p7 72 cabn/.style= {b,ca= {72,P7,D4,#1}}, |
| 635 |
b i13 hqregt/.style= {b,hqregt={I13,,D8,#1}}, |
| 636 |
b i13 131 ibn/.style= {b,in= {131,I13,D8,#1}}, |
| 637 |
b i13 132 ibn/.style= {b,in= {132,I13,D8,#1}}, |
| 638 |
b p18 hqregt/.style= {b,hqregt={P18,,F5,#1}}, |
| 639 |
b p18 181 cabn/.style={b,ca= {181,P18,F5,#1}}, |
| 640 |
b i19 hqregt/.style= {b,hqregt={I19,,F10,#1}}, |
| 641 |
b i19 191 cabn/.style={b,ca= {191,I19,F10,#1}}, |
| 642 |
b i19 192 cabn/.style={b,ca= {192,I19,F10,#1}}, |
| 643 |
b i21 hqregt/.style= {b,hqregt={I21,,D10,#1}}, |
| 644 |
b i21 211 ibn/.style= {b,in= {211,I21,D10,#1}}, |
| 645 |
b i21 212 ibn/.style= {b,in= {212,I21,D10,#1}}, |
| 646 |
b f/.style= {b,cas= {F17,BL,#1}}, |
| 647 |
b b/.style= {b,sb= {F7,SA,#1}} |
| 648 |
} |
| 649 |
% \end{macrocode} |
| 650 |
% \iffalse |
| 651 |
% SH: F6 Stockholm |
| 652 |
% KU: F6 Kungsängen near stockholm F6 |
| 653 |
% KA: E7 Karlsborg |
| 654 |
% AR: Off Arvisjaur (top of baltic) |
| 655 |
% SK: D7 Skövde |
| 656 |
% RE: D3 Revingehed |
| 657 |
% FA: D8 Falun |
| 658 |
% VI: F5 Visby (delay from island) |
| 659 |
% BO: Off Boden (top of baltic) |
| 660 |
% SO: Off (D10) Sollefteå |
| 661 |
% \fi |
| 662 |
% Let us draw these units in what looks like an organisational |
| 663 |
% diagram (\figurename~\ref{fig:b-org}). |
| 664 |
% |
| 665 |
% \begin{figure} |
| 666 |
% \centering |
| 667 |
% \begin{tikzpicture} |
| 668 |
% \node[b hq] (b hq) {}; |
| 669 |
% \node[b lg hqregt, below left=10mm and 20mm of b hq] (b lg hqregt){}; |
| 670 |
% \node[b lg ibn, below right=5mm and -8mm of b lg hqregt] (b lg ibn){}; |
| 671 |
% \node[b k3 hqregt, below left=10mm and -1mm of b hq] (b k3 hqregt){}; |
| 672 |
% \node[b k3 31 abibn, below right=5mm and -8mm of b k3 hqregt] (b k3 31 abibn){}; |
| 673 |
% \node[b k4 hqregt, below right=10mm and -1mm of b hq] (b k4 hqregt){}; |
| 674 |
% \node[b k4 abibn, below right=5mm and -8mm of b k4 hqregt] (b k4 abibn){}; |
| 675 |
% \node[b p4 hqregt, below right=10mm and 20mm of b hq] (b p4 hqregt){}; |
| 676 |
% \node[b p4 41 cabn, below right=5mm and -8mm of b p4 hqregt] (b p4 41 cabn){}; |
| 677 |
% \node[b p4 42 cabn, below=5mm of b p4 41 cabn] (b p4 42 cabn){}; |
| 678 |
% \node[b p7 hqregt, below left=65mm and 20mm of b hq] (b p7 hqregt){}; |
| 679 |
% \node[b p7 71 ibn, below right=5mm and -8mm of b p7 hqregt] (b p7 71 ibn){}; |
| 680 |
% \node[b p7 72 cabn, below=5mm of b p7 71 ibn] (b p7 72 cabn){}; |
| 681 |
% \node[b i13 hqregt, below left=65mm and -1mm of b hq] (b i13 hqregt){}; |
| 682 |
% \node[b i13 131 ibn, below right=5mm and -8mm of b i13 hqregt](b i13 131 ibn){}; |
| 683 |
% \node[b i13 132 ibn, below=5mm of b i13 131 ibn] (b i13 132 ibn){}; |
| 684 |
% \node[b p18 hqregt, below right=65mm and -1mm of b hq] (b p18 hqregt){}; |
| 685 |
% \node[b p18 181 cabn,below right=5mm and -8mm of b p18 hqregt](b p18 181 cabn){}; |
| 686 |
% \node[b i19 hqregt, below right=65mm and -1mm of b hq] (b i19 hqregt){}; |
| 687 |
% \node[b i19 191 cabn,below right=5mm and -8mm of b i19 hqregt](b i19 191 cabn){}; |
| 688 |
% \node[b i19 192 cabn,below=5mm of b i19 191 cabn] (b i19 192 cabn){}; |
| 689 |
% \node[b i21 hqregt, below right=65mm and 20mm of b hq] (b i21 hqregt){}; |
| 690 |
% \node[b i21 211 ibn, below right=5mm and -8mm of b i21 hqregt] (b i21 211 ibn){}; |
| 691 |
% \node[b i21 212 ibn, below=5mm of b i21 211 ibn] (b i21 212 ibn){}; |
| 692 |
% \node[b f, right=15mm of b hq] (b f){}; |
| 693 |
% \node[b b, right=5mm of b f] (b b){}; |
| 694 |
% |
| 695 |
% \draw(b lg hqregt.south west) |- (b lg ibn.west); |
| 696 |
% \draw(b k3 hqregt.south west) |- (b k3 31 abibn.west); |
| 697 |
% \draw(b k4 hqregt.south west) |- (b k4 abibn.west); |
| 698 |
% \draw(b p4 hqregt.south west) |- (b p4 41 cabn.west); |
| 699 |
% \draw(b p4 hqregt.south west) |- (b p4 42 cabn.west); |
| 700 |
% \draw(b p7 hqregt.south west) |- (b p7 71 ibn.west); |
| 701 |
% \draw(b p7 hqregt.south west) |- (b p7 72 cabn.west); |
| 702 |
% \draw(b p18 hqregt.south west) |- (b p18 181 cabn.west); |
| 703 |
% \draw(b i19 hqregt.south west) |- (b i19 191 cabn.west); |
| 704 |
% \draw(b i19 hqregt.south west) |- (b i19 192 cabn.west); |
| 705 |
% \draw(b i13 hqregt.south west) |- (b i13 131 ibn.west); |
| 706 |
% \draw(b i13 hqregt.south west) |- (b i13 132 ibn.west); |
| 707 |
% \draw(b i21 hqregt.south west) |- (b i21 211 ibn.west); |
| 708 |
% \draw(b i21 hqregt.south west) |- (b i21 212 ibn.west); |
| 709 |
% |
| 710 |
% \coordinate (mid) at ($(b hq.south)+(0,.-.5)$); |
| 711 |
% |
| 712 |
% \draw(b hq.south) -- (mid); |
| 713 |
% \draw(mid) -| (b lg hqregt.north); |
| 714 |
% \draw(mid) -| (b k3 hqregt.north); |
| 715 |
% \draw(mid) -| (b k4 hqregt.north); |
| 716 |
% \draw(mid) -| (b p4 hqregt.north); |
| 717 |
% |
| 718 |
% \coordinate (mid2) at ($(b hq.south)+(0,.-6)$); |
| 719 |
% \draw(mid) -- (mid2); |
| 720 |
% \draw(mid2) -| (b p7 hqregt.north); |
| 721 |
% \draw(mid2) -| (b i13 hqregt.north); |
| 722 |
% \draw(mid2) -| (b i19 hqregt.north); |
| 723 |
% \draw(mid2) -| (b i21 hqregt.north); |
| 724 |
% |
| 725 |
% \end{tikzpicture} |
| 726 |
% \caption{Faction B organisational chart} |
| 727 |
% \label{fig:b-org} |
| 728 |
% \end{figure} |
| 729 |
% |
| 730 |
% As before, we will make a macro that contains all B counters. |
| 731 |
% |
| 732 |
% \begin{macrocode} |
| 733 |
\def\allb{{ |
| 734 |
b hq, b lg hqregt, b lg ibn, |
| 735 |
b k3 hqregt, b k3 31 abibn, |
| 736 |
b p4 hqregt, b p4 41 cabn, b p4 42 cabn, |
| 737 |
b p7 hqregt, b p7 71 ibn, b p7 72 cabn, |
| 738 |
b i13 hqregt, b i13 131 ibn,b i13 132 ibn,% |
| 739 |
b f, b b% |
| 740 |
},{},{},{% Empty turns |
| 741 |
b p18 hqregt, b p18 181 cabn% |
| 742 |
},{ |
| 743 |
b i21 hqregt, b i21 211 ibn, b i21 212 ibn% |
| 744 |
},{},{ |
| 745 |
b k4 hqregt, b k4 abibn% |
| 746 |
},{ |
| 747 |
b i19 hqregt, b i19 191 cabn, b i19 192 cabn% |
| 748 |
}} |
| 749 |
% \end{macrocode} |
| 750 |
% |
| 751 |
% Note that this is defined as a list of lists, and some of the lists |
| 752 |
% are a little special. This is because we will reuse this list over |
| 753 |
% and over again, and in particular for the Order of Battle charts. |
| 754 |
% The point is that each element of the outer most list correspond to |
| 755 |
% a turn, starting with turn ``0'', or ``At start''. Empty elements |
| 756 |
% are thus turns where there will be no reinforcements for the faction. |
| 757 |
% |
| 758 |
% \subsection{The \texttt{flipped} side of things} |
| 759 |
% \label{sec:units:flipped} |
| 760 |
% |
| 761 |
% Well, really the \texttt{flipped} definitions of the units. The |
| 762 |
% flipped side of our unit counters will represent a ``spent'' state, |
| 763 |
% i.e., a state where the unit cannot attack and only do limited |
| 764 |
% manoeuvres. In this state, all units will have a combat factor or |
| 765 |
% zero and movement factor of 1. Thus, we define a simple style that |
| 766 |
% sets the factors |
| 767 |
% |
| 768 |
% \begin{macrocode} |
| 769 |
\tikzset{ |
| 770 |
flipped/.style={% |
| 771 |
/chit/factors={chit/2 factors={0,1}}, |
| 772 |
/chit/upper left={}, |
| 773 |
/chit/upper right={} |
| 774 |
} |
| 775 |
} |
| 776 |
% \end{macrocode} |
| 777 |
% Note that we give the \emph{explicit full} path to the chits factors |
| 778 |
% key. This is because we want to \emph{monkey patch} our units to |
| 779 |
% have these new factors. We also clear the upper left and right |
| 780 |
% corners on the flip side. |
| 781 |
% |
| 782 |
% Now, we'll do a little hack. Previously, we defined the |
| 783 |
% \texttt{a~flipped} and \texttt{b~flipped} styles, but if you look |
| 784 |
% closely, we can see how we can automatically define the flipped fill |
| 785 |
% colours. Thus we make another style that does this. |
| 786 |
% |
| 787 |
% \begin{macrocode} |
| 788 |
\tikzset{% |
| 789 |
f/.style={% |
| 790 |
flipped,fill=pgffillcolor!50!white}} |
| 791 |
% \end{macrocode} |
| 792 |
% |
| 793 |
% With this, we can define the \texttt{flipped} state of all A |
| 794 |
% counters. |
| 795 |
% |
| 796 |
% \begin{macrocode} |
| 797 |
\tikzset{% |
| 798 |
a hq flipped/.style= {a hq ,f}, |
| 799 |
a 1 hqbg flipped/.style= {a 1 hqbg ,f}, |
| 800 |
a 1 1lg ibn flipped/.style= {a 1 1lg ibn,f}, |
| 801 |
a 1 1gh ibn flipped/.style= {a 1 1gh ibn,f}, |
| 802 |
a 1 2jd ibn flipped/.style= {a 1 2jd ibn,f}, |
| 803 |
a 1 1 abn flipped/.style= {a 1 1 abn ,f}, |
| 804 |
a 2 hqbg flipped/.style= {a 2 hqbg ,f}, |
| 805 |
a 2 1jd abn flipped/.style= {a 2 1jd abn,f}, |
| 806 |
a 2 3gh rbn flipped/.style= {a 2 3gh rbn,f}, |
| 807 |
a aregt flipped/.style= {a aregt ,f}, |
| 808 |
a f flipped/.style= {a,f}, |
| 809 |
a b flipped/.style= {a,f}, |
| 810 |
} |
| 811 |
% \end{macrocode} |
| 812 |
% |
| 813 |
% Let us draw the A side counters, front and back, using the macro |
| 814 |
% \verb+doublechits+ (\figurename~\ref{fig:a-all}). |
| 815 |
% |
| 816 |
% \begin{figure} |
| 817 |
% \centering |
| 818 |
% \begin{tikzpicture} |
| 819 |
% \doublechits{\alla}{3}{0.04} |
| 820 |
% \end{tikzpicture} |
| 821 |
% \caption{All faction A counters, front and back} |
| 822 |
% \label{fig:a-all} |
| 823 |
% \end{figure} |
| 824 |
% |
| 825 |
% The above was produced by |
| 826 |
% |
| 827 |
% \begin{verbatim} |
| 828 |
% \begin{tikzpicture} |
| 829 |
% \doublechits{\alla}{3}{0.04} |
| 830 |
% \end{tikzpicture} |
| 831 |
% \end{verbatim} |
| 832 |
% |
| 833 |
% We will use the macro \verb+\doublechits+ later on to make our chit |
| 834 |
% sheets. This works \emph{only} because we define the back sides of |
| 835 |
% our chits to have the style `\meta{front} \texttt{flipped}', which |
| 836 |
% is why it is \emph{highly} recommended to follow this convention. |
| 837 |
% |
| 838 |
% We do the same thing for the faction B counters. |
| 839 |
% |
| 840 |
% |
| 841 |
% \begin{macrocode} |
| 842 |
\tikzset{% |
| 843 |
b hq flipped/.style= {b hq, f}, |
| 844 |
b lg hqregt flipped/.style= {b lg hqregt, f}, |
| 845 |
b lg ibn flipped/.style= {b lg ibn, f}, |
| 846 |
b k3 hqregt flipped/.style= {b k3 hqregt, f}, |
| 847 |
b k3 31 abibn flipped/.style= {b k3 31 abibn, f}, |
| 848 |
b k4 hqregt flipped/.style= {b k4 hqregt, f}, |
| 849 |
b k4 abibn flipped/.style= {b k4 abibn, f}, |
| 850 |
b p4 hqregt flipped/.style= {b p4 hqregt, f}, |
| 851 |
b p4 41 cabn flipped/.style= {b p4 41 cabn, f}, |
| 852 |
b p4 42 cabn flipped/.style= {b p4 42 cabn, f}, |
| 853 |
b p7 hqregt flipped/.style= {b p7 hqregt, f}, |
| 854 |
b p7 71 ibn flipped/.style= {b p7 71 ibn, f}, |
| 855 |
b p7 72 cabn flipped/.style= {b p7 72 cabn, f}, |
| 856 |
b i13 hqregt flipped/.style= {b i13 hqregt, f}, |
| 857 |
b i13 131 ibn flipped/.style= {b i13 131 ibn, f}, |
| 858 |
b i13 132 ibn flipped/.style= {b i13 132 ibn, f}, |
| 859 |
b p18 hqregt flipped/.style= {b p18 hqregt, f}, |
| 860 |
b p18 181 cabn flipped/.style={b p18 181 cabn,f}, |
| 861 |
b i19 hqregt flipped/.style= {b i19 hqregt, f}, |
| 862 |
b i19 191 cabn flipped/.style={b i19 191 cabn,f}, |
| 863 |
b i19 192 cabn flipped/.style={b i19 192 cabn,f}, |
| 864 |
b i21 hqregt flipped/.style= {b i21 hqregt, f}, |
| 865 |
b i21 211 ibn flipped/.style= {b i21 211 ibn, f}, |
| 866 |
b i21 212 ibn flipped/.style= {b i21 212 ibn, f}, |
| 867 |
b f flipped/.style= {b,f}, |
| 868 |
b b flipped/.style= {b,f}} |
| 869 |
% \end{macrocode} |
| 870 |
% |
| 871 |
% Let us draw the faction B counters, front and back, using the macro |
| 872 |
% \verb+doublechits+ (\figurename~\ref{fig:b-all}). |
| 873 |
% |
| 874 |
% \begin{figure} |
| 875 |
% \centering |
| 876 |
% \begin{tikzpicture} |
| 877 |
% \doublechits{\allb}{3}{.04} |
| 878 |
% \end{tikzpicture} |
| 879 |
% \caption{All faction B counters, front and back} |
| 880 |
% \label{fig:b-all} |
| 881 |
% \end{figure} |
| 882 |
% |
| 883 |
% The above was produced by |
| 884 |
% |
| 885 |
% \begin{verbatim} |
| 886 |
% \begin{tikzpicture} |
| 887 |
% \doublechits{\allb}{3}{.04} |
| 888 |
% \end{tikzpicture} |
| 889 |
% \end{verbatim} |
| 890 |
% |
| 891 |
% \subsection{Other counters} |
| 892 |
% \label{sec:units:other} |
| 893 |
% |
| 894 |
% In principle one can make as many and different counters and markers |
| 895 |
% as needed. Here, we will keep things simple and only define a game |
| 896 |
% turn marker. The package \textsf{wargame} already defines one as |
| 897 |
% shown in \figurename~\ref{fig:plain-game-turn}. |
| 898 |
% |
| 899 |
% \begin{figure} |
| 900 |
% \centering |
| 901 |
% \begin{tikzpicture} |
| 902 |
% \chit[game turn chit] |
| 903 |
% \end{tikzpicture} |
| 904 |
% \caption{The \textsf{wargame} game turn counter} |
| 905 |
% \label{fig:plain-game-turn} |
| 906 |
% \end{figure} |
| 907 |
% |
| 908 |
% However, this has no flip side and we would like the side to reflect |
| 909 |
% the faction currently in turn |
| 910 |
% |
| 911 |
% \begin{macrocode} |
| 912 |
\tikzset{ |
| 913 |
game turn chit/.append style={a}, |
| 914 |
game turn chit flipped/.append style={b} |
| 915 |
} |
| 916 |
% \end{macrocode} |
| 917 |
% |
| 918 |
% This modified game turn is shown in \figurename~\ref{fig:game-turn}. |
| 919 |
% |
| 920 |
% \begin{figure} |
| 921 |
% \centering |
| 922 |
% \begin{tikzpicture} |
| 923 |
% \doublechits{{game turn chit}}{1}{.04} |
| 924 |
% \end{tikzpicture} |
| 925 |
% \caption{Modified game turn, front and back} |
| 926 |
% \label{fig:game-turn} |
| 927 |
% \end{figure} |
| 928 |
% |
| 929 |
% \section{The board} |
| 930 |
% \label{sec:board} |
| 931 |
% |
| 932 |
% Designing the board is probably where one will spend the most time. |
| 933 |
% The \textsf{wargame} package is not omnipotent, but tries to make it |
| 934 |
% as simple as possible. However, some artistic streak is a good |
| 935 |
% thing, and familiarity with \Tikz{} is highly recommended. |
| 936 |
% |
| 937 |
% The simplest thing one can do is to import an image and superimpose |
| 938 |
% hexes on top of that image. While often a good solution, it does |
| 939 |
% not always give the most pleasing board. |
| 940 |
% |
| 941 |
% The \textsf{wargame} package does not, in and of it self, provide |
| 942 |
% fancy ``modern'' graphics (though it can be done). Rather, off the |
| 943 |
% shelf, it mimics classic wargames of yore (Afrika Korps, D-Day, |
| 944 |
% Russian Campaign, and so on). That is, it uses rather simplified |
| 945 |
% graphics. |
| 946 |
% |
| 947 |
% For our game, we will have three kinds of terrain: Clear, woods, and |
| 948 |
% mountains. The map will have a lot of coastline, but the scale of |
| 949 |
% the game is such that naval units are not really called for. |
| 950 |
% Indeed, the game focuses on land combat with abstracted aerial |
| 951 |
% support. |
| 952 |
% |
| 953 |
% The first thing we do, is to decide a few things about the map. We |
| 954 |
% want to have the hexes automatically label with alphabetic columns |
| 955 |
% and numerical rows. We want to start our rows and columns at 1 (the |
| 956 |
% default is starting at 0). By default, we want the hexes to be white |
| 957 |
% (for clear terrain). To set this up, we define some more |
| 958 |
% keys. |
| 959 |
% |
| 960 |
% \begin{macrocode} |
| 961 |
\tikzset{% |
| 962 |
hex/short bottom columns=even, |
| 963 |
hex/short top columns=odd, |
| 964 |
hex/label is name, |
| 965 |
hex/first row and column are=1, |
| 966 |
every hex/.style={ |
| 967 |
/hex/label={auto=alpha column}, |
| 968 |
fill=white}, |
| 969 |
}% |
| 970 |
% \end{macrocode} |
| 971 |
% |
| 972 |
% Note how we used the \emph{full} path for the \texttt{/hex/label} |
| 973 |
% key. This will be important when we generate a VASSAL module later |
| 974 |
% on. |
| 975 |
% |
| 976 |
% The key \texttt{hex/label is name} makes it so that every hex on the |
| 977 |
% board will be a named \texttt{node}. This means we can refer to a |
| 978 |
% hex in \Tikz{} simply by its label. In fact, we can use various |
| 979 |
% anchors of the hex if we want to --- it is a \texttt{node} like any |
| 980 |
% other node in \Tikz{}. |
| 981 |
% |
| 982 |
% The keys \texttt{hex/short bottom column=even} and |
| 983 |
% \texttt{hex/short~top~column=odd} is mainly used by the |
| 984 |
% \verb+\boardframe+ macro to generate a proper frame. |
| 985 |
% |
| 986 |
% Having defined the settings, we can move on to the board itself. We |
| 987 |
% will do this in parts. This makes it easier to get an overview of, |
| 988 |
% and helps us in this tutorial to explain what is going on. |
| 989 |
% |
| 990 |
% The first thing we do, is define a macro that defines the coast line |
| 991 |
% of our map. We use the hexagonal coordinate system provided by the |
| 992 |
% \textsf{wargame} package, but we could also have used general |
| 993 |
% Cartesian coordinates. |
| 994 |
% |
| 995 |
% \begin{quote} |
| 996 |
% Defining the coastline of a map can be quite tedious. You may |
| 997 |
% want to use some vector graphics editor, say Inkscape, to do |
| 998 |
% this. In the \textsf{wargame} package you will find a Python |
| 999 |
% script to convert an SVG to \Tikz{} paths. |
| 1000 |
% \end{quote} |
| 1001 |
% |
| 1002 |
% Alright, let's make our macro to define the coastline. |
| 1003 |
% |
| 1004 |
% \begin{macrocode} |
| 1005 |
\newcommand\coastline{% |
| 1006 |
(hex cs:c=1,r=1,v=SE) |
| 1007 |
--(hex cs:c=1,r=1,e=SE) |
| 1008 |
--(hex cs:c=1,r=1,e=NE,o=.5) |
| 1009 |
--(hex cs:c=1,r=1,v=NW,o=.7) |
| 1010 |
--(hex cs:c=1,r=2,v=W,o=.6) |
| 1011 |
--(hex cs:c=1,r=2,v=NW,o=.7) |
| 1012 |
--(hex cs:c=1,r=3,v=SE,o=.9) |
| 1013 |
--(hex cs:c=1,r=3,e=SE,o=.9) |
| 1014 |
--(hex cs:c=2,r=4,e=S,o=.7) |
| 1015 |
--(hex cs:c=2,r=3,v=NE,o=.4) |
| 1016 |
--(hex cs:c=2,r=3,e=S,o=.1) |
| 1017 |
--(hex cs:c=2,r=3,v=E,o=.8) |
| 1018 |
--(hex cs:c=2,r=3,e=SE,o=.8) |
| 1019 |
--(hex cs:c=2,r=3,v=SE,o=.6) |
| 1020 |
--(hex cs:c=2,r=2,v=NW,o=.2) |
| 1021 |
--(hex cs:c=2,r=2,e=SE) |
| 1022 |
--(hex cs:c=3,r=1,e=NE) |
| 1023 |
--(hex cs:c=4,r=2,e=N,o=.3) |
| 1024 |
--(hex cs:c=5,r=2,e=S,o=.6) |
| 1025 |
--(hex cs:c=5,r=2,v=SE,o=.9) |
| 1026 |
--(hex cs:c=7,r=3,v=E) |
| 1027 |
--(hex cs:c=7,r=1,v=E) |
| 1028 |
--(hex cs:c=6,r=1,v=E,o=2.5) |
| 1029 |
--cycle |
| 1030 |
(hex cs:c=3,r=2,v=W,o=.5) |
| 1031 |
--(hex cs:c=4,r=3,e=NW,o=.75) |
| 1032 |
--(hex cs:c=4,r=3,e=SW,o=.3) |
| 1033 |
--(hex cs:c=4,r=2,e=NW,o=.7) |
| 1034 |
--(hex cs:c=3,r=2,v=SW,o=.4) |
| 1035 |
--cycle |
| 1036 |
(hex cs:c=2,r=4,e=N,o=.8) |
| 1037 |
--(hex cs:c=2,r=4,v=E,o=.7) |
| 1038 |
--(hex cs:c=3,r=3,v=E,o=.8) |
| 1039 |
--(hex cs:c=4,r=3,v=NW,o=.6) |
| 1040 |
--(hex cs:c=4,r=3,e=NW,o=.1) |
| 1041 |
--(hex cs:c=4,r=3,v=SE,o=.4) |
| 1042 |
--(hex cs:c=5,r=3,v=SW,o=.6) |
| 1043 |
--(hex cs:c=5,r=3,v=NE,o=.2) |
| 1044 |
--(hex cs:c=5,r=3,e=NE) |
| 1045 |
--(hex cs:c=6,r=4,v=SW,o=.3) |
| 1046 |
--(hex cs:c=5,r=4,v=E,o=1.7) |
| 1047 |
--(hex cs:c=6,r=5,e=N) |
| 1048 |
--(hex cs:c=6,r=6,v=E) |
| 1049 |
--(hex cs:c=7,r=6,v=NW,o=.4) |
| 1050 |
--(hex cs:c=6,r=7,e=S,o=.2) |
| 1051 |
--(hex cs:c=6,r=7,e=NW) |
| 1052 |
--(hex cs:c=6,r=8,e=NW,o=.7) |
| 1053 |
--(hex cs:c=7,r=9,e=NE) |
| 1054 |
--(hex cs:c=6,r=10,v=E,o=2.5) |
| 1055 |
--(hex cs:c=7,r=10,v=E) |
| 1056 |
--(hex cs:c=1,r=10,v=W) |
| 1057 |
--(hex cs:c=2,r=4,v=W,o=2.5) |
| 1058 |
--(hex cs:c=2,r=5,v=SW) |
| 1059 |
--cycle |
| 1060 |
; |
| 1061 |
} |
| 1062 |
% \end{macrocode} |
| 1063 |
% |
| 1064 |
% The coast line is shown in \figurename~\ref{fig:coast}\footnote{Any |
| 1065 |
% resemblance to any actual location is, erhm, accidental?} |
| 1066 |
% |
| 1067 |
% \begin{figure} |
| 1068 |
% \centering |
| 1069 |
% \begin{tikzpicture}[scale=.7] |
| 1070 |
% \draw[fill=gray] \coastline; |
| 1071 |
% \end{tikzpicture} |
| 1072 |
% \caption{The coast line} |
| 1073 |
% \label{fig:coast} |
| 1074 |
% \end{figure} |
| 1075 |
% |
| 1076 |
% As you can see, it is pretty simple. Not too many details about the |
| 1077 |
% nooks and crannies. Now we want to define some colours that we will |
| 1078 |
% use on the map. As mentioned above, we will have some sea, and we |
| 1079 |
% will have some surrounding neutral countries. Let us define some |
| 1080 |
% colours for these things. |
| 1081 |
% |
| 1082 |
% \begin{macrocode} |
| 1083 |
\definecolor{sea}{HTML}{18b5db} |
| 1084 |
\colorlet{neutral}{gray!25!white} |
| 1085 |
\colorlet{coast}{black} |
| 1086 |
% \end{macrocode} |
| 1087 |
% |
| 1088 |
% OK, with that out of the way, we start on the hexes in earnest. We |
| 1089 |
% define the macro \verb+\hexes+ to produce our hexes within our map. |
| 1090 |
% |
| 1091 |
% \begin{macrocode} |
| 1092 |
\newcommand\hexes[1][]{ |
| 1093 |
% \end{macrocode} |
| 1094 |
% |
| 1095 |
% We have defined this macro to take a single optional argument. We |
| 1096 |
% wont use that here, but it might come in handy at some later point. |
| 1097 |
% |
| 1098 |
% The first thing we do, is to fill the entire map with \texttt{sea}. |
| 1099 |
% |
| 1100 |
% \begin{macrocode} |
| 1101 |
\fill[sea](-1.000,-0.866) rectangle(10.,15.580); |
| 1102 |
% \end{macrocode} |
| 1103 |
% |
| 1104 |
% Then we use the macro \verb+\coastline+ to define a path that we may |
| 1105 |
% use over and over again. |
| 1106 |
% |
| 1107 |
% \begin{macrocode} |
| 1108 |
\path[save path=\coast]\coastline; |
| 1109 |
% \end{macrocode} |
| 1110 |
% |
| 1111 |
% Next up, we want to draw hexes that are on the coast line but also |
| 1112 |
% has land parts in it. This is so that the hexes are complete and |
| 1113 |
% get a proper label on it. We define the fill to be the sea |
| 1114 |
% colour, and the lines labels to be white |
| 1115 |
% |
| 1116 |
% \begin{macrocode} |
| 1117 |
\begin{scope}[ |
| 1118 |
every hex/.append style={white,fill=sea}, |
| 1119 |
hex/label/.append style={color=white}] |
| 1120 |
\hex(c=1,r=1); \hex(c=1,r=2); |
| 1121 |
\hex(c=1,r=3); |
| 1122 |
\hex(c=2,r=2); \hex(c=2,r=3); |
| 1123 |
\hex(c=2,r=4); |
| 1124 |
\hex(c=3,r=2); \hex(c=3,r=3); |
| 1125 |
\hex(c=4,r=2); \hex(c=4,r=3); |
| 1126 |
\hex(c=5,r=3); \hex(c=5,r=7); |
| 1127 |
\hex(c=6,r=4); \hex(c=6,r=5); |
| 1128 |
\hex(c=6,r=6); \hex(c=6,r=7); |
| 1129 |
\hex(c=6,r=8); \hex(c=6,r=9); |
| 1130 |
\hex(c=7,r=6); \hex(c=7,r=9); |
| 1131 |
\end{scope} |
| 1132 |
% \end{macrocode} |
| 1133 |
% Note that we use the \texttt{.append style} handler so that we get |
| 1134 |
% the setting from above here too (labels, among other things). These |
| 1135 |
% amended styles only have effect inside the \texttt{scope}. Once we |
| 1136 |
% leave the scope, then the old settings are restored. |
| 1137 |
% |
| 1138 |
% We draw a compass needle. |
| 1139 |
% |
| 1140 |
% \begin{macrocode} |
| 1141 |
\draw[white,-{Stealth[]}, |
| 1142 |
scale line widths, |
| 1143 |
line width=1mm] |
| 1144 |
(hex cs:c=7,r=4,v=SE) -- ++(110:2) |
| 1145 |
node[midway, |
| 1146 |
font=\sffamily\bfseries\LARGE, |
| 1147 |
transform shape, |
| 1148 |
rotate=-90,sloped]{N}; |
| 1149 |
% \end{macrocode} |
| 1150 |
% |
| 1151 |
% Since the areas where we do not add hexes are considered neutral |
| 1152 |
% countries in this game, we fill the whole coast line with the |
| 1153 |
% previously defined \texttt{neutral} colour. |
| 1154 |
% |
| 1155 |
% \begin{macrocode} |
| 1156 |
\settosave{\coast} |
| 1157 |
\fill[neutral]; |
| 1158 |
% \end{macrocode} |
| 1159 |
% |
| 1160 |
% Here we have the first use of the saved path \verb+\coast+. We make |
| 1161 |
% that the current path by calling \verb+\setosave+ --- a small |
| 1162 |
% utility in the \textsf{wargame} package. |
| 1163 |
% |
| 1164 |
% We can now add the actual hexes. Some of the hexes will represent |
| 1165 |
% different terrain, and that will be clear from the definitions. We |
| 1166 |
% will put our definitions inside a scope, and the first thing we do |
| 1167 |
% in that scope is to clip everything to our coast line. This will be |
| 1168 |
% the second use of \verb+\coast+. |
| 1169 |
% |
| 1170 |
% \begin{macrocode} |
| 1171 |
\begin{scope} |
| 1172 |
\settosave{\coast} |
| 1173 |
\clip; |
| 1174 |
|
| 1175 |
\hex(c=1,r=1);\hex(c=1,r=2);\hex(c=1,r=3); |
| 1176 |
% \end{macrocode} |
| 1177 |
% |
| 1178 |
% Note that we use the \texttt{hex cs} coordinate system. We specify |
| 1179 |
% the column (\texttt{c}) and the row (\texttt{r}) of each hex. We can |
| 1180 |
% use longer forms, of the keys if we want. |
| 1181 |
% |
| 1182 |
% The southern border of A factions country needs a little special |
| 1183 |
% attention. We clip the drawn hex, and draw the border. In fact, we |
| 1184 |
% draw the hex twice, first time with a white outline and the neutral |
| 1185 |
% fill colour. This is so that the full hex will be drawn, even it is |
| 1186 |
% only partially within the map area. |
| 1187 |
% |
| 1188 |
% \begin{macrocode} |
| 1189 |
\hex[white,fill=neutral,label=](c=2,r=2); |
| 1190 |
\begin{scope} |
| 1191 |
\clip(hex cs:c=2,r=2,v=SW) |
| 1192 |
--(hex cs:c=2,r=2,v=E) |
| 1193 |
--(hex cs:c=2,r=2,v=NE) |
| 1194 |
--(hex cs:c=2,r=2,v=NW) |
| 1195 |
--(hex cs:c=2,r=2,v=W) |
| 1196 |
--cycle; |
| 1197 |
\hex(c=2,r=2); |
| 1198 |
\end{scope} |
| 1199 |
\draw[coast] (hex cs:c=2,r=2,v=SW) |
| 1200 |
--(hex cs:c=2,r=2,v=E); |
| 1201 |
% \end{macrocode} |
| 1202 |
% Note that our clipping path is defined in the \texttt{hex cs} |
| 1203 |
% coordinate system, and how we have retrieved vertex coordinates via |
| 1204 |
% the key \texttt{v}. |
| 1205 |
% |
| 1206 |
% Now we come to some other terrain: woods and mountains. |
| 1207 |
% |
| 1208 |
% \begin{macrocode} |
| 1209 |
\hex(c=2,r=3);\hex(c=2,r=4);\hex(c=2,r=5); |
| 1210 |
\hex[terrain=mountains](c=2,r=6); |
| 1211 |
\hex[terrain=mountains](c=2,r=7); |
| 1212 |
\hex[terrain=mountains](c=2,r=8); |
| 1213 |
% \end{macrocode} |
| 1214 |
% |
| 1215 |
% Again, we do not want to draw the hex in the neutral country to |
| 1216 |
% the south, so we clip this hex too. |
| 1217 |
% |
| 1218 |
% |
| 1219 |
% |
| 1220 |
% |
| 1221 |
% \begin{macrocode} |
| 1222 |
\hex[white,fill=neutral,label=](c=4,r=2); |
| 1223 |
\begin{scope} |
| 1224 |
\clip(hex cs:c=4,r=2,v=W) |
| 1225 |
--(hex cs:c=4,r=2,v=NE) |
| 1226 |
--(hex cs:c=4,r=2,v=NW) |
| 1227 |
--cycle; |
| 1228 |
\hex(c=4,r=2); |
| 1229 |
\end{scope} |
| 1230 |
% \end{macrocode} |
| 1231 |
% |
| 1232 |
% \begin{macrocode} |
| 1233 |
\hex(c=3,r=2); \hex(c=3,r=3); |
| 1234 |
\hex[terrain=woods](c=3,r=4); |
| 1235 |
\hex(c=3,r=5); |
| 1236 |
\hex[terrain=woods](c=3,r=6); |
| 1237 |
\hex[terrain=woods](c=3,r=7); |
| 1238 |
\hex[terrain=mountains](c=3,r=8); |
| 1239 |
\hex[terrain=mountains](c=3,r=9); |
| 1240 |
% \end{macrocode} |
| 1241 |
% |
| 1242 |
% In the next step, we will add a town to the map. |
| 1243 |
% |
| 1244 |
% \begin{macrocode} |
| 1245 |
\hex[town={ |
| 1246 |
place={(hex cs:c=1,r=1,e=SW,o=.5)}}] |
| 1247 |
(c=4,r=3); |
| 1248 |
\hex[terrain=woods](c=4,r=4); |
| 1249 |
\hex(c=4,r=5); |
| 1250 |
\hex[terrain=woods](c=4,r=6); |
| 1251 |
\hex[terrain=woods](c=4,r=7); |
| 1252 |
\hex[terrain=woods](c=4,r=8); |
| 1253 |
\hex[terrain=woods](c=4,r=9); |
| 1254 |
\hex(c=4,r=10); |
| 1255 |
% \end{macrocode} |
| 1256 |
% The \texttt{place} key specifies the placement of the town relative |
| 1257 |
% to the hex centre. |
| 1258 |
% |
| 1259 |
% For the rest of the map, there isn't much new. |
| 1260 |
% |
| 1261 |
% \begin{macrocode} |
| 1262 |
\hex(c=5,r=3); |
| 1263 |
\hex[terrain=woods](c=5,r=4); |
| 1264 |
\hex[](c=5,r=5); |
| 1265 |
\hex[terrain=woods](c=5,r=6); |
| 1266 |
\hex[terrain=woods](c=5,r=7); |
| 1267 |
\hex[terrain=woods](c=5,r=8); |
| 1268 |
\hex[terrain=woods](c=5,r=9); |
| 1269 |
|
| 1270 |
\hex[terrain=woods](c=6,r=4); |
| 1271 |
\hex[terrain=woods](c=6,r=5); |
| 1272 |
\hex[town={ |
| 1273 |
place={(hex cs:c=1,r=1,v=E,o=.3)}}] |
| 1274 |
(c=6,r=6); |
| 1275 |
\hex(c=6,r=7); \hex(c=6,r=8); |
| 1276 |
\hex[terrain=woods](c=6,r=9); |
| 1277 |
\hex[terrain=woods](c=6,r=10); |
| 1278 |
|
| 1279 |
\hex(c=7,r=4); \hex(c=7,r=5); |
| 1280 |
\hex(c=7,r=6); \hex(c=7,r=7); |
| 1281 |
\hex(c=7,r=8); \hex(c=7,r=9); |
| 1282 |
\end{scope} |
| 1283 |
} |
| 1284 |
% \end{macrocode} |
| 1285 |
% |
| 1286 |
% That concludes our hexes. Let us draw it (\figurename~\ref{fig:hexes}). |
| 1287 |
% |
| 1288 |
% \begin{figure} |
| 1289 |
% \centering |
| 1290 |
% \begin{tikzpicture}[scale=.7] |
| 1291 |
% \hexes |
| 1292 |
% \end{tikzpicture} |
| 1293 |
% \caption{Our hexes} |
| 1294 |
% \label{fig:hexes} |
| 1295 |
% \end{figure} |
| 1296 |
% |
| 1297 |
% This only defines the map. Now we would like to make the full |
| 1298 |
% board. Typically one want to add a turn track and some other stuff. |
| 1299 |
% Here, we will keep it fairly simple and just add a turn track. |
| 1300 |
% |
| 1301 |
% \begin{quote} |
| 1302 |
% This is where we need to start to consider VASSAL. Essentially, |
| 1303 |
% VASSAL can split a board into \emph{zones}. These zones can be |
| 1304 |
% different game specific places, e.g., a place to keep eliminated |
| 1305 |
% units, a place for the turn track, and so on. We will take |
| 1306 |
% advantage of this in our board definition by applying some |
| 1307 |
% specific styles. |
| 1308 |
% \end{quote} |
| 1309 |
% |
| 1310 |
% Below we customise the board frame, and some other things on the |
| 1311 |
% board. |
| 1312 |
% |
| 1313 |
% \begin{macrocode} |
| 1314 |
\colorlet{framebg}{gray!50!white} |
| 1315 |
\colorlet{titlefg}{gray!50!black} |
| 1316 |
\tikzset{ |
| 1317 |
hex/board frame/.style={ |
| 1318 |
scale line widths, |
| 1319 |
line width=.5pt, |
| 1320 |
draw=black}, |
| 1321 |
board frame/.style={% |
| 1322 |
anchor=south west, |
| 1323 |
transform shape, |
| 1324 |
scale line widths, |
| 1325 |
line width=1pt, |
| 1326 |
draw=black, |
| 1327 |
fill=framebg, |
| 1328 |
minimum width=14cm,% |
| 1329 |
minimum height=19cm |
| 1330 |
}, |
| 1331 |
turn/.style={ |
| 1332 |
scale line widths, |
| 1333 |
line width=.5pt, |
| 1334 |
fill=white, |
| 1335 |
draw=black, |
| 1336 |
text=gray, |
| 1337 |
minimum width=1.4cm, |
| 1338 |
minimum height=1.4cm, |
| 1339 |
text width=1.2cm, |
| 1340 |
align=center, |
| 1341 |
font=\sffamily\bfseries\huge, |
| 1342 |
transform shape, |
| 1343 |
anchor=north east |
| 1344 |
}, |
| 1345 |
title/.style={ |
| 1346 |
text=titlefg, |
| 1347 |
font=\sffamily\bfseries\Huge, |
| 1348 |
scale=1.5, |
| 1349 |
inner sep=0pt, |
| 1350 |
outer sep=0pt, |
| 1351 |
transform shape, |
| 1352 |
}, |
| 1353 |
sub title/.style={ |
| 1354 |
text=titlefg!75!white, |
| 1355 |
font=\sffamily\bfseries\normalsize, |
| 1356 |
scale=1.5, |
| 1357 |
transform shape, |
| 1358 |
text width=5cm, |
| 1359 |
inner sep=0pt, |
| 1360 |
outer sep=0pt, |
| 1361 |
align=right |
| 1362 |
} |
| 1363 |
} |
| 1364 |
% \end{macrocode} |
| 1365 |
% |
| 1366 |
% Let us start the board. The \textsf{wargame} package has a tool |
| 1367 |
% \verb+\boardrame+ which will put a frame around the map as defined |
| 1368 |
% by hex coordinates. It also output the map bounding box to the |
| 1369 |
% standard log file. So running \LaTeX{} once with this macro in |
| 1370 |
% effect will give us some useful information. |
| 1371 |
% |
| 1372 |
% We will define the board in two steps. First we define an |
| 1373 |
% \emph{environment} which holds the map, turn track, and title of the |
| 1374 |
% game, and after that we will add an environment that wraps it in a |
| 1375 |
% \Tikz{} picture. |
| 1376 |
% |
| 1377 |
% We define the board as an environment, so that we may put |
| 1378 |
% things on the board in our explanations of the rules. |
| 1379 |
% |
| 1380 |
% \begin{macrocode} |
| 1381 |
\newenvironment{innerboard}[1][]{% |
| 1382 |
\node[board frame] (frame) {}; |
| 1383 |
% \end{macrocode} |
| 1384 |
% |
| 1385 |
% This adds in our frame of the whole map as defined by the style |
| 1386 |
% above. |
| 1387 |
% |
| 1388 |
% Also note that we made our outer frame a \texttt{node}. This is so |
| 1389 |
% that we can refer to its anchors without too much knowledge of its |
| 1390 |
% size. |
| 1391 |
% |
| 1392 |
% We have made our frame a little bigger than the hex, so that we may |
| 1393 |
% add a turn track. We will at it at the top, and we will add 10 |
| 1394 |
% turns. Here, we make use of \Tikz{} loops, and they do the trick for |
| 1395 |
% us. |
| 1396 |
% |
| 1397 |
% We will make use the style \texttt{zone scope} with the name |
| 1398 |
% \texttt{Turns}. This will be made into a VASSAL zone that has a |
| 1399 |
% coordinate system that identifies it (at least by convention) as |
| 1400 |
% turn track. We will in fact deploy a little trick here to make the |
| 1401 |
% module even more complete. This is because we add the style |
| 1402 |
% \texttt{zone~point} to the turn number nodes below, and the first |
| 1403 |
% one will have the name of the game turn marker. This means that the |
| 1404 |
% game turn marker will \emph{automatically} be placed there. If the |
| 1405 |
% below is a little complicated for you, take a look at the |
| 1406 |
% alternative below the code |
| 1407 |
% |
| 1408 |
% \begin{macrocode} |
| 1409 |
\begin{scope}[ |
| 1410 |
shift={($(frame.south east)+(-0.5,.5)$)}] |
| 1411 |
\begin{scope}[zone scope=Turns] |
| 1412 |
\foreach \i in {1,...,10}{% |
| 1413 |
\pgfmathparse{\i*1.65-.225-.7} |
| 1414 |
\edef\y{\pgfmathresult} |
| 1415 |
\ifnum1=\i |
| 1416 |
\def\tname{game turn} |
| 1417 |
\else |
| 1418 |
\def\tname{T\i} |
| 1419 |
\fi |
| 1420 |
\node[turn,zone point={\tname}{-.7}{\y}] |
| 1421 |
at (0,\y+.7) {\i}; |
| 1422 |
} |
| 1423 |
\end{scope} |
| 1424 |
\end{scope} |
| 1425 |
% \end{macrocode} |
| 1426 |
% |
| 1427 |
% A simpler alternative would be |
| 1428 |
% |
| 1429 |
% \begin{verbatim} |
| 1430 |
% \begin{scope}[ |
| 1431 |
% shift={($(frame.south east)+(-0.5,.5)$)}] |
| 1432 |
% \begin{scope}[zone scope=Turns] |
| 1433 |
% \foreach \i in {1,...,10}{% |
| 1434 |
% \node[turn] at (0,\i*1.65-.225) {\i}; |
| 1435 |
% } |
| 1436 |
% \end{scope} |
| 1437 |
% \end{scope} |
| 1438 |
% \end{verbatim} |
| 1439 |
% We also add a title using the styles we defined above. Note, |
| 1440 |
% consistent use of \Tikz{} styles makes it very easy to change things |
| 1441 |
% consistently throughout the game. |
| 1442 |
% |
| 1443 |
% \begin{macrocode} |
| 1444 |
\node[below right=5mm and 5mm of |
| 1445 |
frame.north west,title]{A Game}; |
| 1446 |
\node[below left=5mm and 5mm of |
| 1447 |
frame.north east,sub title]{A tutorial in the\\ |
| 1448 |
{\color{white}wargame} package}; |
| 1449 |
% \end{macrocode} |
| 1450 |
% |
| 1451 |
% With this, we are left with adding in the map. |
| 1452 |
% |
| 1453 |
% \begin{macrocode} |
| 1454 |
\scope[shift={(.5,.5)}] |
| 1455 |
\scope[shift={(1,0.86603)}, |
| 1456 |
zone scope=Hex] |
| 1457 |
\hexes |
| 1458 |
\boardframe(c=1,r=1)(c=7,r=10) |
| 1459 |
% Reported by the above |
| 1460 |
% Board Frame: |
| 1461 |
% BBox: (-1.0,-0.86603)x(10.0,15.5885) |
| 1462 |
% WxH: (11.0x16.45453) |
| 1463 |
% NCxNR (1,1)x(7,10) |
| 1464 |
% \end{macrocode} |
| 1465 |
% |
| 1466 |
% Above, we see the output from \verb+\boardframe+. This in turn |
| 1467 |
% informs us how to set the offset of the inner most scope. We also |
| 1468 |
% see that the map is $11\times 16.45453\,\textrm{cm}$ big, which means |
| 1469 |
% our board will easily fit on standard paper (A4 or, less standard, |
| 1470 |
% Letter). |
| 1471 |
% |
| 1472 |
% \begin{quote} |
| 1473 |
% The offset of $(-1,0.86603)$ is not surprising when you know that |
| 1474 |
% the radius $r$ of the circumscribed circle of the hexes is 1\,cm, |
| 1475 |
% and that the first hex centre is placed in $(0,0)$. The horizontal |
| 1476 |
% offset of -1 is just that radius $r$, and the vertical offset is |
| 1477 |
% $r\sin60^{\circ}=\sqrt{3}/2=0.86603$. |
| 1478 |
% \end{quote} |
| 1479 |
% |
| 1480 |
% The outer most scope translates the hex 5mm in from both edges so |
| 1481 |
% that we may draw a nice frame around the map. |
| 1482 |
% |
| 1483 |
% The style \texttt{zone scope=Hex} will make this area a zone in |
| 1484 |
% VASSAL and it will have a hex grid (because its argument contains |
| 1485 |
% the sub string \texttt{hex}) attached to it. |
| 1486 |
% |
| 1487 |
% This end the start of the environment. Next, we define the end of |
| 1488 |
% it. This simply closes the scopes and the \Tikz{} picture. |
| 1489 |
% |
| 1490 |
% \begin{macrocode} |
| 1491 |
}{ |
| 1492 |
\endscope% |
| 1493 |
\endscope% |
| 1494 |
} |
| 1495 |
% \end{macrocode} |
| 1496 |
% |
| 1497 |
% This ends the environment that defines the board proper. Now we |
| 1498 |
% wrap it in another environment that will put the map inside a |
| 1499 |
% \Tikz{} picture. |
| 1500 |
% |
| 1501 |
% \begin{macrocode} |
| 1502 |
\newenvironment{board}[1][]{% |
| 1503 |
\tikzpicture[#1,zoned] |
| 1504 |
\innerboard}{% |
| 1505 |
\endinnerboard% |
| 1506 |
\endtikzpicture} |
| 1507 |
% \end{macrocode} |
| 1508 |
% |
| 1509 |
% The style \texttt{zoned} on the \Tikz{} picture ensures that we will |
| 1510 |
% get a zoned map when generating the VASSAL module. Note that we |
| 1511 |
% used the \TeX{}-like form of the environment \verb+\tikzpicture+, |
| 1512 |
% rather than \verb+\begin{tikzpicture}+, so that the various |
| 1513 |
% \verb+\end+s does not mess up things. |
| 1514 |
% |
| 1515 |
% |
| 1516 |
% We can draw the final board (\figurename~\ref{fig:board}). |
| 1517 |
% \begin{figure} |
| 1518 |
% \centering |
| 1519 |
% \begin{board}[scale=.5] |
| 1520 |
% \end{board} |
| 1521 |
% \caption{The final board} |
| 1522 |
% \label{fig:board} |
| 1523 |
% \end{figure} |
| 1524 |
% |
| 1525 |
% \subsection{Adding units to the board} |
| 1526 |
% \label{sec:board:units} |
| 1527 |
% |
| 1528 |
% We have defined our board as a environment so we can add units to it |
| 1529 |
% without much hassle. Let us add the starting units at the starting |
| 1530 |
% positions. Since we will be \emph{stacking} chits, we will use the |
| 1531 |
% \verb+\chitstack+ macro for this. Note that this macro expects code |
| 1532 |
% to produce the chits (rather than the unit styles). Therefore we |
| 1533 |
% must add in some \verb+\noexpand+ in front of the \verb+\chit+ |
| 1534 |
% command. |
| 1535 |
% |
| 1536 |
% \begin{figure} |
| 1537 |
% \centering |
| 1538 |
% \begin{board}[scale=.5]% |
| 1539 |
% \stackchits(A2)(.2,.2){%% |
| 1540 |
% \noexpand\chit[a hq],% |
| 1541 |
% \noexpand\chit[a 1 hqbg],% |
| 1542 |
% \noexpand\chit[a 1 2jd ibn],% |
| 1543 |
% \noexpand\chit[a 2 1jd abn]}% |
| 1544 |
% \chit[a 1 1lg ibn](D3);% |
| 1545 |
% \stackchits(C2)(.2,.2){%% |
| 1546 |
% \noexpand\chit[a 2 hqbg],% |
| 1547 |
% \noexpand\chit[a 1 1gh ibn]}% |
| 1548 |
% \stackchits(A1)(.2,.2){%% |
| 1549 |
% \noexpand\chit[a aregt],% |
| 1550 |
% \noexpand\chit[a 1 1 abn]}% |
| 1551 |
% \chit[a 2 3gh rbn](D2);% |
| 1552 |
% |
| 1553 |
% \stackchits(F6)(.2,.2){%% |
| 1554 |
% \noexpand\chit[b hq],% |
| 1555 |
% \noexpand\chit[b lg hqregt],% |
| 1556 |
% \noexpand\chit[b lg ibn]}% |
| 1557 |
% \stackchits(E7)(.2,.2){%% |
| 1558 |
% \noexpand\chit[b k3 hqregt],% |
| 1559 |
% \noexpand\chit[b k3 31 abibn]}% |
| 1560 |
% \stackchits(D7)(.2,.2){%% |
| 1561 |
% \noexpand\chit[b p4 hqregt],% |
| 1562 |
% \noexpand\chit[b p4 41 cabn],% |
| 1563 |
% \noexpand\chit[b p4 42 cabn]}% |
| 1564 |
% \stackchits(E3)(.2,.2){%% |
| 1565 |
% \noexpand\chit[b p7 hqregt],% |
| 1566 |
% \noexpand\chit[b p7 71 ibn],% |
| 1567 |
% \noexpand\chit[b p7 72 cabn]}% |
| 1568 |
% \stackchits(D4)(.2,.2){%% |
| 1569 |
% \noexpand\chit[b i13 hqregt],% |
| 1570 |
% \noexpand\chit[b i13 131 ibn],% |
| 1571 |
% \noexpand\chit[b i13 132 ibn]}% |
| 1572 |
% \end{board} |
| 1573 |
% \caption{The board with units at their starting positions} |
| 1574 |
% \label{fig:board-start} |
| 1575 |
% \end{figure} |
| 1576 |
% |
| 1577 |
% The board with the ``At-start'' units in place are shown in |
| 1578 |
% \figurename~\ref{fig:board-start}. The first part of this was made |
| 1579 |
% with |
| 1580 |
% |
| 1581 |
% \begin{verbatim} |
| 1582 |
% \begin{board} |
| 1583 |
% \stackchits(A2)(.2,.2){% |
| 1584 |
% \noexpand\chit[a hq], |
| 1585 |
% \noexpand\chit[a 1 hqbg], |
| 1586 |
% \noexpand\chit[a 1 2jd ibn], |
| 1587 |
% \noexpand\chit[a 2 1jd abn]} |
| 1588 |
% \chit[a 1 1lg ibn](D3); |
| 1589 |
% \end{verbatim} |
| 1590 |
% |
| 1591 |
% The first argument to \verb+\stackchits+ is where to put the |
| 1592 |
% stack. The second is the offset applied to each stack unit in |
| 1593 |
% succession (obviously the first offset is $(0,0)$). The third |
| 1594 |
% argument is the list of chits to add to the stack. |
| 1595 |
% |
| 1596 |
% Note that we use the hex labels, rather than the hex coordinates, to |
| 1597 |
% place the units and stacks of units, thanks to \texttt{hex/label is |
| 1598 |
% name}. |
| 1599 |
% |
| 1600 |
% We have made the counters and board for the game. What remains is |
| 1601 |
% the various tables (and or of course the rules). |
| 1602 |
% |
| 1603 |
% \subsection{Clipped boards} |
| 1604 |
% \label{sec:board:clipped} |
| 1605 |
% |
| 1606 |
% We are not quite done with the board just yet. We want to make |
| 1607 |
% \emph{another} environment which will clip to a specified area of |
| 1608 |
% the map. We will reuse our \texttt{innerboard} environment so that |
| 1609 |
% everything is consistent. Let us go ahead and define the |
| 1610 |
% environment, and then see later how it is used. We define our |
| 1611 |
% environment as two macros \verb+\clipped+ and \verb+\endclipped+ so |
| 1612 |
% that we can use parenthesis for our arguments. |
| 1613 |
% |
| 1614 |
% \begin{macrocode} |
| 1615 |
\tikzset{ |
| 1616 |
clip board/.style={gray,line width=.5pt}} |
| 1617 |
\newcommand\clipped[1][]{\doclipped[#1]} |
| 1618 |
\def\doclipped[#1](#2)(#3){ |
| 1619 |
\def\tmp@clip@a{#2} |
| 1620 |
\def\tmp@clip@b{#3} |
| 1621 |
\tikzpicture[#1] |
| 1622 |
\scope |
| 1623 |
\clip (#2) rectangle (#3); |
| 1624 |
\scope[shift={(-.5-1,-.5-0.86603)}] |
| 1625 |
\innerboard} |
| 1626 |
\def\endclipped{% |
| 1627 |
\endinnerboard |
| 1628 |
\endscope |
| 1629 |
\endscope |
| 1630 |
\draw[clip board](\tmp@clip@a) |
| 1631 |
rectangle (\tmp@clip@b); |
| 1632 |
\endtikzpicture} |
| 1633 |
% \end{macrocode} |
| 1634 |
% |
| 1635 |
% Our environment \texttt{clipped} takes 3 arguments. One is optional |
| 1636 |
% and is keys to pass to the \Tikz{} picture environment. The two |
| 1637 |
% others are the coordinates (relative to the hexes) of our clipping |
| 1638 |
% rectangle. Let us illustrate this with an example --- see |
| 1639 |
% \figurename~\ref{fig:clipped}. |
| 1640 |
% |
| 1641 |
% \begin{figure} |
| 1642 |
% \centering |
| 1643 |
% \begin{clipped}(hex cs:c=2,r=2)(hex cs:c=5,r=5) |
| 1644 |
% \end{clipped} |
| 1645 |
% \caption{Example of using \texttt{clipped}.} |
| 1646 |
% \label{fig:clipped} |
| 1647 |
% \end{figure} |
| 1648 |
% |
| 1649 |
% The figure was produced by the code |
| 1650 |
% |
| 1651 |
% \begin{verbatim} |
| 1652 |
% \begin{clipped}(hex cs:c=2,r=2)(hex cs:c=5,r=5) |
| 1653 |
% \end{clipped} |
| 1654 |
% \end{verbatim} |
| 1655 |
% |
| 1656 |
% Note that we \emph{must} use the hex coordinate system. When we |
| 1657 |
% make the clipping path, the nodes of the hex map has not yet been |
| 1658 |
% defined. We can use this to illustrate things on the map. For |
| 1659 |
% example, \figurename~\ref{fig:clipped-attack} show that B P7/72 CABN |
| 1660 |
% attacks A 2/1JD ABN with the code |
| 1661 |
% |
| 1662 |
% \begin{verbatim} |
| 1663 |
% \begin{clipped}(hex cs:c=2,r=3)(hex cs:c=5,r=5) |
| 1664 |
% \chit[b p7 72 cabn](D5); |
| 1665 |
% \chit[a 2 1jd abn](C4); |
| 1666 |
% \draw[hex/attack] (D5)--(C4); |
| 1667 |
% \end{clipped} |
| 1668 |
% \end{verbatim} |
| 1669 |
% |
| 1670 |
% \begin{figure} |
| 1671 |
% \centering |
| 1672 |
% \begin{clipped}(hex cs:c=2,r=3)(hex cs:c=5,r=5) |
| 1673 |
% \chit[b p7 72 cabn](D5); |
| 1674 |
% \chit[a 2 1jd abn](C4); |
| 1675 |
% \draw[hex/attack] (D5)--(C4); |
| 1676 |
% \end{clipped} |
| 1677 |
% \caption{Example of using \texttt{clipped}.} |
| 1678 |
% \label{fig:clipped-attack} |
| 1679 |
% \end{figure} |
| 1680 |
% |
| 1681 |
% Note that \emph{inside} the environment we \emph{can} use hex |
| 1682 |
% labels as coordinates. |
| 1683 |
% |
| 1684 |
% \section{The charts} |
| 1685 |
% \label{sec:charts} |
| 1686 |
% |
| 1687 |
% We will not go into details about how to make tables in |
| 1688 |
% \LaTeX{}. There are plenty of excellent resources out there for that |
| 1689 |
% purpose. Here we will make three tables: The combat resolution |
| 1690 |
% table (CRT), the terrain effects chart (TEC), and the Order of Battle |
| 1691 |
% (OOB) chart\footnote{In some games this is called the Order of |
| 1692 |
% Appearance (OOA) chart.} --- all of which in some respect uses |
| 1693 |
% elements of the |
| 1694 |
% \textsf{wargame} package. |
| 1695 |
% |
| 1696 |
% For all the tables, we would like to use the \textsf{colortbl} |
| 1697 |
% package to colour the rows. Here, we make some short hands for |
| 1698 |
% doing just that. |
| 1699 |
% |
| 1700 |
% \begin{macrocode} |
| 1701 |
\colorlet{headbg}{gray!50!white} |
| 1702 |
\colorlet{altbg}{gray!15!white} |
| 1703 |
\newcommand\headrow{\rowcolor{headbg}} |
| 1704 |
\newcommand\defrow{\rowcolor{white}} |
| 1705 |
\newcommand\altrow{\rowcolor{altbg}} |
| 1706 |
% \end{macrocode} |
| 1707 |
% |
| 1708 |
% \subsection{The CRT} |
| 1709 |
% \label{sec:charts:crt} |
| 1710 |
% |
| 1711 |
% The combat resolution table is in some sense a straight forward |
| 1712 |
% \LaTeX{} table. Here's the definition |
| 1713 |
% |
| 1714 |
% \begin{macrocode} |
| 1715 |
\newcommand\crt{% |
| 1716 |
\begin{tabular}{|c|cccccc|} |
| 1717 |
\hline |
| 1718 |
\headrow |
| 1719 |
\textbf{Die} |
| 1720 |
& \multicolumn{6}{c|}{\textbf{Odds}} |
| 1721 |
\\ |
| 1722 |
\headrow |
| 1723 |
\textbf{roll} |
| 1724 |
& \textbf{1:3} |
| 1725 |
& \textbf{1:2} |
| 1726 |
& \textbf{1:1} |
| 1727 |
& \textbf{2:1} |
| 1728 |
& \textbf{3:1} |
| 1729 |
& \textbf{4:1} |
| 1730 |
\\ |
| 1731 |
\hline |
| 1732 |
\defrow |
| 1733 |
1 & AE & AR & AR & EX & DR & DR \\ |
| 1734 |
\altrow |
| 1735 |
2 & AE & AR & EX & EX & DR & DR \\ |
| 1736 |
\defrow |
| 1737 |
3 & AR & EX & EX & DR & DR & DE \\ |
| 1738 |
\altrow |
| 1739 |
4 & AR & EX & EX & DR & DR & DE \\ |
| 1740 |
\defrow |
| 1741 |
5 & EX & EX & DR & DR & DE & DE \\ |
| 1742 |
\altrow |
| 1743 |
5 & EX & DR & DR & DE & DE & DE \\ |
| 1744 |
\hline |
| 1745 |
\end{tabular}} |
| 1746 |
% \end{macrocode} |
| 1747 |
% |
| 1748 |
% And what it looks like is shown in \tablename~\ref{tab:crt} |
| 1749 |
% |
| 1750 |
% \begin{table} |
| 1751 |
% \centering |
| 1752 |
% \crt{} |
| 1753 |
% \caption{The combat resolution table} |
| 1754 |
% \label{tab:crt} |
| 1755 |
% \end{table} |
| 1756 |
% |
| 1757 |
% \subsection{The TEC} |
| 1758 |
% \label{sec:charts:te} |
| 1759 |
% |
| 1760 |
% In this table we will use small version of hexes to make a nice |
| 1761 |
% table. The definition is as follows. |
| 1762 |
% |
| 1763 |
% \begin{macrocode} |
| 1764 |
\newcommand\tec{% |
| 1765 |
\begin{tabular}{|cl|cc|} |
| 1766 |
\hline |
| 1767 |
\headrow |
| 1768 |
\multicolumn{2}{|c|}{\textbf{Terrain}} |
| 1769 |
& MF |
| 1770 |
& CF\textsuperscript{\dag} |
| 1771 |
\\ |
| 1772 |
\hline |
| 1773 |
\defrow |
| 1774 |
\tikz[scale=.5]{\hex[label=]} |
| 1775 |
& Clear |
| 1776 |
& 1 |
| 1777 |
& --- |
| 1778 |
\\ |
| 1779 |
\altrow |
| 1780 |
\tikz[scale=.5]{\hex[label=,terrain=woods]} |
| 1781 |
& Woods |
| 1782 |
& 2 |
| 1783 |
& \texttimes 2\textsuperscript{*} |
| 1784 |
\\ |
| 1785 |
\defrow |
| 1786 |
\tikz[scale=.5]{\hex[label=,terrain=mountains]} |
| 1787 |
& Mountains |
| 1788 |
& Stop |
| 1789 |
& \texttimes 2\textsuperscript{*} |
| 1790 |
\\ |
| 1791 |
\altrow |
| 1792 |
\tikz[scale=.5]{ |
| 1793 |
\hex[label=,fill=sea](c=1,r=1); |
| 1794 |
\begin{scope} |
| 1795 |
\clip |
| 1796 |
(hex cs:c=1,r=1,v=NW) |
| 1797 |
--(hex cs:c=1,r=1,v=W) |
| 1798 |
--(hex cs:c=1,r=1,v=SW) |
| 1799 |
--(hex cs:c=1,r=1,e=S) |
| 1800 |
--(hex cs:c=1,r=1,v=W,o=.5) |
| 1801 |
--cycle |
| 1802 |
(hex cs:c=1,r=1,e=N) |
| 1803 |
--(hex cs:c=1,r=1,v=NE) |
| 1804 |
--(hex cs:c=1,r=1,v=E) |
| 1805 |
--(hex cs:c=1,r=1,e=SE) |
| 1806 |
--(hex cs:c=1,r=1,v=E,o=.4) |
| 1807 |
--cycle |
| 1808 |
; |
| 1809 |
\hex[label=](c=1,r=1); |
| 1810 |
\end{scope} |
| 1811 |
} |
| 1812 |
& Coastal |
| 1813 |
& 2 |
| 1814 |
& \texttimes2\phantom{\textsuperscript{*}} |
| 1815 |
\\ |
| 1816 |
\hline |
| 1817 |
\multicolumn{4}{l}{\textsuperscript{\dag} |
| 1818 |
\emph{Defender} modifier}\\ |
| 1819 |
\multicolumn{4}{l}{\textsuperscript{*} |
| 1820 |
\infantrymark{}\,\pgmark{} \emph{only}, |
| 1821 |
unless \artillerymark} |
| 1822 |
\\ |
| 1823 |
\end{tabular} |
| 1824 |
} |
| 1825 |
% \end{macrocode} |
| 1826 |
% |
| 1827 |
% The result is in \tablename~\ref{tab:te}. Note the use of |
| 1828 |
% \verb+\infantrymark+ to put in \infantrymark{} in the table. The |
| 1829 |
% \textsf{wargame} package defines a number of macros like this. |
| 1830 |
% |
| 1831 |
% \begin{table} |
| 1832 |
% \centering |
| 1833 |
% \tec |
| 1834 |
% \caption{The terrain effects table} |
| 1835 |
% \label{tab:te} |
| 1836 |
% \end{table} |
| 1837 |
% |
| 1838 |
% \subsection{The OOB} |
| 1839 |
% \label{sec:charts:oob} |
| 1840 |
% |
| 1841 |
% We like to make an OOB chart that we can place our unit counter on |
| 1842 |
% so we can keep track of which units are available when. In our |
| 1843 |
% game, all A faction units start already on the board. The B faction, |
| 1844 |
% however, has most of its reinforcement troops way up north, and will |
| 1845 |
% therefore bring them on the map piecemeal. |
| 1846 |
% |
| 1847 |
% We will use the \textsf{wargame} macro \verb+\oob+ to make our |
| 1848 |
% OOBs. This macro uses the \texttt{pic} \texttt{chits/oob~turn} to |
| 1849 |
% make the turns. The default setting is not what we want, so we |
| 1850 |
% redefine that picture. In particular, we want turn ``0'' to say |
| 1851 |
% ``At start''. |
| 1852 |
% |
| 1853 |
% We also want to reuse the style \texttt{turn} we used |
| 1854 |
% to make the turn track on the board, but modify it a bit to fit our |
| 1855 |
% purposes here. We therefore define the style \texttt{oob~turn} |
| 1856 |
% which derives from \texttt{turn}, but scale it down 70\%, change the |
| 1857 |
% anchor, and add some extra space outside of it |
| 1858 |
% (\texttt{outer~sep}). |
| 1859 |
% |
| 1860 |
% \begin{macrocode} |
| 1861 |
\tikzset{ |
| 1862 |
oob turn/.style={ |
| 1863 |
turn, |
| 1864 |
transform shape, |
| 1865 |
anchor=east, |
| 1866 |
outer sep=2mm, |
| 1867 |
scale=.7}, |
| 1868 |
} |
| 1869 |
% \end{macrocode} |
| 1870 |
% |
| 1871 |
% Our modified \texttt{chit/oob~turn} picture will check if we get an |
| 1872 |
% empty turn number, or the special ``0'' turn, and then put in a node |
| 1873 |
% with the appropriate contents. Note that we define two pictures, |
| 1874 |
% one which actually puts in the turn, and one that puts in nothing, |
| 1875 |
% so when we make the combined OOB we only output the turns once. We |
| 1876 |
% then default \texttt{chit/oob~turn} to the first picture |
| 1877 |
% |
| 1878 |
% \begin{macrocode} |
| 1879 |
\tikzset{ |
| 1880 |
oob turn real/.pic={% |
| 1881 |
\def\tmp{{\Large At start}} |
| 1882 |
\ifx|#1|\else% |
| 1883 |
\ifnum0=#1\else% |
| 1884 |
\def\tmp{#1}% |
| 1885 |
\fi% |
| 1886 |
\fi% |
| 1887 |
\node[oob turn,transform shape]{\tmp}; |
| 1888 |
}, |
| 1889 |
oob turn empty/.pic={}, |
| 1890 |
} |
| 1891 |
\newcommand\oobrealturn{% |
| 1892 |
\tikzset{ |
| 1893 |
pics/chit/oob turn/.style=% |
| 1894 |
{oob turn real=##1}}} |
| 1895 |
\newcommand\oobemptyturn{% |
| 1896 |
\tikzset{ |
| 1897 |
pics/chit/oob turn/.style=% |
| 1898 |
{oob turn empty=##1}}} |
| 1899 |
\oobrealturn |
| 1900 |
% \end{macrocode} |
| 1901 |
% |
| 1902 |
% Let us see how this looks for both factions. Factions A and B are |
| 1903 |
% shown in \figurename~\ref{fig:a-oob} and \ref{fig:b-oob}, |
| 1904 |
% respectively. |
| 1905 |
% |
| 1906 |
% \begin{figure} |
| 1907 |
% \centering |
| 1908 |
% \begin{tikzpicture}[oob turn/.append style={anchor=west}] |
| 1909 |
% \oob*{\alla}{4}{1.24}{0} |
| 1910 |
% \end{tikzpicture} |
| 1911 |
% \caption{Faction A OOB} |
| 1912 |
% \label{fig:a-oob} |
| 1913 |
% \end{figure} |
| 1914 |
% |
| 1915 |
% \begin{figure} |
| 1916 |
% \centering |
| 1917 |
% \begin{tikzpicture} |
| 1918 |
% \oob{\allb}{4}{1.24}{0} |
| 1919 |
% \end{tikzpicture} |
| 1920 |
% \caption{Faction B OOB} |
| 1921 |
% \label{fig:b-oob} |
| 1922 |
% \end{figure} |
| 1923 |
% |
| 1924 |
% These were done with |
| 1925 |
% |
| 1926 |
% \begin{verbatim} |
| 1927 |
% \begin{tikzpicture}[oob turn/.append style={anchor=west}] |
| 1928 |
% \oob*{\alla}{4}{1.24}{0} |
| 1929 |
% \end{tikzpicture} |
| 1930 |
% \begin{tikzpicture} |
| 1931 |
% \oob{\allb}{4}{1.24}{0} |
| 1932 |
% \end{tikzpicture} |
| 1933 |
% \end{verbatim} |
| 1934 |
% |
| 1935 |
% Note that the stared version \verb+\oob*+ puts out the counters |
| 1936 |
% right aligned. This is also why we append the style |
| 1937 |
% \texttt{oob~turn} to be anchored to the west. |
| 1938 |
% |
| 1939 |
% The first argument to \verb+\oob+ is the list of lists of counters. |
| 1940 |
% This is why we defined \verb+\alla+ and \verb+\allb+ in the way we |
| 1941 |
% did. The second argument is the distance between each counter. |
| 1942 |
% Since the counters are 1.2\,cm wide, we gave them a little extra |
| 1943 |
% space between them by setting the second argument to 1.24\,(cm). |
| 1944 |
% The third argument is the spacing between turn rows. Above we have |
| 1945 |
% set that to 0\,(cm), but that we will change in the real OOB chart. |
| 1946 |
% |
| 1947 |
% And that's what we will do next. This will be rather wide, so we |
| 1948 |
% when we show it in a minute, we will do so in a wide table (leaving |
| 1949 |
% the two-column layout for a minute). |
| 1950 |
% |
| 1951 |
% \begin{macrocode} |
| 1952 |
\newcommand\inneroob[1][]{% |
| 1953 |
\node[board frame,anchor=north] (oob frame) |
| 1954 |
at (0,2.5) {};% |
| 1955 |
% Game title |
| 1956 |
\node[% |
| 1957 |
below right=5mm and 5mm of oob frame.north west, |
| 1958 |
title,scale=.8]{A Game}; |
| 1959 |
% Chart title |
| 1960 |
\node[% |
| 1961 |
below left=5mm and 5mm of oob frame.north east, |
| 1962 |
sub title,scale=1.2,transform shape]{% |
| 1963 |
Order of Battle}; |
| 1964 |
% Turn title |
| 1965 |
\node[font=\sffamily\bfseries\Large, |
| 1966 |
anchor=south, |
| 1967 |
white,transform shape] at (0,1) {Turn}; |
| 1968 |
% |
| 1969 |
\begin{scope}[% |
| 1970 |
transform shape, |
| 1971 |
oob turn/.append style={anchor=west},% |
| 1972 |
shift={(-1.4,0)}, |
| 1973 |
zone scope=A OOB]% |
| 1974 |
\oobemptyturn% |
| 1975 |
\oob*{\alla}{4}{1.4}{.2}% |
| 1976 |
\end{scope}% |
| 1977 |
% |
| 1978 |
\begin{scope}[% |
| 1979 |
transform shape, |
| 1980 |
shift={(1.4,0)}, |
| 1981 |
zone scope=B OOB]% |
| 1982 |
\oobrealturn% |
| 1983 |
\oob{\allb}{4}{1.4}{.2}% |
| 1984 |
\end{scope}% |
| 1985 |
% |
| 1986 |
} |
| 1987 |
\newcommand\fulloob[1][]{% |
| 1988 |
\begin{tikzpicture}[#1,zoned]% |
| 1989 |
\inneroob |
| 1990 |
\end{tikzpicture}} |
| 1991 |
% \end{macrocode} |
| 1992 |
% A couple of things to note. |
| 1993 |
% |
| 1994 |
% We put everything inside a \Tikz{} picture with the option |
| 1995 |
% \texttt{zoned} so that we will get a zoned |
| 1996 |
% map in VASSAL. We also add the zones \texttt{A OOB} and \texttt{B |
| 1997 |
% OOB} via the key \texttt{zone scope}. We will need to adjust the |
| 1998 |
% grids of the zones later on. Another side effect of using |
| 1999 |
% \verb+\oob+ is that each turn will be marked as a ``region'' of a |
| 2000 |
% ``region grid'' in in VASSAL, so that the each counter will be |
| 2001 |
% automatically placed in its place on the OOB in the VASSAL module. |
| 2002 |
% |
| 2003 |
% Secondly, we reuse our \texttt{board frame}, \texttt{title}, and |
| 2004 |
% \texttt{sub~title} styles to make the OOB come out in similar manner |
| 2005 |
% as the board. We do adjust the font sizes a bit though. We have |
| 2006 |
% also made the OOB the same size as the board so that they stack |
| 2007 |
% nicely. |
| 2008 |
% |
| 2009 |
% Finally, when we make the faction A oob, we turn off generation of |
| 2010 |
% the turn numbers. This is so we do note produce those twice. |
| 2011 |
% |
| 2012 |
% |
| 2013 |
% The final OOB is shown in \figurename~\ref{fig:oob}. This was |
| 2014 |
% produced with |
| 2015 |
% |
| 2016 |
% \begin{verbatim} |
| 2017 |
% \fulloob |
| 2018 |
% \end{verbatim} |
| 2019 |
% |
| 2020 |
% \begin{figure} |
| 2021 |
% \centering |
| 2022 |
% \fulloob[scale=.5] |
| 2023 |
% \caption{The OOB} |
| 2024 |
% \label{fig:oob} |
| 2025 |
% \end{figure} |
| 2026 |
% |
| 2027 |
% \section{Ending the package} |
| 2028 |
% \label{sec:end:package} |
| 2029 |
% |
| 2030 |
% At the end of the package we should end with the marker |
| 2031 |
% \verb+\endinput+. |
| 2032 |
% |
| 2033 |
% \begin{macrocode} |
| 2034 |
\endinput |
| 2035 |
% \end{macrocode} |
| 2036 |
% |
| 2037 |
% This is the end of the package. We will do a little more in the |
| 2038 |
% main document. |
| 2039 |
% |
| 2040 |
% |
| 2041 |
% \iffalse |
| 2042 |
% Local Variables: |
| 2043 |
% mode: docTeX |
| 2044 |
% TeX-master: "game.tex" |
| 2045 |
% End: |
| 2046 |
% \fi |