Hacker Newsnew | past | comments | ask | show | jobs | submit | CarlsJrMints's commentslogin

There are a good number of tools for creating custom MTG cards, a few of them open source. But so far there haven't been any self-contained, composable packages. There are 3 main modules to the package, a parser with associated relevant interfaces, the rendering engine itself, and a React component for displaying rendered cards.

For the parser I was inspired by the lightweight text format that scryfall uses, like[1]

  Llanowar Elves {G}
  Creature — Elf Druid
  {T}: Add {G}.
  1/1
Crucible's text format [2] is a superset that allows specifying "non-functional" parts of the card, like flavortext, rarity, art, etc. The text format gets parsed into a structured CardData interface. One challenge was accomodating different structured abilites for different card types, like Planeswalkers, Sagas, etc. which I solved using TypeScript discriminated unions. This gives a fair amount of flexibility for consumers since if you are building a UI, you can use the structured ability interfaces, or you can use the raw string interface for abilities.

The rendering engine uses the Canvas API to compose the various visual elements. Implementing the rendering engine made me a lot more aware of card formatting details. For example hybrid frames vs. gold frames, accent colors, legend crowns, snow & nyx borders, information in the footer. There are a number of styling rule edge cases that had to be solved (a 2-color artifact uses those 2 colors in the accent, but gold for the type, name, and power/toughness boxes. But if the 2-colors are from hybrid mana, the accent is the same, but the name line uses the standard artifact color for the boxes).

This package also solves the problem of reinventing the wheel when displaying cards in a browser. It provides a React component which provides invisible text to make the cards ctrl+f-able, a context menu for copying the image or text of the card, and rotations for dual-faced cards.

This project had a lot of scope creep. MTG cards come in a variety of layouts, but it is heavily skewed towards "normal" (covering about 99% of cards) [3]. I had an MVP for rendering standard (or normal) framed cards in about a day. But I figured I should support all the primary card types, so I implemented support for Planeswalkers and Battles (about .1% and .01% respectively). Since Battles are dual-faced, I figured I might as well support transform cards and modal dual-faced. Then the Prepare mechanic came out in Secrets of Strixhaven so I should support that as well. In then end I supported just about every card layout, including split, flip, omen, adventure, aftermath, prototype, leveler. This greatly complicated the parser, rendering engine, and react component, but I am happy with how comprehensive the package is.

I've used this package for three projects so far (not including the playground page https://domainellipticlanguage.com/project/mtg-crucible-play...):

thismagiccarddoesnotexist.com [4] - a site for generating cards with AI

obsidian-custom-mtg [5] - an Obsidian plugin for making custom cards in markdown using a variant of the Scryfall spoiler text format

command-tower-mcp [6] - an MCP server for managing decks and custom cards on Archidekt.

If you build anything, I would love to know. Open a PR on the GitHub repo to give yourself a shoutout in the README https://github.com/domainellipticlanguage/mtg-crucible#in-th...

[1] https://api.scryfall.com/cards/73542493-cd0b-4bb7-a5b8-8f889...

[2] https://github.com/domainellipticlanguage/mtg-crucible#text-...

[3] https://scryfall.com/search?q=layout%3Anormal

[4] https://thismagiccarddoesnotexist.com/

[5] https://github.com/domainellipticlanguage/obsidian-custom-mt...

[6] https://github.com/domainellipticlanguage/command-tower-mcp


That Politico article is a good example of the kind of misinformation that makes the water consumption concern a myth. https://x.com/AndyMasley/status/2053296197679374365

> What actually happened here was that [...] two water hookups at a data center construction site weren't properly registered or linked to a billable account. When the utility noticed the problem, they sent the data center a retroactive bill for all the water, for $147,474 covering ~29M gallons. The data center paid it.

> Did the data center cause the low water pressure? The article very strongly implies a connection, but doesn't give the reader the right numbers to judge whether this actually happened. To figure this out, we need to know over what time the 30 million gallons was drawn [...] That's about 1% of the county's daily water output. There are a ton of ways a water system like this can experience low water pressure, and a 1% dip just isn't one of them.

> [...] the complaint about low water pressure [which led to discovering the billing problem] was coming from a private well that the data center didn't even draw from


Genuinely curious if the news today about Sora has changed your opinion at all https://openai.com/sora


> no card of MtG is allowed to mention the stack in their printed text

Nit: The Split Second keyword ability is usually accompanied by reminder text which mentions the stack

> Split second (As long as this spell is on the stack, players can't cast spells or activate abilities that aren't mana abilities.)

https://gatherer.wizards.com/Pages/Card/Details.aspx?multive...


Welp, that's true, my bad! It seems this rule was relaxed somewhat - mentioning the stack in the rules text is still frowned upon, but there's still some cards that mention it in the rules text (and a lot more that contains the split second reminder)

Note how the waterhouse's link - https://gatherer.wizards.com/Pages/Search/Default.aspx?actio... - contains a bunch of cards that were playtested but eventually rejected (they are the black-and-white cards with just a rough sketch in place of art), presumably because of the high bar that stack-fiddling cards should meet


Doing a search, I count 40 results with "stack" in their text; it appears that 18 of them have "split second", a few of them have "stack" in their name, several are from "Un" expansions or this weird "Mystery Booster" thing, several mention the stack in explanatory text about what it means to end the turn or end the combat phase... but there are several cards such as Grip of Chaos ("Whenever a spell or ability is put onto the stack, if it has a single target, reselect its target at random") that are from regular expansions.

https://gatherer.wizards.com/Pages/Search/Default.aspx?actio...


Is this a recent standards change? I remember some legendary artifact that caused spells on the stack to be copied and explicitly described it that way.


I recently made a game pretty much just like this. It's like a game of Drawful mixed with telephone so you can see how the image changes through cycles of AI drawing and human interpretation.

http://www.dallestrations.com/



In 2007 a conservative SCOTUS majority upheld a federal ban on partial-birth abortion [0]. Thomas wrote a concurring opinion where he explicitly glossed over whether congress actually had that authority under the commerce clause. Normally he jumps at any chance to say congress has exceeded their authority under that clause. I wouldn't find it hard to believe if this court upholds a more general federal abortion ban

[0] https://en.wikipedia.org/wiki/Gonzales_v._Carhart#Concurrenc...


> binary QR decoding for ZBar

I just saw a video the other day about storing video games in QR codes where the poster submitted a patch for ZBar. Was that you?


Video games in QR codes? That's interesting. Do you have the link to the video? Is it this one?

https://youtu.be/ExwqNreocpg

https://github.com/mchehab/zbar/commit/5bc323849569a629aa0d1...

If so, then the patch he submitted builds upon my work! He fixed a line feed conversion bug that was present in Windows. I use Linux so I did not experience this issue.

I remember seeing that patch get merged but I didn't know about the whole video game context. This is amazing. I wrote the patch because I was trying to print a 4096 bit RSA secret key as a QR code. Awesome to see it getting used for something even more awesome.

Here are the links to my contributions and related pages:

https://github.com/mchehab/zbar/pull/64

https://github.com/mchehab/zbar/issues/55

https://github.com/mchehab/zbar/issues/82

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=703234

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=710009

https://wiki.archlinux.org/index.php/Paperkey#Restore_the_se...

https://stackoverflow.com/a/60518608/512904

ZBar used to automatically convert binary data to text when decoding 8 bit QR codes, mangling the data in the process. My patch adds the option to disable that, enabling the data to be extracted without corruption.

I also added the one shot feature to the ZBar tools to make it easier to use in automated scripts that expect exactly one output:

https://github.com/mchehab/zbar/pull/60

Looks like we have a real world application for tiny ELFs now!

https://www.muppetlabs.com/~breadbox/software/tiny/teensy.ht...


Yes, that's the one!

Storing secret keys as QR codes is an interesting application as well. I remember reading on here about a CEO who printed out a database encryption key as a base64 string and then couldn't type it in correctly when it was needed to restore backups. A machine-readable format definitely seems the way to go.


Idempotence means T^2=T. Are you thinking of involution? https://en.wikipedia.org/wiki/Involution_(mathematics)


you're right i'm wrong. but my saving grace is that they're related https://en.wikipedia.org/wiki/Idempotent_(ring_theory)#Relat...


I would love to hear more about these "weird applications of type theory". Any references?


So it turns out you can basically use type theory to encode a surprisingly large number of desirable traits about your program. (Caveat being that as you get more restrictive, you reject more "good" programs at compile time--no free lunch with Rice's theorem.)

For example: In this paper, they basically use types (with an inference algorithm) to catch kernel/user pointer confusion in the Linux kernel. (https://www.usenix.org/legacy/event/sec04/tech/johnson.html)

It turns out you can encode a lot of other interesting properties in a type system (esp. if you're building on top of the existing type system), though--you can ensure that a java program has no null-dereference checks (https://checkerframework.org/ has a system that does this), and Coq uses its type system to ensure that every program halts (as a consequence, though, it isn't actually Turing complete).

There's also cool things like Lackwit (http://ieeexplore.ieee.org/document/610284/) which basically (ab)used type inference algorithms to answer questions about a program ("does this pointer ever alias?", etc.).


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: