render_piece() renders an image of game pieces to a file or graphics device. It is a wrapper around
pmap_piece() that can auto-size files and graphic devices, apply axes offsets, annotate coordinates, and set up
rayrender scenes (#245).
aes_piece()helps create an appropriate matching
geom_piece()requires a fixed scale coordinate system with an aspect ratio of 1 as provided by
geom_piece()also requires that
cfgis a character vector (and not a
pp_cfg()object). In particular if using
op_transform()one should set its argument
cfg_class = "character"if intending for use with
aabb_piece() which calculates axis-aligned bounding box (AABB) for set of game pieces with and without an “oblique projection”.
has_font() which returns
FALSE if it detects a given font is provided by the OS. Needs either 1) Suggested package systemfonts or 2) R compiled with “cairo” support plus system tool
grid.piece() now support a new
type argument which modifies which type of grid grob is used.
Can be either
"picture" exports to (temporary) svg and re-imports as a
"raster" exports to (temporary) png and re-imports as a
grid::rasterGrob. The latter two can be useful if drawing pieces really big or small and don’t want to mess with re-configuring fontsizes and linewidths.
Now defaults for the following
piecepackr function arguments may now be set globally via
piecepackr.cfgSets a new default for the
piecepackr.default.unitsSets a new default for the
piecepackr.envirSets a new default for the
piecepackr.op_angleSets a new default for the
piecepackr.op_scaleSets a new default for the
piecepackr.transSets a new default for the
piece3d()method will import Wavefront OBJ files with
rgl::readOBJ(). In particular
readobj::read.obj()can successfully triangulate the “meeple” shape and the “roundrect” shape (#220).
alphatransparency parameter in
game_systems()now provides a
style = "dejavu"and
filename_fnargument does not support a
rglpackage requirement to
0.106.8in order to avoid a bug introduced by
The following changes in
pp_cfg() configuration lists seem unlikely to affect any users (but theoretically could do so):
pp_cfg()to a character vector that does not include “card_back”.
n_ranks + 1Lwhen drawn (instead of
0) and for a “piece_side” that is assumed to have a rank we impose an assumption that the rank will not exceed
n_ranks + 2L(replacing with
n_ranks + 2Lif more than that). This now mirrors the pre-existing behaviour with suits. For example if
n_ranksis set to 6 then the style
background_color.r7 = "blue"will set the background color for pieces that lack a rank to “blue”.
pawn argument now supports a “joystick” value (#183). This allows one to draw a “joystick” style
"pawn_top" in grid, rgl, and rayrender with the “piecepack” game system configurations.
"pawn_face") are not supported in
pieceGrob()but are supported in
as_top = "pawn_face"in
lacks_rank: a character vector of “piece_side”’s that we should assume do not vary by rank. By default these are the piecepack components that do not vary by rank plus “card_back”.
lacks_suit: a character vector of “piece_side”’s that we should assume do not vary by suit. By default these are the piecepack components that do not vary by suit plus “card_back”.
cachempackage cache API. In particular one could choose replace it with
cachem::cache_mem()to cap the amount of memory that can used by the cache. Note our cache uses keys that include hyphens and underscores which older versions of the
cachempackage did not support.
pp_cfg()has a random prefix so (with a high probability) multiple objects could theoretically share the same cache.
reset()method which clears it.
The appearance of piecepack pyramids returned by
game_systems() now more closely resemble the original piecepack pyramids.
AA_to_R() is now more robust to minor numerical errors in
Fixed bug in
op_transform() when calculating “z”-coordinate when a piece overlaps with multiple pieces and the “latest” one isn’t actually the “highest” one.
pp_cfg()’s R6 class’s fields are now active bindings.
Fixed bug when setting custom
pp_cfg() configuration list “rgl_fn” values.
pp_cfg() R6 class active bindings are now deprecated:
cache_shadow. Use the new
i_unsuit. Add one to the
No user-facing changes (we tweak our examples/tests so R CMD check passes without issue on CRAN’s new ‘M1mac’ build).
game_systems() now returns the following new configurations:
New alternative Wavefront OBJ file generating functions intended to be used with the
obj_fn attribute in
pp_cfg() “configuration lists”:
save_ellipsoid_obj()creates an ellipsoid piece colored with that piece’s
background_color. Currently used for the go “stones” in
game_systems()“go” configuration. Could also be used for colored “marble / ball” pieces (#176).
save_peg_doll_obj()creates a “peg doll” piece colored with that piece’s
edge_colorand with a “pawn belt” around its “waist” controlled by that suit and rank’s
game_systems() now accepts new argument
TRUE then the (retangular) tiles and cards will have a “roundrect” shape instead of a “rect” shape (the default) (#226). NB.
piece3d (rgl bindings) currently cannot import the “roundrect” shape.
game_systems() now accepts new argument
"token" (the default) piecepack pawns are a two-sided token with a “halma” shape. If
"peg-doll" then piecepack pawns will be a “peg doll” with a “pawn belt” (#184). NB.
grid.piece (grid bindings) currently cannot draw the “peg-doll” style pawn.
game_systems()now have simple graphics using this packages built-in meeple shape (#193).
game_systems()now supports a 15th “Joker” “rank” for the first four “suits”. This means all the Playing cards in Unicode now has a corresponding card in the “playing_cards_tarot” configuration (suggested Joker mapping is “White” = suit 1, “Black” = suit 2, and “Red” = suit 4)
pmap_piece()now simply returns
list()if its output has zero observations.
file2grob()fixes a bug when importing images using the
magickpackage (currently any image that is not PNG, JPEG, or SVG).
save_piece_obj(): if multiple graphics devices are open it should no longer accidentally switch the “active” device (#239).
save_print_and_play()now does six copies of the “matchstick_face” component for six ranks and four suits. It used to do four copies of the “matchstick_face” and “matchstick_back” component for six ranks and five suits but a “standard” set of matchsticks is six copies. If there is sufficient space it will also add some additional (piecepack) dice (#194).
There are no user-facing breaking changes in
piecepackr’s API but the internal
grid structure of the grobs drawn/returned by
pmap_piece() have been changed to make it easier to query or edit the grid graphics post initial drawing with functions like
grid::grid.reorder() etc. (#205).
pieceGrob()now has a “piece” class and “named slots” which match the arguments of
grid::grid.force()to view/edit its internal grob “children”.
grobPoints()methods have been written for the “grob” returned by
grid.piece() / pieceGrob()and the “grob” returned by
pmap_piece()will now generate/replace a unique
piece.with a unique
idif it exists or if it does not then by row number in order to better label the “children” of the returned
gTreegrob object (#223).
The following utility functions have been deprecated in favor of methods provided by the new
checkersGrob(c, s, t, n), use
pp_shape(s, t)$checkers(n, gp=gpar(fill=c))instead.
concaveGrobFn(n, t, r), use
pp_shape(paste0("concave", n), t, r)$shapeinstead.
convexGrobFn(n, t), use
pp_shape(paste0("convex", n), t)$shapeinstead.
get_shape_grob_fn(s, t, r, b), use
pp_shape(s, t, r, b)$shapeinstead.
gridlinesGrob(c, s, t, l, n), use
pp_shape(s, t)$gridlines(n, gp=gpar(col=c, lex=l))instead.
hexlinesGrob(c, s, n), use
matGrob(c, s, t, mw, n), use
pp_shape(s, t)$mat(mw, n, gp=gpar(fill=c))instead.
shape()returns a grob of the shape.
mat()returns a grob of a matting “mat” within the shape.
mat_widthcontrols how “wide” the matting should be.
gridlines()returns a grob of “gridlines” within the shape.
checkers()returns a grob of “checkers” within the shape.
hexlines()returns a grob of “hexlines” within the shape.
polyclip()returns a grob that is an “intersection”, “minus”, “union”, or “xor” of another grob. Note unlike
gridGeometry::polyclipGrobit can directly work with a
pieceGrob“clip grob” argument.
Default functions used by
piece() now support a “top”, “base”, “left”, and “right” side for the two-sided token components: “bit”, “board”, “card”, “matchstick”, “pawn”, “saucer”, and “tile” (#135).
pp_cfg()now supports a “roundrect” (rounded rectangle)
pp_cfg()now supports a “meeple” shape (#104). Meeple coordinates were extracted from Meeple icon by Delapouite / CC BY 3.0.
pp_cfg()now supports setting multiple styles by using a greater-than-length-one vectors (as well as continuing to support previously-supported comma-separated strings).
R_to_AA()now always returns an axis-angle parameterization with positive
R_to_AA()for some 3D rotations with an “exactly” 180 degree angle (in the axis-angle representation).
AA_to_R()now accepts an optional
axis_zargument and automatically normalizes the axis vector. In particular
R_to_AA(AA_to_R(...))can now be used to normalize alternative axis-angle parameterizations with non-unit axis vectors and/or negative
is_color_invisible()will now correctly classify as “invisible” colors with an alpha channel value set to 0.
pp_cfg()$get_piece_opt()now also contains a
backvalue indicating whether this is a back of a piece (and hence for some shapes may need to be flipped across a vertical line) and a
bleed_colorvalue indicating a good color for a “bleed” effect (e.g. for print-and-play layouts) (#211).
op_transform()for pieces whose “shape” is a non-symmetric (across vertical axis) polygon.
pmap_piece()now returns the grob invisibly if
draw=TRUEas documented (while continuing to draw the grob to the active graphics device).
piece3d()will now try to infer a reasonable
textypevalue by manually checking the png texture’s alpha channel.
piece()now have support for 3D rotations of pieces (#188) using an axis-angle representation parameterized by arguments
R_to_AA()convert back and forth between the axis-angle representation used by
piecepackrand 3D rotation matrices (post-multiplied).
R_z()create simple 3D rotation matrices (post-multiplied) for rotations around the x, y, and z axes.
to_radians()convert back and forth between degrees and radians.
pp_cfg()now supports new
rgl_fnstyles allowing further piece customization within the 3D graphics functions
piece3d()now supports user manually setting the piece’s
textypeargument. When textures with alpha transparency are not needed then setting
"rgb"avoids a rglWebGL rendering bug (#187).
get_shape_grob_fn()now has a
backargument to indicate we are drawing the back of the shape and should reflect it across a vertical axis (#218).
game_systems()now returns more game systems:
dice: Normal six-sided pipped dice in six color schemes (#166).
checkers2: Checkered boards and checkers.
checkers1has 1" cells and
checkers2has 2" cells (#168).
dominoes_yellow: Traditional Double-12 pipped dominoes in various color schemes (#159).
playing cardsis a traditional (French-suited) deck of (Poker) playing cards.
playing_cards_coloredhas five suits: red hearts, black spades, green clubs, blue diamonds, and yellow stars.
playing_cards_tarotis a (French Bourgeois) tarot deck with four suits (hearts, spades, clubs, diamonds) with 14 ranks (including knights) plus 22 trump cards (1-21 plus an “excuse”).
save_piece_obj()for writing Waveform OBJ files (and associated MTL files and png textures) (#189, #190). Note support for dice and pawns are currently rather crude.
piece3d()for making graphics with the
op_transform()when sorting tile faces rotated in various directions (#163).
op_transform()now accepts new argument
pt_thicknessfor improved handling of stacked pyramid (tops).
edge_colorfor dice, pawns, and pyramids now defaults to the background color of
edge_colorfor matchsticks now defaults to the background color of the
game_systems()made more “standard”.
pmap_piece()now supports an
.ffunction to specify the function to apply to the rows of the data frame. By default it uses the (backwards-compatible)
pp_cfg()$get_depth()now has better depth calculation for pyramid faces (representing laid down pyramids).
pp_cfg()now supports a new
op_grob_fnstyle indicating which function to draw pieces with when drawing with a 3D oblique projection in
grid. The older
shadow_fnstyle alternative is now deprecated.
pieceGrob()) now support a
pp_cfg() R6 class public method is now deprecated:
get_grob(piece_type, suit, rank, type="picture")instead.
pp_cfg “style” is now deprecated:
shadow_fn. Use the new
dual_piecepacks_expansion: A companion piecepack with a special suit scheme. See https://trevorldavis.com/piecepackr/dual-piecepacks-pnp.html.
hexpack: A hexagonal extrapolation of the piecepack designed by Nathan Morse and Daniel Wilcox. See https://boardgamegeek.com/boardgameexpansion/35424/hexpack.
piecepack: A public domain game system invented by James “Kyle” Droscha. See http://www.ludism.org/ppwiki. Configuration also contains the following piecepack accessories:
piecepack matchsticks: A public domain accessory developed by Dan Burkey. See http://www.ludism.org/ppwiki/PiecepackMatchsticks.
piecepack pyramids: A public domain accessory developed by Tim Schutz. See http://www.ludism.org/ppwiki/PiecepackPyramids.
piecepack saucers: A public domain accessory developed by Karol M. Boyle at Mesomorph Games. See https://web.archive.org/web/20190719155827/http://www.piecepack.org/Accessories.html
playing_cards_expansion: A piecepack with the standard “French” playing card suits. See http://www.ludism.org/ppwiki/PlayingCardsExpansion.
subpack: A “mini” piecepack. Designed to be used with the
piecepack to make piecepack “stackpack” diagrams. See http://www.ludism.org/ppwiki/StackPack.
file2grob() that imports a given image file as a grob.
op_transform()for whether two pieces overlap are now more accurate (#150).
op_transform()when computing bounding box for shapes when width and height are not equal.
op_transform()for inferring width/height of matchsticks and shape/depth of pyramids.
pp_cfgobjects when a custom grob function had been set.
get_suit_color()function is now vectorized (and by default now returns the suit colors for each suit).
save_print_and_play()function now supports adding piecepack pyramids (#37), matchsticks (#69), and subpacks (aka “travel” piecepacks) (#129) to the print-and-play layout.
pp_cfg()function (and R6 class) which on-the-fly builds a cache to speed up component drawing (#112, #122). Can also signal to rule diagram functions whether the piecepack lacks certain components (#130).
help("grid.piece")for more info.
component_optcolor names are now
_colto better match “configuration lists”.
draw_componenthas been renamed
grid.piece()(and many of its arguments vectorized) and
draw_componentshas been renamed
make_imageshas been renamed
make_pnphas been renamed
i_shave been renamed
make_pnpprint-and-play layouts have been radically re-configured and renamed to
chipcomponent no longer supported by piecepackr (#114)
make_pnpnow gets deck title from the configuration element
mat(as in picture frame ‘matting’) (#117)
draw_previewfunction has been removed. Can now do
save_print_and_play()function now supports the A5 page size and is more A4 page size friendly (#54).
fontface(#121) as well as
depth(#106) in configuration lists.
grid.piece()no longer draws different output for components like
tile_backif you specify a suit or rank (#120).
ghostscriptinstalled will automatically embed metadata in the print-and-play pdf (#93).
gridline_lexto allow customizing the width of the border and grid lines.
formatargument is now vectorized.
save_print_and_play()can now save a print-and-play “svg” and “ps” file (besides “pdf”).
grid.piece()no longer throws a warning when
pyramid_layoutcomponents (progress on #37).
matchstick_backcomponents (progress on #69)
, andsuitrankdie_layoutRF`` components (#101)
draw_components() function allows one to draw several piecepack components specified in a data frame (#96).
load_configurations() function allows one to load in several JSON configuration files and/or internal piecepackr configurations in a layered (cascading) manner (#81).
Made several non-reverse-compatible API changes to configuration and piecepack image making functions and scripts.
Increased the width of a pawn belt from 1.5" to 2" (so can fit around a 5/8" diameter pawn).
Changed the “light”-french-suited symbols in the “dual” demo from “black” symbols to “white” symbols. Thanks Ron-Hale Evans for the suggestion.
Changed default color scheme
make_piecepack_images executable (#48). Renamed other executables and functions in API.
Shrunk the pawn down to ½" by ⅞" and made them directional by default (#50).
Document exported functions in Rd pages.
Option to configure piecepack dice arrangement (#13)
Expanded Rainbow Deck demo (#64).
Fixed bugs in “orthodox” pawns (#62).
--border_color configuration option and fix bug in PnP border colors (#42).
Added (or improved)
--background_color option to
--background_colors which can now vary by suit (#52)
Add new and rename existing pdf metadata options in
Improved “preview” layout.
Added additional suit die to accessories pages.
Fix bug in the “suit-rank” die for 5-suited piecepacks (#41).
Added Crown and Anchor suited piecepacks demo (#46).
Added Rainbow Deck suited piecepack demo (#47).
Added Reversi-friendly piecepack demo (#21).
Added Chess-ranked piecepack demo (#24).
Added Hex-friendly piecepack demo.
Fix bugs in “orthodox” demo (#43).
Tweaked configuration in “dual” demo so first two decks are more compatible with other decks.
Tweaked fonts in all demos.
Added Simplified Hanzi decks to Chinese zodiac demo.
Tweaked “chip” shape in orthodox and Chineze zodiac demos.
Tweaked background colors in 3rd hex demo.
Tweaked background colors in 3rd crown-and-anchor demo.