by TheMiddleMan · 5y ago · 0 comments
The tech stack is Nodejs, MongoDB, Redis, Socket.io, and React + Redux on the frontend.
It's actually been a pet project for a long time (6+ years) but I've been taking it more seriously since Jan 2020. Fun fact: the original was built with Backbone.js and CoffeeScript.
Happy to answer some questions and please let me know your feedback too.
And follow us on Twitter for updates: https://twitter.com/playingcardsio
I remember back in the Google Wave days I created a connect four game where no turns were enforced, and you could take out the chips of the opponent if you saw that they cheated. A Google engineer was a bit irritated by that, she expected that it was turn based and pointed it out as a flaw.
Maybe you could add a feature which shakes the entire table so that the cards/boards end up in a state where continuing doesn't make much sense, like when you push away the board IRL because you noticed that you lost.
Aaah! The old STEM education in full effect. Beautiful example. No creative thinking on their part whatsoever.
I've also just added PlayingCards.io to my website[1] of multiplayer games that require no user accounts :)
[0] https://playingcards.io/docs/ [1] https://quickparty.games
just the other day I was wondering what happened to older Javascript frameworks like Backbone.
Can you elaborate why you moved from Backbone to React / Redux? As of what I recall, Backbone was extremely stable and a lot of companies used it in very heavy web apps as well.
Since, the 2D board games of the type on your site doesn't seem to require heavy front-end lifting (I might be completely wrong here), I'm curious to know the reason behind switching to a newer technology which is still riding the hype wave.
Thanks. And of course, the site is very nice. Will be sharing it with my colleagues for our Friday online hangouts!
1. Having nested DOM elements in your components. Backbone really wanted you to just have one element per component, and then use jQuery to add children as needed.
2. Adding event handlers and other HTML attributes. JSX syntax means you can basically write HTML in your JS file. Backbone made you add event handlers manually.
3. Nested components. React lets the parent simply specify what children it wants and React automatically creates/reuses/destroys component instances for you. This was all manual in Backbone.
The bigger advantage though, is how the state is typically organized in React apps.
In Backbone, app state was sprinkled throughout the component hierarchy, and often you would have do event spaghetti up and down the hierarchy to update some state held by another component.
Typical React apps use a state container like Redux, the UI is "projected" from the state, and components just send changes to the state, aka "unidirectional data flow".
That said, React is not the best for games. Maintaining 60 fps can be difficult and we've done some fairly heavy optimization to try to keep it smooth.
Have you see SvelteJs? Would that be better suited in this scenario?
> Pinochle uses a unique 48 card deck that consists of 2 sets of 9, 10, J, K, Q, K, A in each suit.