#card #format #load #read

bin+lib card_format

A tool for writing game cards in a human readable easy to edit format

2 unstable releases

0.2.1 Apr 18, 2022
0.1.0 Dec 3, 2021

#170 in Value formatting

46 downloads per month
Used in 3 crates

MIT license

34KB
916 lines

Card Format (.crd)

A tool for writing playing cards collectible card games.

This format exists to make describing cards for games simpler, though it could be used to describe other distinct items.

It is distinct from JSON in a few ways.

  • Comments
  • Parameters
  • Default Properties
  • Predefined Constants

First, because it is intended to be directly edited by humans, it allows for comments

#Anything after a '#' on a line is considered a comment

Second, it assumes cards will need many of the same properties and makes it easier to add them.

@param cost strength

#Archers cost and strength will be 3 and 4 respectively.
Archer 3 4:
.text: "Do something"

Third, by setting defaults, you can save writing.

@def
.health:3

#Dave will have a health of 3
Dave:
.size:4

#Alan will have health of 4
Alan:
.size:7
.health:4

Complicated properties can be predefined for reuse.


@const mine_provides : [[wood,4],[metal,3]]

Mine :
.provides:$r_provides

Format changes in 0.2.0

  • "var","param",and "def" were keywords which could have caused mistakes when writing if forgotten. This was awkward and I am much happier having them behind an '@' marker.

  • Due to other changes there is currently no way to extend another item by name. It was not a feature I used. You can however redefine the default '@def' at any time, and this will provide a prototype for others to copy.

Dependencies

~0.5–1MB
~25K SLoC