More working build, trying to optimize
This commit is contained in:
parent
d28e1b855f
commit
6c30f0447b
1348
.ninja_log
1348
.ninja_log
File diff suppressed because it is too large
Load diff
|
@ -2,7 +2,7 @@
|
|||
|
||||
package iditacards
|
||||
|
||||
#AssetKind: "image" | "tex" | "template" | "cat"
|
||||
#AssetKind: "image" | "tex" | "texdoc" | "template" | "cat"
|
||||
|
||||
#Asset: {
|
||||
// passed to convert to create the "print" version (usually to add bleed)
|
||||
|
@ -37,6 +37,10 @@ package iditacards
|
|||
source: string
|
||||
size: #Dimensions
|
||||
}
|
||||
|
||||
if kind == "texdoc" {
|
||||
source: string
|
||||
}
|
||||
}
|
||||
|
||||
// Assets are what actually need to be printed/created/etc
|
||||
|
|
|
@ -13,3 +13,10 @@ assets:
|
|||
source: iditaboard.tex
|
||||
size: 4875x3075
|
||||
|
||||
instructions:
|
||||
kind: texdoc
|
||||
source: instructions.tex
|
||||
|
||||
instructions-anatomy:
|
||||
kind: texdoc
|
||||
source: instructions-anatomy.tex
|
||||
|
|
2274
build.ninja
2274
build.ninja
File diff suppressed because it is too large
Load diff
|
@ -40,7 +40,7 @@ assets: {
|
|||
for deckname, deck in decks
|
||||
for cardname, freq in deck
|
||||
let card = cards[cardname] {
|
||||
"\(deckname)-\(cardname)[\(freq.count)]": {
|
||||
"cards/\(deckname)-\(cardname)[\(freq.count)]": {
|
||||
size: "750x1050"
|
||||
print: "-set option:distort:viewport 825x1125-37-37 -virtual-pixel Edge -distort SRT 0 +repage"
|
||||
|
||||
|
@ -72,7 +72,7 @@ pseudoassets: {
|
|||
contents: [
|
||||
for cardname, freq in deck
|
||||
for idx in list.Range(0, freq.count, 1) {
|
||||
"\(deckname)-\(cardname)[\(freq.count)]"
|
||||
"cards/\(deckname)-\(cardname)[\(freq.count)]"
|
||||
},
|
||||
]
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ pseudoassets: {
|
|||
for deckname, deck in decks
|
||||
for cardname, card in deck {
|
||||
for idx in list.Range(0, card.count, 1) {
|
||||
"\(deckname)-\(cardname)[\(card.count)]"
|
||||
"cards/\(deckname)-\(cardname)[\(card.count)]"
|
||||
}
|
||||
},
|
||||
]
|
||||
|
|
27
configure.jq
27
configure.jq
|
@ -33,13 +33,15 @@ def cuesources:
|
|||
.w = (.size | split("x")[0]) |
|
||||
.h = (.size | split("x")[1]) |
|
||||
.rawsuffix = (if .print then "raw." else "" end) |
|
||||
"build output/\(.name).json: extract output/everything.json",
|
||||
"build output/.\(.name).json.stamp | output/\(.name).json: extract output/everything.json",
|
||||
" filter = --arg asset '\(.name)' '.assets[$$asset].data'",
|
||||
" target = output/\(.name).json",
|
||||
"build output/\(.name).tex: template2tex output/\(.name).json | templates/\(.template)",
|
||||
" template = templates/\(.template)",
|
||||
"build output/\(.name).pdf: tex2pdf output/\(.name).tex || output/\(.name).pdf.dd",
|
||||
" dyndep = output/\(.name).pdf.dd",
|
||||
"build output/\(.name).pdf.dd: scantex output/\(.name).tex",
|
||||
"build output/\(.name).pdf: tex2pdf output/\(.name).tex || output/.\(.name).pdf.dd",
|
||||
" dyndep = output/.\(.name).pdf.dd",
|
||||
"build output/.\(.name).pdf.dd: scantex output/\(.name).tex",
|
||||
" target = output/\(.name).pdf",
|
||||
"build output/\(.name).\(.rawsuffix)png: pdf2png output/\(.name).pdf",
|
||||
" w = \(.w)",
|
||||
" h = \(.h)",
|
||||
|
@ -56,13 +58,24 @@ def cuesources:
|
|||
.w = (.size | split("x")[0]) |
|
||||
.h = (.size | split("x")[1]) |
|
||||
.rawsuffix = (if .print then "raw." else "" end) |
|
||||
"build output/\(.name).pdf: tex2pdf \(.source) || output/\(.name).pdf.dd",
|
||||
" dyndep = output/\(.name).pdf.dd",
|
||||
"build output/\(.name).pdf.dd: scantex \(.source)",
|
||||
"build output/\(.name).pdf: tex2pdf \(.source) || output/.\(.name).pdf.dd",
|
||||
" dyndep = output/.\(.name).pdf.dd",
|
||||
"build output/.\(.name).pdf.dd: scantex \(.source)",
|
||||
" target = output/\(.name).pdf",
|
||||
"build output/\(.name).\(.rawsuffix)png: pdf2png output/\(.name).pdf",
|
||||
" w = \(.w)",
|
||||
" h = \(.h)",
|
||||
(select(.print) | "build output/\(.name).png: convert output/\(.name).raw.png"),
|
||||
(select(.print) | " args = \(.print)")
|
||||
),(
|
||||
select(.kind == "texdoc") |
|
||||
"build output/\(.name).pdf: tex2pdf2x \(.source) || output/.\(.name).pdf.dd",
|
||||
" dyndep = output/.\(.name).pdf.dd",
|
||||
"build output/.\(.name).pdf.dd: scantex \(.source)",
|
||||
" target = output/\(.name).pdf"
|
||||
),(
|
||||
select(.kind == "cat") |
|
||||
.ins = (.contents | map("output/\(.).pdf") | join(" ")) |
|
||||
"build output/\(.name).pdf: pdfunite \(.ins)"
|
||||
)
|
||||
)
|
||||
|
|
|
@ -2,3 +2,7 @@
|
|||
|
||||
# The real configure script uses jq to parse cue output
|
||||
cue export -- *.cue *.yaml | jq -r -f configure.jq --args -- *.cue *.yaml
|
||||
|
||||
# TODO: generate line-by-line asset list with jq and process them to generate
|
||||
# build.ninja in builddir="$1". Regenerate any changed *.jsons at configure
|
||||
# time, hopefully ninja picks up those changes!
|
||||
|
|
|
@ -79,7 +79,9 @@
|
|||
\clearpage
|
||||
|
||||
\section{Overview}
|
||||
% Your background story/recap on what situation the players are getting themselves into. It sets the scene (thematically, usually) for the entire game.
|
||||
% Your background story/recap on what situation the players are getting
|
||||
% themselves into. It sets the scene (thematically, usually) for the entire
|
||||
% game.
|
||||
|
||||
Iditacards is a game where you race your opponents in the last great race on
|
||||
earth - The Iditarod. You will face starvation, hypothermia, and inclement
|
||||
|
@ -89,7 +91,10 @@ form to come out ahead.
|
|||
The first player to cross the finish line wins!
|
||||
|
||||
\section{Components}
|
||||
% This isn’t so important for playtesters at this point, but is important for the final rulebook and print and plays (PnP). This way players (including yourself) know whether or not there are missing pieces, or in the case of PnP players, if they have everything they need in order to play.
|
||||
% This isn’t so important for playtesters at this point, but is important for
|
||||
% the final rulebook and print and plays (PnP). This way players (including
|
||||
% yourself) know whether or not there are missing pieces, or in the case of PnP
|
||||
% players, if they have everything they need in order to play.
|
||||
|
||||
This game contains many cards. They can be sorted based on the symbol in the
|
||||
bottom right corner:
|
||||
|
@ -118,7 +123,10 @@ The game also contains:
|
|||
\clearpage
|
||||
|
||||
\section{Objective}
|
||||
% What the players are trying to accomplish. It should also make it clear how players are competing (free-for-all, teams, cooperative, etc.). This is the more technical/mechanical explanation of the 'Overview'. For example: “To be the last player with multiple spaceships orbiting the black hole”.
|
||||
% What the players are trying to accomplish. It should also make it clear how
|
||||
% players are competing (free-for-all, teams, cooperative, etc.). This is the
|
||||
% more technical/mechanical explanation of the 'Overview'. For example: “To be
|
||||
% the last player with multiple spaceships orbiting the black hole”.
|
||||
|
||||
Every turn each player will move forward one space. The cards they play will
|
||||
increase this, while the places they encounter will work to decrease it. When
|
||||
|
@ -126,7 +134,11 @@ the first player reaches the finish line the game ends. The finish line is the
|
|||
square \emph{after} the last square on the board.
|
||||
|
||||
\section{Setup}
|
||||
% How to get the game ready for play. There shouldn’t be anything in here that mentions what components are used for or why they are important--save that for the 'Gameplay' section. Just make sure that in this section everything is laid out clearly--if diagrams are necessary (they almost always are) don’t be afraid to put those in!
|
||||
% How to get the game ready for play. There shouldn’t be anything in here that
|
||||
% mentions what components are used for or why they are important--save that for
|
||||
% the 'Gameplay' section. Just make sure that in this section everything is laid
|
||||
% out clearly--if diagrams are necessary (they almost always are) don’t be
|
||||
% afraid to put those in!
|
||||
|
||||
To start the game each player must pick a colour. They take the token of that
|
||||
colour and place it in the ``Start'' space.
|
||||
|
@ -145,7 +157,9 @@ Before starting the game everybody draws 6 cards. The first player to grab the
|
|||
weather die goes first. They roll it, then take their turn.
|
||||
|
||||
\section{Gameplay}
|
||||
% The main gameplay section tells you how the game is broken up (rounds, turns, phases, etc.) and summarizes what players do in each of those stages. This section should explain the flow of the game from start to completion.
|
||||
% The main gameplay section tells you how the game is broken up (rounds, turns,
|
||||
% phases, etc.) and summarizes what players do in each of those stages. This
|
||||
% section should explain the flow of the game from start to completion.
|
||||
|
||||
The game is broken into turns. Each turn you may either play a card, or take
|
||||
a new day. At the end of your turn you automatically move a distance equal to
|
||||
|
@ -160,7 +174,11 @@ limit on hand size, however if there aren't enough cards in your deck to fill
|
|||
your hand, then your hand will consist only of however many cards are available
|
||||
to be drawn.
|
||||
|
||||
% Once that’s done, you go into the gameplay specifics, which should be explained in the order in which they occur in game. This is where you explain exactly what happens during each turn, action, round, etc. You also should have sections dedicated to complicated subjects and their edge cases (for instance, our section on Collisions for “Pulled into Darkness”).
|
||||
% Once that’s done, you go into the gameplay specifics, which should be
|
||||
% explained in the order in which they occur in game. This is where you explain
|
||||
% exactly what happens during each turn, action, round, etc. You also should
|
||||
% have sections dedicated to complicated subjects and their edge cases (for
|
||||
% instance, our section on Collisions for “Pulled into Darkness”).
|
||||
\subsection{Movement}
|
||||
|
||||
As in any race, movement is important. Whenever you move you add your current
|
||||
|
@ -185,7 +203,7 @@ If you pass the checkerboard finish line you win the game.
|
|||
|
||||
\subsection{Card Anatomy}
|
||||
|
||||
\includegraphics{instructions-anatomy.pdf}
|
||||
\includegraphics{output/instructions-anatomy.pdf}
|
||||
|
||||
In this example card, the energy cost is \emph{X} the health cost is \emph{Y}
|
||||
and the risk cost is \emph{Z}.
|
||||
|
|
4
legs.cue
4
legs.cue
|
@ -19,7 +19,7 @@ legs: [string]: #Leg
|
|||
|
||||
assets: {
|
||||
for legname, leg in legs {
|
||||
"\(legname)[1]": {
|
||||
"legs/\(legname)[1]": {
|
||||
size: "750x1050"
|
||||
print: "-set option:distort:viewport 825x1125-37-37 -virtual-pixel Edge -distort SRT 0 +repage"
|
||||
|
||||
|
@ -40,7 +40,7 @@ pseudoassets: {
|
|||
"\(deckname)": {
|
||||
kind: "cat"
|
||||
contents: [
|
||||
for legname, one in legs {"\(legname)[1]"},
|
||||
for legname, one in legs {"legs/\(legname)[1]"},
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
73
legs.yaml
73
legs.yaml
|
@ -1,6 +1,12 @@
|
|||
# The legs (TODO: export shorthands for each leg effect in iditacard.cls so that
|
||||
# the cue generation/gomplate instantiation can be simplified)
|
||||
#
|
||||
# TODO: consider returning to the old leg system, it allowed for more
|
||||
# flavour and less clutter, its main downside was that the game was too
|
||||
# "complicated" and that slowed it down, perhaps decrease the density of legs
|
||||
# while still using the old card-based system?
|
||||
legs:
|
||||
# First legs
|
||||
farm:
|
||||
name: 'Farm'
|
||||
level: firstleg
|
||||
|
@ -9,3 +15,70 @@ legs:
|
|||
3: hypo
|
||||
5: damage
|
||||
7: hypo
|
||||
|
||||
fishing_hole:
|
||||
name: 'Fishing Hole'
|
||||
level: firstleg
|
||||
effect: '\daydraw{3}'
|
||||
spaces:
|
||||
3: damage
|
||||
5: hypo
|
||||
7: damage
|
||||
|
||||
hospital:
|
||||
name: 'Hospital'
|
||||
level: firstleg
|
||||
effect: '\freecardtype{personal}'
|
||||
spaces:
|
||||
3: starve
|
||||
5: hypo
|
||||
7: starve
|
||||
|
||||
new_moon:
|
||||
name: 'New Moon'
|
||||
level: firstleg
|
||||
effect: '\freecardtype{dog}'
|
||||
spaces:
|
||||
3: hypo
|
||||
5: starve
|
||||
7: hypo
|
||||
|
||||
repair_shop:
|
||||
name: 'Repair Shop'
|
||||
level: firstleg
|
||||
effect: '\freecardtype{sled}'
|
||||
spaces:
|
||||
3: starve
|
||||
5: damage
|
||||
7: starve
|
||||
|
||||
volcano:
|
||||
name: 'Volcano'
|
||||
level: firstleg
|
||||
effect: '\allowednot{\includegraphics[width=1cm]{icons/hypo.png}}'
|
||||
spaces:
|
||||
3: damage
|
||||
5: starve
|
||||
7: damage
|
||||
|
||||
|
||||
# Second legs
|
||||
downhill:
|
||||
name: 'Downhill'
|
||||
level: secondleg
|
||||
effect: '\speed{3}'
|
||||
spaces:
|
||||
2: hypo
|
||||
4: damage
|
||||
6: damage
|
||||
8: hypo
|
||||
|
||||
junkyard:
|
||||
name: 'Junkyard'
|
||||
level: secondleg
|
||||
effect: '\healthcosts{-1}'
|
||||
spaces:
|
||||
2: damage
|
||||
4: hypo
|
||||
6: hypo
|
||||
8: damage
|
||||
|
|
45
rules.ninja
45
rules.ninja
|
@ -1,15 +1,26 @@
|
|||
# TeX compilation takes a lot of resources and can hang a system, only do about
|
||||
# 4 at a time
|
||||
pool tex_pool
|
||||
depth = 4
|
||||
|
||||
# uncomment restats when ninja stops segfaulting when you do so -.- (ninja; touch legs.yaml; ninja)
|
||||
|
||||
# TODO: clean up the output directory by messing with this and configure.jq
|
||||
# hide all json/tex/etc in hidden files?
|
||||
|
||||
rule template2tex
|
||||
description = convert $in to $out using $template as a template
|
||||
command = gomplate --left-delim '«' --right-delim '»' -c .=$in < $template > $out
|
||||
|
||||
rule cuegen
|
||||
description = run cue on $in to produce $out
|
||||
command = cue export $in > $out
|
||||
command = cue export $in | bash update.sh $out
|
||||
# restat = 1
|
||||
|
||||
rule extract
|
||||
description = extract $out from $in via jq filter $filter
|
||||
command = jq $filter < $in | bash update.sh $out
|
||||
restat = 1
|
||||
command = jq -c $filter < $in | bash update.sh $out
|
||||
# restat = 1
|
||||
|
||||
rule tex2pdf
|
||||
description = render tex from $in to $out
|
||||
|
@ -21,10 +32,28 @@ rule tex2pdf
|
|||
--output-directory=$$(dirname $out) $in >/dev/null $
|
||||
&& [ $$(basename -s .tex $in) = $$(basename -s .pdf $out) ] $
|
||||
|| mv $$(dirname $out)/$$(basename -s .tex $in).pdf $out
|
||||
pool = tex_pool
|
||||
|
||||
rule tex2pdf2x
|
||||
description = render tex from $in to $out twice (for toc)
|
||||
command = $
|
||||
xelatex $
|
||||
-interaction=batchmode $
|
||||
-halt-on-error $
|
||||
--shell-escape $
|
||||
--output-directory=$$(dirname $out) $in >/dev/null $
|
||||
&& xelatex $
|
||||
-interaction=batchmode $
|
||||
-halt-on-error $
|
||||
--shell-escape $
|
||||
--output-directory=$$(dirname $out) $in >/dev/null $
|
||||
&& { [ $$(basename -s .tex $in) = $$(basename -s .pdf $out) ] $
|
||||
|| mv $$(dirname $out)/$$(basename -s .tex $in).pdf $out; }
|
||||
pool = tex_pool
|
||||
|
||||
rule scantex
|
||||
description = scan tex $in for dependencies
|
||||
command = bash scantex.sh $in $out > $out
|
||||
command = bash scantex.sh $in $target > $out
|
||||
|
||||
rule pdf2png
|
||||
description = convert pdf $in to png $out with size $w by $h
|
||||
|
@ -37,3 +66,11 @@ rule convert
|
|||
rule copy
|
||||
description = copy $in to $out
|
||||
command = cp $in $out
|
||||
|
||||
rule pdfunite
|
||||
description = unite pdfs to create $out
|
||||
command = $
|
||||
pdfunite $in $out $
|
||||
&& pdfjam --nup 3x3 $out $
|
||||
--no-landscape --delta '0.5cm 0.5cm' --scale 0.9 $
|
||||
-o $$(dirname $out)/$$(basename -s .pdf $out)-mini.pdf >/dev/null 2>&1
|
||||
|
|
|
@ -10,10 +10,10 @@ temp="$(mktemp -p .)"
|
|||
trap 'rm -rf ${temp} ${temp}.*' EXIT INT
|
||||
|
||||
cp "$src" "$temp.tex"
|
||||
xelatex -recorder "$temp.tex" >/dev/null
|
||||
xelatex -recorder --shell-escape "$temp.tex" >/dev/null
|
||||
|
||||
deps="$(awk -v ORS=' ' -v "temp=$temp" -v "repl=${src%%.*}" '/INPUT \./ {gsub(temp,repl,$2); print $2}' < "$temp.fls")"
|
||||
outs="$(awk -v ORS=' ' -v "temp=${temp#*/}" -v "repl=${dst%%.*}" '/OUTPUT / {gsub(temp,repl,$2); print $2}' < "$temp.fls")"
|
||||
deps="$(awk -v "temp=$temp" -v "repl=${src%%.*}" '/INPUT \./ {gsub(temp,repl,$2); print $2}' < "$temp.fls" | sort | uniq | tr '\n' ' ')"
|
||||
outs="$(awk -v "temp=${temp#*/}" -v "repl=${dst%%.*}" '/OUTPUT / {gsub(temp,repl,$2); print $2}' < "$temp.fls" | sort | uniq | tr '\n' ' ')"
|
||||
|
||||
echo -n "build $tgt"
|
||||
[ -z "$outs" ] || echo -n " | $outs"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Counts the number of cards in the given deck.
|
||||
yq r -j cards.yaml | jq -r --arg deckname "$1" '.decks[] | select(.name | test($deckname; "i")) | .cards | length'
|
||||
yq r -j cards.yaml | jq -r --arg deckname "$1" '.decks[$deckname] | values | map(.count) | add'
|
||||
|
|
Loading…
Reference in a new issue