barneyb / magic-card-creator Goto Github PK
View Code? Open in Web Editor NEWA composition toolkit for creating custom Magic: The Gathering cards.
A composition toolkit for creating custom Magic: The Gathering cards.
Hybrid mana creates two extensions to card layouts:
At some point this may matter; but for now this is just here as a reminder to not paint ourselves into a corner.
Currently the tap SVG icon is just the old-style rotated "T", not the folded arrow shape. It'd be better to have that arrow shape as a path to put on the icon instead of the T, but I can't draw it.
The casting cost icons should be scaled to match the text height, rather than being independently proportional to the bounding box height.
For each of the five colors, plus gold, artifact, and land, the border color needs to be specified in RGB.
when reading special symbols out of a markdown descriptor, they end up wonky in the composed cards. Not sure where the problem is in the flow.
The paintbrush icon that indicates the card's artwork's artist needs to be vectorized so it can be applied to the card layouts. Deliverable is an SVG of that shape as a path (e.g, traced in Illustrator and exported or whatever).
http://mtgjson.com/ exposes JSON documents that describe all known cards, releases, and sets. It'd probably be clever to support that format as well as XML and Markdown.
Lands also draw the artist and footer in white text, like black cards, so that logic needs to be put somewhere.
The default line break handling will wrap at the slash in a "-1/-1" string, which is fine for normal text, but not for card text, since that type of string is an atom of Magic parlance.
Phyrexian mana creates the need for some new mana symbols, but that's it.
At some point this may matter; but for now this is just here as a reminder to not paint ourselves into a corner.
Land don't have casting costs, which will currently cause misinterpretation of the card title in markdown desctriptors. that needs to be fixed.
the black and gold creature print frame assets are the wrong size. i think they're still scan resolution, not scaled for the print size.
The card body text needs to be measured before rendering, and if it's too large, scaled back so it'll fit.
A box-level scaling operation would probably work, but reducing the font size and redrawing will give crisper resulting text, at the expense of fuzzier resulting symbols (because the symbols are pre-rasterized).
Goudy is pretty close to (if not exactly) the right font, but it measures wrong. Georgia is sorta close (and measures right) but is ugly. Need to figure out how to make that more gooder.
@switzerb says that a different version of Goudy (from Google?) might have better metrics and thus measure correctly.
If the card text doesn't use the whole card textbox area, it should be vertically centered w/in the box, instead of being up at the top edge.
For each of the five colors plus gold, artifact, and land, there is a single color (used for borders) and four textures:
This gives 24 different textures, though they needn't necessarily all be different. For two-color cards, gold uses a gradient fade between the two colors for the textbox, but for 3+ color cards it uses a generic gold texture. Similarly, color-aligned lands use color-based textbox textures, but non-color-aligned lands use a generic land texture.
The 25th texture is the starfield frame for semi-enchantment cards that is laid across the top of the card's normal frame to indicate they they are both enchantments and something else.
Every texture is made up of six components, only the first of which is required:
Each flood is a four-channel color (aRBG), allowing tinting of the actual raster without having to go crack it open in an image editor. The under flood can be used to tint the background behind the texture if the texture is only partially opaque.
The fill pattern is assembled by laying down the under flood, then the image with assigned opacity, then the over flood, and finally cropping based on the bounding box. This pattern is then tiled across whatever the texture is for.
The frame is 805x1155, the title bar is 80px tall, the type bar is 75px tall, the pt bar is 62px tall, and the textbox is 350x754.
Frames (including overlays) and textboxes have their first tile placed origin-aligned and then repeated down and right until the area is covered. Bars have their first tile placed center aligned (horizontally and vertically) and then repeated in all four directions until the area is covered.
To summarize, the deliverables are 8 RBG colors and 25 six-component textures.
Title, type, power/toughness, and artist should all be Matrix Bold
Body text and the footer line should be Garamond Regular (and Italic for flavor text).
Card frames are needed in a number of styles. The base set's naming follows this psuedo-EBNF:
name := base ( "_" type)? ".png"
base := color | "gold"
color := "white" | "blue" | "black" | "red" | "green"
type := "creature"
This describes 12 distinct frames (2 per color, 2 golds), encompasses the vast majority of existing cards. This is rich enough to describe the design of first 4-5 printed Magic editions.
Colorless cost icons need to be created for at least 0-9 and X mana, in both large (titlebar) and small (body) sizes.
To compare with current printed Magic editions, excepting hybrid and colored artifact cards, frames are needed in a lot of styles beyond what is described in #2. Naming follows the psuedo-EBNF:
name := base ( "_" type )? ( "_" dual )?{base must be "gold" or "land"} ".png"
base := color | "gold" | "artifact" | "land"
color := "white" | "blue" | "black" | "red" | "green"
type := "creature" | "enchantment_creature"
dual := color "_" color{must be later in list}
Some examples, from simplest to most complex:
white.png
a pure-white spellblue_creature.png
a pure-blue creaturegold_enchantment_creature_white_blue.png
white-blue enchantment creatureIllegal examples:
artifact_white_blue.png
base isn't gold or landgold_blue_white.png
dual is in the wrong orderTheoretically, there are 90 distinct frames (3 of each color, 3 artifacts, 33 golds and 33 lands), but most of them will remain unneeded/irrelevant for a long while (if not ever).
As noted above, this doesn't account for hybrid cards (which would require dual
to be added as an alternative in the base
rule) or colored artifact cards (which would require "artifact" to be added to the dual
gate in the base
rule). These are sufficiently esoteric uses that I think they can be ignored.
When body text contains newlines, they need to be considered split points as well as line wrap locations. Currently newlines are soaked up by the splitter, and don't make it to the composed card.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.