Deck.of.cards
deck.of.cards
deck.of.cards
Old one has nicer animation treats, but the new one has multiplayer as well :)
Without looking at the code...can I ask you a question? Is the "randomness" "real like a real deck" -- as in, "after shuffle the cards have a certain definite order, which then is unchanged as you select from the deck?" or is the randomness more like a "computerized version", as in, "shuffle is just for show, selecting from the deck just randomly picks 1 out of the set of remaining cards and subtracts that card, in other words-- these is no persistent order?"
Or do you shuffle the remaining hidden deck multiple times (so, not when shuffle is explicitly performed, but on other occasions, for example; at intervals; or, after someone pics the top card; etc)?
Here's the car.js.org server-side as simple example: https://github.com/pakastin/car-ws/blob/master/server/index....
The curious part is that this order doesn't mean anything for card players, in fact it would probably be better for most games if the decks where printed in random order, but for magicians this order is really important for many effects. For example, if you perfectly shuffle the deck 8 times it will go back to it's original order.
I've been working on something similar, but for arbitrary index card notes and played around with some very basic animations. You can see a quick video of it here [1]. After I got a basic prototype working, there was just something satisfying about collecting all the cards, shuffling them, and then re-distributing them into a grid.
I noticed that deck.of.cards doesn't have a flip animation, but maybe that's a good thing. The typical animation you see when a card is just flipped by rotating about one of the axes just "feels" wrong to me. It breaks the illusion somehow, but maybe there's a better way to do it.
[1] https://mastodon.social/@allenu/109952125506805902
Edit: You may need to hover over the GIF in the link to get the animation to start. Kind of unexpected behavior.
EDIT: Turns out the following behavior is intentional, but I'll leave the statement here so the child comments make sense.
I wanted to point out what may be a bug .. if I quickly drag a face-down card off the deck and release the LMB right away, it flips face-up, however if I leave the mouse button depressed for ~0.5s, it stays face-down. Maybe this is intentional, but I feel like it's a bit of a weird behavior either way.
Chrome 111/Windows.
Anyway, thanks for sharing :)
card.js confirms:
if (isFlippable && Date.now() - starttime < 200) { // flip sides
- Ability to drag a selection region and move multiple cards together (like, say, the deck) - Ability to align cards to each other (I found myself testing modifier keys while dragging to see if this was a hidden feature, but alas.)
- The ability to shuffle the cards without the jokers.
FWIW I don't think the Kings easter egg is a good idea as-is. Maybe require a modifier key like "Click the kings while holding down the `K` key." Otherwise someone might have to click all kings while playing Free Cell and have their game ruined, that's no fun.
I had a project doing something similar a while back and got pretty stuck on figuring out how to go about it
Nice and slick as is, though
Single-player seems fine though.
There is a client and a server, so not super easy, but not hard if you have any sysadmin experience. I had a server up for almost a year once
(As far as I know, the p2p requirements mean that on iOS at least, this cannot be implemented as a web app. Again, would love to learn that I’m wrong.)
Might be a fun demonstration project for persons or orgs wanting to show off distributed consistency protocols. You might even add some blockchain to the mix if you have a thing for stale buzzwords. For a company with a product in the distributed consistency field, it could make a nice trade show booth giveaway: "this is actually our product, and you can even challenge each other on the plane back home, that's how special it is"
Doing so flawlessly at consistent 60fps in a mobile browser is quite the feat, don't you think?
https://github.com/deck-of-cards/standard-deck
I'm not sure that there are many technical challenges. It's 10k lines of Javascript, and a ton of that are curly braces or blank whitespace lines.
I certainly don't want to knock the author here. This IS a neat and satisfying little project. But I have to agree with a comment elsewhere in this sub-thread, pointing out that teenagers were making advanced 60fps video games with Flash back in the 1990's.
Between Flash dying, and VB 6 dying, it feels like the ability for community members to simply MAKE SHIT has eroded tremendously. To be fair, a lot of this has to do with Windows declining as a monopoly desktop platform, and the rise of mobile as an alternate platform. Cross-platform is hard, especially across wildly different form factors and user interface types.
But even so, I miss the days of people showing off cool shit all the time. Stuff you could touch, play with, use. Today the showcase is mostly libraries "written in Rust!", that you can use to build other libraries written in Rust. Along with half-baked tools like Flutter and React Native, that are eternally "one year away" from being suitable for desktop apps, and kinda suck compared to the tools we had decades ago.
This project is just a small experiment of mine, wanted to fiddle around with nicer shuffle animation than what's usually seen, and inspire others as well by sharing the source code.
I've also done https://car.js.org for example, and https://flanets.io – those as well just small side experiments..
But ya, i have to agree we used to see more creative stuff when Flash was still around, and that is sad.
Multiplayer Deck of Cards - https://news.ycombinator.com/item?id=20067301 - June 2019 (73 comments)
Thanks for sharing!
It needs some form of multi-card selection, so that I can grab a stack of cards and move, shuffle, or flip them as a group. I tried to play a game of solitaire, then got to the part where you can reuse the cards in your discard pile, and realized that there was no way to have it shuffle those cards, or even to just flip them all over.
(Feedback: can't click "sort" on mobile due to placement of git banner.)
The upside is that this must be their end game. Can't make it much more liberal than this.
And the most ignored from a while ago: .mobi .
It would be cool if when I clicked and dragged a card and let go of the mouse button, the cards slid a bit, to simulate them sliding them across the table.
I could see some people not liking that though, best to make it configurable.
multiplayer card games on android. Keep you own hand private. See the cards on the table. Took more than a weekend, but I knew nothing of android or kotlin at the time.
Nicely done.