Recommend
5 
 Thumb up
 Hide
12 Posts

Piecepack» Forums » General

Subject: Piecepack library for Draw.io rss

Your Tags: Add tags
Popular Tags: [View All]
Anika Henke
msg tools
I was looking for something that would help me build piecepack diagrams. I couldn't find anything, so built my own library with the help of draw.io (and suits from game-icons.net).

I published the resulting shape library on GitHub today.

You can use it for free, even commercially, as it is published under the CC BY license.

The easiest way to use it is by simply clicking this link which will open draw.io and install the libary.

I haven't used it for anything useful yet, but plan to use it properly soon. Please let me know if it could be improved in any way.

This is an example of how a diagram built with it looks like:



The design is quite similar to the piecepack I'm currently building on The Game Crafter. But I have intentionally simplified some things and used brighter colours.
4 
 Thumb up
0.02
 tip
 Hide
  • [+] Dice rolls
Anika Henke
msg tools
selfthinker wrote:
I couldn't find anything

That's not quite true. I did find the seemingly excellent piecepackr. But it seems a bit too complex for this purpose. (I say "seemingly excellent" because I only saw its output, which is excellent, but haven't used it myself, so cannot fully judge it.)
2 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Ron Hale-Evans
United States
Kent
Washington
flag msg tools
designer
Avatar
mbmbmbmbmb
piecepackr is excellent but is still alpha software right now. Trevor is rewriting the API and clobbering some of the earlier features. It won't be ready for public use for a little while.
1 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Michael Van Biesbrouck
Canada
St Catharines
Ontario
flag msg tools
designer
badge
Avatar
mbmbmbmbmb
I haven't used it, but the VASSAL piecepack implementation should be a convenient way to set up diagrams:

http://www.vassalengine.org/wiki/Module:Piecepack

Documentation: http://ludism.org/ppwiki/VassalModule

Thread with a couple other computer piecepack implementations mentioned: Are the IBG graphics public domain?
2 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Trevor Davis
msg tools
The diagram looks nice! Am I right that you cannot use the library programmatically and instead one has to manually make all your diagrams (and steps in an animation!) in a browser website GUI and that it is somewhat hard to customize the appearance of the piecepack? If not you should include some code examples in your README.

selfthinker wrote:
That's not quite true. I did find the seemingly excellent piecepackr. But it seems a bit too complex for this purpose.

A little bit of complexity makes it possible to make configurable rule sets/books whose appearance varies based on the appearance and contents of one's piecepack (i.e. substitute in a different set-up and text if one has two piecepacks or saucers/pyramids/matchsticks/etc.). Below is some minimal R code to imitate the above example diagram with piecepackr. I could have imitated your piecepack's look even more closely if I took more care in my piecepack "style" configuration but I was feeling lazy.


library("piecepackr")

# piecepack "style"
# use ``cfg <- pp_cfg()`` if using piecepackr's default piecepack style
# or one can load in the configuration someone else has done
cfg <- pp_cfg(list(suit_text="\u2600,\U0001f318,\U0001f451,\u269c,",
suit_fontfamily="Noto Sans Symbols,Noto Sans Symbols,Noto Sans Emoji,Noto Sans Symbols,",
suit_scale="1,1,0.8,1.1,",
ps_r.die_face=0.2, ps_theta.die_face=-45, ps_scale.die_face=1.5,
dm_text.pawn_face="",
suit_color="darkred,black,darkgreen,darkblue,black",
rank_text=",A,2,3,4,5",
border_color="black",
invert_colors.suited=TRUE))

# piecepack diagram "content"
g.p <- function(...) { grid.piece(..., cfg=cfg, default.units="in") }
png("anika_example_diagram.png", width=7, height=5, units="in", res=72)
g.p("tile_back", x=c(3,5,1,3)+0.5, y=c(3,3,1,1)+0.5)
g.p("tile_face", x=c(1,5)+0.5, y=c(3,1)+0.5, suit=c(2,4), rank=c(1,6))
g.p("coin_back", x=c(3,4), y=c(2,4), suit=c(1,3))
g.p("coin_face", x=4, y=c(1,3), rank=c(4,2))
g.p("pawn_face", x=c(2,5), y=c(2,3), suit=c(4,1))
g.p("die_face", x=c(2,5), y=c(1,4), suit=c(2,3), rank=c(3,5))
dev.off()




I have more piecepackr demo examples at piecepackr's companion website: https://trevorldavis.com/piecepackr/category/demos.html . There is also code for game diagrams and the corresponding "Rtex" file to generate pdfs of the rule sets/crib sheets for 14 piecepack games at the spin-off R package ppgames: https://github.com/trevorld/ppgames .

rwhe wrote:
piecepackr is excellent but is still alpha software right now. Trevor is rewriting the API and clobbering some of the earlier features. It won't be ready for public use for a little while.

I think in the past couple of months (with more free time after successfully finishing my PhD) I've made most of the big non-reversible changes to piecepackr. I'm hoping to release a public beta in July. If you aren't saving/re-loading the "pp_cfg" objects then there might not be any future non-reversible changes to "bite" you within "piecepackr" proper. The spin-off "ppgames" package will remain more "experimental" for now (i.e. still need to figure out how I want to implement a "piecepackr animated game notation" to visualize play-by-mail piecepack games and continue working on the configurable piecepack rule sets and rule books I've been prototyping).
1 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Trevor Davis
msg tools
selfthinker wrote:
Please let me know if it could be improved in any way.

1. I noticed in your pre-made 3x2, 3x3, 4x4, 5x5 (minus middle) tiled boards there is a noticeable gap between tiles. I personally think those pre-made boards would look nicer if you eliminated that gap (maybe thicken the tile back "grid" lines if you want to cleanly distinguish "grid" from "border" lines. Also, I'm curious what games use a 6x4 (or 7x5) board (i.e. 3x2 tiles) such that you pre-made that setting? I'm aware of 4x4 games like 4-Field Kono but I'm blanking on 6x4 games.

2. Don't know if there was a change of plans but in March in the Facebook group there was a cryptic hint that the next piecepack game design competition may involve piecepack matchsticks. So you may want to add some matchsticks although if needed it seems a draw.io user could use the ``save_piece_images`` command from piecepackr to create individual images of each of the matchsticks and then manually import them into draw.io (assuming they didn't want to directly programmatically make piecepack game diagrams with matchsticks in piecepackr or import them into a program like Gimp/Inkscape/etc.).
 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Jessica Eccles
New Zealand
flag msg tools
designer
badge
Alarm! Alarm!
Avatar
mbmbmbmbmb
I think Galaxy Express is 6x4.
1 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Anika Henke
msg tools
mlvanbie wrote:
the VASSAL piecepack implementation should be a convenient way to set up diagrams

From what I read about that app, it sounds like it let's you play piecepack games. Is that not true? I don't think this would let you build diagrams. But I haven't tried it either, so not sure. I guess you could take a screenshot of a game in play, but that's not the same.


trevorld wrote:
I noticed in your pre-made 3x2, 3x3, 4x4, 5x5 (minus middle) tiled boards there is a noticeable gap between tiles. I personally think those pre-made boards would look nicer if you eliminated that gap (maybe thicken the tile back "grid" lines if you want to cleanly distinguish "grid" from "border" lines.

That's the way I had it at first (and when my example was made, I only notice now that it's not from the latest version) and I didn't like it. I see piecepackr produces tiles right next to each other as well. I find that it always confuses me where a tile starts and where it ends.


trevorld wrote:
I'm curious what games use a 6x4 (or 7x5) board (i.e. 3x2 tiles) [...]?

The ones I'm aware of are: Relativity, Mathrix, Galaxy Express (as mentioned by Jessica) and Crocodile Hop.
Granted, not very common. It's difficult to know which type of boards would be most useful to people.


trevorld wrote:
you may want to add some matchsticks

I think I would like to keep the basic set for the basic stuff. But I thought it would be a good idea to create a separate library for all the extensions, including pyramids, saucers, etc. That would then also include the matchsticks.
1 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Anika Henke
msg tools
trevorld wrote:

Am I right that you cannot use the library programmatically and instead one has to manually make all your diagrams (and steps in an animation!) in a browser website GUI and that it is somewhat hard to customize the appearance of the piecepack?
[...]
A little bit of complexity makes it possible to make configurable rule sets/books whose appearance varies based on the appearance and contents of one's piecepack

Yes, the library is for creating diagrams manually. I think draw.io has an API and you could automate some things, but I haven't yet looked into that and doubt it's very extensive.
But draw.io can export to SVG and that can be easily manipulated with JavaScript, so customisation is still possible that way.

I am currently working on another piecepack project (which I'm not quite ready to share yet, probably in a week or two). For that project I've been looking into how to make piecepack diagrams in the easiest and most flexible way...

I created the graphics for my printed piecepack with HTML & CSS. That sounds very unintuitive but it was the easiest for me. (I'm a web developer.) As part of that I had also made lots of things configurable the same way you did with piecepackr. With a click of a button I can change the whole set from dark to light or from piecepack to French suits. (Because I was experimenting a lot with various designs, I have some more configurable things.)
So, having an online version that let's people choose their own version (yellow instead of green crowns, anchors instead of arms, different suits, etc) is something I also wanted to do and which is theoretically quite easy.

The problem is not the output, the problem is the input.

How can people create all the different diagrams easily?
Ideally there should be some kind of piecepack notation, similar to any of the notation systems for chess. If we had a handful of pre-defined boards, that would be doable. But because the boards can be pretty much any configuration, with probably hundreds of variations, I very quickly gave up on that idea.
So, the only option I can see is to let people create the output manually.

If I understand your R notation correctly, you first define a grid and then you define where the single pieces go in that grid via x/y coordinates. That can work well enough, but only if you got square grids. Although I'm sure you can theoretically create an example for the San Andreas grid or Hanging Gardens, it just very quickly gets very unintuitive and difficult to do.

I would be very happy to be proven wrong, though.
Should I create a new thread for a potential piecepack notation? It would be good to read other people's thoughts on that.
2 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Trevor Davis
msg tools
selfthinker wrote:
From what I read about that app, it sounds like it let's you play piecepack games. Is that not true? I don't think this would let you build diagrams.

VASSAL let's you export images from a game in progress which can be used as diagrams in a ruleset (sort of how one can also physically take a picture of a game setup on a real board). Ditto for all the other "tabletop games simulators" which support the piecepack like "Tabletop Simulator".

selfthinker wrote:

If I understand your R notation correctly, you first define a grid and then you define where the single pieces go in that grid via x/y coordinates. That can work well enough, but only if you got square grids. Although I'm sure you can theoretically create an example for the San Andreas grid or Hanging Gardens, it just very quickly gets very unintuitive and difficult to do.

Yes, I think using a grid is the easiest, most intuitive way to programmatically make diagrams especially once you have written the functions to pre-make certain boards. For example besides having function for creating the starting boards of several piecepack games ppgames also has a function to make arbitrarily sized rectangular boards (limited by a user specified maximum number of tiles) so while it would normally make a 8x8 board using the cells from 16 tiles it could also do the alternative of making an 8x8 board using the points from 9 tiles with "Xiangqi-style rivers" - one can then use it to make trickier boards by repeatedly placing sub-boards in different places - I used this for my Cribbage board diagram (2 3x30 boards) and an Alice Chess diagram (2 8x8 boards re-using the code for the placement of the chess pieces from a FIDE Chess diagram). Also, since R is an "interactive" language you can quickly iterate and build a diagram in steps "live" - one certainly doesn't need to plan it all out in their head or a piece of paper ahead of time (for example I'm not that smart enough to do that).

selfthinker wrote:

How can people create all the different diagrams easily?
Ideally there should be some kind of piecepack notation, similar to any of the notation systems for chess. If we had a handful of pre-defined boards, that would be doable. But because the boards can be pretty much any configuration, with probably hundreds of variations, I very quickly gave up on that idea.
So, the only option I can see is to let people create the output manually.

I would be very happy to be proven wrong, though.
Should I create a new thread for a potential piecepack notation? It would be good to read other people's thoughts on that.

I have an unpublished draft of some ideas for a piecepack game notation system adapting notation from games like FIDE chess (PGN), Tak, and Shogi for easily representing piecepack games that can be played on a pre-defined rectangular grid (the vast majority of them) that one will be able to in the future use to make game diagrams and animations using piecepackr. Right now my priority for my limited free time is finalizing the public beta for piecepackr as well iterating on my customizable piecepack ruleset and rulebook prototypes but I'll make a post in a few months when I have a prototype working for a toy example like Tic-Tac-Toe. However assuming you don't want to tediously place all the initial pieces on a "blank" table using a "drop" notation for which piece to place (and how) then you would want to you tell piecepackr (or whatever program written to support that notation) to use a pre-written function that sets up the starting board and initial piece set-up (as mentioned besides arbitrary rectangular boards I already have such a function written for 14 piecepack games and the list is growing). For games with random starting boards (like Alien City) you'd want that starting board function to accept a 'seed' for a pseudo-random number generator so one can quickly generate different "random" boards. Then you once you have set up the board either using the "drop" notation or a pre-defined function one could move pieces around in a more intuitive manner using a chess/Tak-style algebraic notation with the addition of other "sugar" for piecepack game actions like flipping/rotating a piece or placing a piece in over/under/between other pieces although ignoring such notation "sugar" at a bare minimum all you really need is the notation to "drop" an arbitrary piece onto the board ("configuration", "piece", "suit", "rank") at an arbitrary location ("x", "y", "angle", "side", plus some notion of "z" within an existing stack of pieces) and the notation to "pluck/remove" any arbitrary piece from the board. Then all other moves for a diagram/animation can (verbosely) be expressed as a combination of "drops" and "plucks".

I'm not optimistic though that there is a game notation system for easily representing such piecepack dexterity games like Piecepack Soccer - I think you'll need to hustle using a grid-based system, manually drag things around in a GUI, take a photo of a real life game, or take a screenshot from a game played in "Tabletop Simulator". Other games like a piecepack implementation of Hive where the pieces can move arbitrary distances around a board may also kind of tricky (but maybe not too tricky since one could theoretically move and re-center the frame of reference).
1 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Trevor Davis
msg tools
selfthinker wrote:
Although I'm sure you can theoretically create an example for the San Andreas grid

Although you can certainly straightforwardly and verbosely draw each "tile back" one at a time the functions in piecepackr are "vectorized" so one can also create complicated diagrams like the starting layout in the piecepack game San Andreas concisely and quickly (even factoring in some time to interactively "tinker" around).


png("san_andreas.png", width=11, height=17, units="in", res=72)
x <- 0.5+c(rep(c(1,3,5), 3), 2,4,6, 3,5,7, 4,6,8, 5,7,9, 7,9)
y <- 0.5+c(rep(c(15,13,11,9,7,5,3), each=3), 1, 1)
grid.piece("tile_back", x=x, y=y, default.units="in", cfg=cfg)
dev.off()


2 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Anika Henke
msg tools
selfthinker wrote:
I am currently working on another piecepack project (which I'm not quite ready to share yet, probably in a week or two). For that project I've been looking into how to make piecepack diagrams in the easiest and most flexible way...

That project is piecepack.net as announced in New piecepack website

If there ever is an easy-to-use piecepack syntax, I'd be happy to swap the static images over to dynamically rendered diagrams. Users can then choose whichever type of piecepack they have and the diagrams would be adjusted accordingly. I'd also be happy to use piecepackr's API, but only if we have some kind of syntax inbetween.
 
 Thumb up
 tip
 Hide
  • [+] Dice rolls