The user can create a JSON string that represents a game (checkers, solitare, dominion, smash up, etc). Then the engine creates cards, tokens, dice, etc. It does not enforce rules but it supports multi player and some rules about visibility to other players. Its intended use case is for testing out new games or expansions before printing them.
It's a little bit early in the project though, so you'd have to run it from source if you want a demo.
This is what I've been wanting to make since I first learned about programming 3 years ago. So much effort goes onto enforcing rules, when really, all you need is the virtual pieces.
This is actually something you can do with Tabletop Simulator on steam, as I'm using it for that exact purpose. It even uses JSON as the underlying data structure. Granted, it's proprietary and not free.
Hm, cool!
My company just started on a Javascript board game engine where the server & client can share the same .js file for rules, and all logic for the game is encoded into the pieces (fat models) instead of controllers, allowing for easy customization and mods.
If you're referring to |0 then I would disagree. It shows how horrible JavaScript is. This is very confusing if you're not familiar with this trick or strange behavior of the language.
Any idea why the suits all render as smiley faces in Chrome/Mac?
Inspecting the cards, you can see that they are using the unicode character for spade/heart/etc. But in the browser itself you get nothing but smileys.
Perhaps the font they're using doesn't have those code points?
Edit: Yes, that's the case. Font is not specified, so it comes in as "inherit" by default, using whatever the browser feels like. On Mac Chrome, that must use smileys to represent unknown characters. Switching the document font to Arial in CSS fixes the issue and makes the cards look like cards.
> On Mac Chrome, that must use smileys to represent unknown characters.
You're seeing the Last Resort fallback font, which shows a symbol representative of the codepoint range, and the range's name, so you can identify what type of font you need. Since the suits are in the smiley block, you see a smiley. If you had no Latin alphabet font, you'd see an A.
Great work. There's a couple of small issues. First, regardless of where you click on a card, when you start dragging the card will jump so that its centre is at the cursor position. Second, there is a mismatch on the Z-index used for dragging and that used when a card is dropped into place.
Each of these cards could probably be made with one element and some CSS3 pseudo-element selectors, as opposed to the four elements (wrapper element and three child elements) that are currently used per card.
Additionally, with three elements (possible just one if you're crazily good at CSS), it'd be possible to have flippable cards. Still just using CSS3.
Browsers implement pseudo elements using actual elements internally, there's no difference in power from using ::before or just putting a <span> as a child. Pseudo elements will probably be a little bit slower though.
This is quite nice! One "intuitive-but-counterintuitive" result -- when the cards are stacked and I drag from the corner, I end up pulling a card from the middle of the deck.
I suppose that's more for a second library that can manage stacks of cards, dealing and interacting with dealt cards, etc.
Very nice! I tried the CSS3 routes for card animations when I first built my card game ( https://solitaire.gg ), but ended up going with WebGL since the cross-browser support for CSS3 animations was so wonky.
the animation is lovely and fluid. bit of a shame that the card faces don't have the pictures for the royal cards and the usual layout of multiple suit signs on the number cards, but this is still super.
[+] [-] AndyKelley|10 years ago|reply
The user can create a JSON string that represents a game (checkers, solitare, dominion, smash up, etc). Then the engine creates cards, tokens, dice, etc. It does not enforce rules but it supports multi player and some rules about visibility to other players. Its intended use case is for testing out new games or expansions before printing them.
It's a little bit early in the project though, so you'd have to run it from source if you want a demo.
[+] [-] RodericDay|10 years ago|reply
[+] [-] AUmrysh|10 years ago|reply
[+] [-] hellbanner|10 years ago|reply
https://github.com/QuantumProductions/tic-tac-toe
[+] [-] cableshaft|10 years ago|reply
[+] [-] rw2|10 years ago|reply
[+] [-] riebschlager|10 years ago|reply
var suit = i / 13 | 0;
That's such a clean way to get a 0, 1, 2 or 3 from each card's `i` and I never would have thought of it.
[+] [-] takeda|10 years ago|reply
[+] [-] daok|10 years ago|reply
[+] [-] pakastin|10 years ago|reply
[+] [-] DatBear|10 years ago|reply
[+] [-] gcb0|10 years ago|reply
which has the advantage of working with any size of deck. important since in brazillian truco you leave most of the numbers out ;)
[+] [-] hacker_9|10 years ago|reply
[0] http://www.sitepoint.com/understanding-asm-js/
[+] [-] redler|10 years ago|reply
[+] [-] hacker_9|10 years ago|reply
Now you just need to add a dropdown to select what drinking game you want to play.. ring of fire anyone?..
[+] [-] pkstn|10 years ago|reply
[+] [-] jasonkester|10 years ago|reply
Inspecting the cards, you can see that they are using the unicode character for spade/heart/etc. But in the browser itself you get nothing but smileys.
Perhaps the font they're using doesn't have those code points?
Edit: Yes, that's the case. Font is not specified, so it comes in as "inherit" by default, using whatever the browser feels like. On Mac Chrome, that must use smileys to represent unknown characters. Switching the document font to Arial in CSS fixes the issue and makes the cards look like cards.
[+] [-] TazeTSchnitzel|10 years ago|reply
You're seeing the Last Resort fallback font, which shows a symbol representative of the codepoint range, and the range's name, so you can identify what type of font you need. Since the suits are in the smiley block, you see a smiley. If you had no Latin alphabet font, you'd see an A.
https://en.wikipedia.org/wiki/Fallback_font
[+] [-] pakastin|10 years ago|reply
[+] [-] pakastin|10 years ago|reply
[+] [-] felipeerias|10 years ago|reply
[+] [-] pakastin|10 years ago|reply
[+] [-] pakastin|10 years ago|reply
[+] [-] retrogradeorbit|10 years ago|reply
[+] [-] thomasfoster96|10 years ago|reply
Additionally, with three elements (possible just one if you're crazily good at CSS), it'd be possible to have flippable cards. Still just using CSS3.
Edit: Can someone explain these downvotes for me?
[+] [-] pakastin|10 years ago|reply
[+] [-] esprehn|10 years ago|reply
[+] [-] donpark|10 years ago|reply
My own CSS playing cards with proper card faces from 3 years ago is here:
http://donpark.github.io/scalable-css-playing-cards/
[+] [-] pakastin|10 years ago|reply
[+] [-] pakastin|10 years ago|reply
[+] [-] mkorfmann|10 years ago|reply
[+] [-] pakastin|10 years ago|reply
[+] [-] almightysmudge|10 years ago|reply
[+] [-] halotrope|10 years ago|reply
[+] [-] ipsin|10 years ago|reply
I suppose that's more for a second library that can manage stacks of cards, dealing and interacting with dealt cards, etc.
[+] [-] snake117|10 years ago|reply
Nice work by the way!
[+] [-] linuxlizard|10 years ago|reply
[+] [-] err4nt|10 years ago|reply
I made an endless random card (and die roll) generator: http://staticresource.com/shuffle.html just tap anywhere to draw a new card.
Seeing what you've done with your Deck of Cards is a big inspiration!
[+] [-] kelukelugames|10 years ago|reply
I thought we needed to make a separate repository for github pages first. My other repo doesn't show at all.
[+] [-] kyle_u|10 years ago|reply
[+] [-] pakastin|10 years ago|reply
[+] [-] pakastin|10 years ago|reply
[+] [-] danvesma|10 years ago|reply
[+] [-] pakastin|10 years ago|reply
I used 52-framed movieClip as a card, where frames were values.
And then every suit graphic was one movieClip as well with 4 frames: spade, heart, club and diamond
Worked great! Not so easy to do with HTML though. Lots of figuring out coordinates manually.
[+] [-] pakastin|10 years ago|reply
[+] [-] habith|10 years ago|reply
[0] http://cluecode.com/cards/
[+] [-] borkabrak|10 years ago|reply
[+] [-] pakastin|10 years ago|reply