Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Show HN: I made a Mahjong browser game (jongmah.com)
252 points by jessym on Nov 29, 2020 | hide | past | favorite | 85 comments


Note: this is Mahjong Solitaire. I went in expecting either riichi or Chinese mahjong based on the title.


I’m not sure I’d describe the multiplayer mahjong games as “relaxing”. Riichi specifically gets into really intense situations.


Wow! Didn’t know Japanese played majhong too! What are the differences?


The most distinctive feature of the popular Japanese mahjong variants (as opposed to other mahjong gambling games) is probably the own-discard furiten rule: players can't win off others' discards if any tile they previous discard during that hand would complete their hand. (This is distinct from and in addition to more common "sacred discard" restriction against winning off a discard after letting another winning tile pass during the same round.) To facilitate keeping track of this, in Japanese mahjong separate discard piles are kept for each player through the entire hand.

(The other distinct feature is the riichi yaku, which essentially lets a player (discretionarily) raise their stake and declare that the won't change their wait to increase the potential score of the hand on completion. This is pretty distortionary since it's by far the most common yaku at about twice as frequent as tanyao.

It is the reason "riichi mahjong" is a common name for the most popular family of Japanese mahjong variants. It's pretty distinctive. I rate it as less distinctive mainly because, when everyone at the table knows what they're doing, it mostly only affects gameplay around the edges, whereas the own-discard furiten rule has wide-reaching implications for "defensive" play.)

Aside from that, there's the usual mess typical of regional scoring variation.


I would add that one other important distinction, though I don't know how unique, is that you can't win off a hand which doesn't have any yaku. This partly explains the popularity of riichi, as it's okay to have riichi only.


If you have a good wait, and you have a closed hand, there’s very little incentive not to riichi.


Yes you're right, I wish I knew how to edit the post title to include the word "Solitaire" to avoid confusion.


You had I believe 2 hours to do it during which there was an 'edit' link.


Or you can ask @dang to help!


Ditto.


Hey, Nice Game! One suggestion - Can you add an indicator so that people will know to scroll down for rules and stuff. I figured this out really late and by then, I had already googled all the rules.


Interesting... I’ll try to add some kind of indicator to show there’s some more content below the fold


A button/option named Rules and Type that scrolls to the right place might be nice.

Also didn't notice the flower until it was nearly complete.


Yes, the same happened to me. Maybe an extra button where the music and hint buttons are that says how to play or something like that.


> Can you add an indicator so that people will know to scroll down for rules and stuff.

It's called a "scrollbar" and shown in the browser.


You're right, there is something called a "scrollbar", but many people don't see it because they are using macOS which for some reason hides the scrollbars by default.

Also phones/touchpads don't see scrollbars I think.


macOS does indeed show the scrollbar at all times when a input device other than a touchpad is attached.

My desktop Mac never hides the scrollbar, as it uses a normal mouse, however when I was using a Magic Trackpad the scrollbar would indeed hide unless I was actively scrolling.

Odd behavior.


There's actually a system preference that shows/hides the scrollbar.

System Preferences > General > Show scroll bars

• Automatically based on mouse or trackpad

• When scrolling

• Always (because I remember when smart phones didn't exist)

I keep mine at option 3 because I'm a dinosaur


Good info, had no clue that was a configurable option. Thanks for the knowledge!


If someone is asking for an scroll indicator, it's safe to assume that, for some reason, the native scroll affordance has been hidden from them.


Indeed - but then the person asking should better look in the systems/browser settings; this has nothing to do with the website.


Nice work. BTW It wasn't clear to me (until I clicked 'hint') that you can match different flower tiles.


I don't think that's specific to this implementation


Nice, well done! Is it always the case that the plant tiles match even though it's not exactly the same plant ?


I was stuck for a long time until I gave in and clicked the hint button, only to find out that different plants could be combined. I think all of them can, since I paired up several during the game.


Yes that's correct - there are 4 unique flower tiles which can all be matched with one another


I made a version of Mahjong Solitaire for Yahoo! Games back in the early aughties. I was stuck in figuring out how to make each board solvable. I asked Udi Manber, and he obviously in hind sight, was like, "why don't you just place them in pairs to set up?"


Relatable! My first version of the tile generation placed every tile randomly, which meant I always got stuck, haha. Setting the board up in pairs is indeed what solved the issue.


Possibly a stupid question: is it possible not to win this? Is it just for the purposes of relaxing, or is there a strategy?

I played one hand, and it needed to shuffle towards the end because there were no legal moves, and then I won. Can every hand be won without a shuffle?


Just like many solitaire games, you can definitely lose in Mahjong Solitaire.

Since there are four tiles (two pairs) of each tile set, you can play in such a way that you’re deadlocked because of a previous choice.

Imagine, for example, there are two matching tiles with one stacked on top of the other. If you already removed the other two matches for that same tile set, then you’re stuck, since the only way to remove the top one is to match it with another match — but you can’t get to the only remaining matching tile since it’s covered by that tile.


I guess my question was whether "shuffle" was a legitimate part of the game, or if it means "you've lost, try again."

When the tiles are shuffled, the situation you describe gets undone, no? So I'm guessing that means you've basically lost, but in this implementation it doesn't make that clear (at least to me), so I just carried on and figured I won.


Yeah, I nothing that’s just a way to allow you to finish when you get stuck. In most games I’ve played (and I’ve played many different ones on iPhone, computer, and consoles), I don’t think I’ve seen that. Usually once you’re stuck, they’ll let you know and you have to start a new game.

I have, however, often seen them allow you to replay the same setup to try and beat it again. Many also allow undo (sometimes limited, sometimes unlimited) to reverse your moves to get out of being stuck.


Conversely — and to answer your second question — yes, all boards are solvable (unlike many other solitaire games that can have unsolvable setups).


Good job technically overall. Some player feedback:

It seems to be using more than a standard mahjong set? I saw 3 pairs of eight dots in a game.

Other confusing part are the one bamboo tiles where they’re all different art — took awhile to figure out they ‘matched’

Fun times!


After playing a bit, this is definitely not using a consistent set.

Additionally, if you shuffle, it doesn't give you the same tiles as you had before, which is a little disconcerting (and isn't really a shuffle, as it doesn't retain the information about which tiles you had more than one pair of remaining).

Lastly, having CTRL-Z work to undo would be helpful.


First try! I remember playing this sort of game years ago, maybe on Solaris? Very fun thank you.

One thing that might help unfamiliar players is a list of all tiles in the deck(?). I assume better players know how many there are of each which means it is safe to remove some easier ones when there can't be any more. It could update in real time as an option to show what's left, but probably best not to by default.


This game, usually known to us as mahjong, is the solitaire version of mahjong.

But the game known as mahjong is a 4 player game where these tiles are like cards. It's similar to poker in a way, and really fun to play. Usually very fast paced too.

There are mahjong tables that automatically shuffle and sort the tiles, creating "hands" for all 4 players (I am not too familiar with mahjong terminology).


Agree, it's actually a little confusing to call this mahjong. It really has very little to do with the actual game that is called that name. This is just "match the tiles" with some complicated tiles.


Nice! Some feedback, maybe not specifically for your implementation, I think these are the reasons I've never gotten that into Mahjong even though I really like these kind of games.

- Some of the bricks are too similar for me. Red symbol with a smaller black symbol above. As those symbols are meaningless to me, I'm unable to pattern match quickly. (It's probably the standard look, but having variations would be nice)

- I have trouble with the depth perception, it's not extreme enough for me to intuitively know if a brick is available or not. If anything, fading those blocked just a tad would be very helpful to see it at a glance.

What I find enjoyable when playing puzzle games is to "turn off my brain" and just do it on intuition/pattern matching/experience. I feel I'm unable to do this here, it takes a lot of cognitive effort to search for the bricks, instead of actually solving the logic of the game. Which to me often makes Mahjong more of a hassle than other type of games.

- Whats the flower pot for?


Thanks a lot for the great feedback!

- I'm considering creating a Western variation of the tile set where the black characters (Chinese for 1 - 9) are replaced by 1, 2, ... 9, which might help a bit with the pattern matching (you might get used to the Chinese characters after a while, though!)

- 100% agree, the depth perception could be better

- the flower pot is a progress marker


The game is pattern matching, so if you make a western version, make it a non-default option. FWIW you could make shapes, or famous buildings, etc., but I have only ever seen the proper tiles in use before. I don't even remember which Chinese numbers are which, and I have no idea the characters for which directions are which, either. But it doesn't matter as long as you can remember the shape and colour. I definitely prefer the "authentic" look. Besides, eventually you come up with nicknames for remembering what you're searching for: there's a stickman, a house, a mustache, the underlined th, the letter x, the letter k, etc...

Depth perception caught me a few times because certain tile positions overlap at the same angle. I don't know how hard/easy it is to do, but one of the best versions I saw added a bit of a shadow as if the light was coming from the rear right side to make those more clear. That way it makes the tiers more obvious while still looking natural.

Anyway, your game is pretty much spot on, and plays as quick/smoothly as a desktop app, so that's a good thing. Once in a while the <ding> gets delayed, but that might be my far-too-many open tabs interfering.

I like the flower-meter. Nice subtlety.

Some people might want a timer. It would be a nice addition as an option, but not default. "Relaxing" goes out the window if there's a timer, and I tend to lollygag and carry on conversations while playing games like this.


Please don’t westernize the game by translating the characters, that’s like what’s so special about the game!


Concerning the brick with the red symbol and the black symbols. The black symbols are the characters for 1 to 9. The red character means "ten thousands".

The flower pot seems to mark your progress. The flower grows by stage when you have been connected a certain number of bricks.

I agree that the depth perception is not optimal.


Very nice implementation. Enjoyable play

Flower and tree tripped me up (not identical as other tiles)

Would be nice if less delay after second tap (on matching tile)


Nostalgia overload. I love it. My only suggestion, I seem to trigger the drag when clicking for some reason. It happened to me quite often, maybe there should be a minimum distance before going into drag mode?


Now that you mention it, I guess there's really no reason for the tile images to be draggable so I better disable that! Also, thanks :)


That's great, I was using a Wacom tablet, and assumed that was the issue. This will help a lot, thank you.


Great game. Haven't played in a very long time and enjoyed this. This applies to most Mahjong Solitaire implementations but my only feedback is how I always imagine if I had to physically shuffle and tile the board up to play and how there's no way all tiles would have the same orientation. Meaning, yes left&right would be the long sides but a seven dot might be 3 over 4 or 4 over 3. Having the same orientation makes the game much easier.


Hi, great job. I always knew how to play multiplayer mahjong (incredibly underrated family/friends activity) but not solitaire mahjong. Now I know cuz of your game!


Looks nice. (On my secondary phone which runs a somewhat older Firefox it gets an "unexpected" error whenever trying to build the Butterfly, works fine all the way through the Turtle.)

Have you considered open sourcing that? I tend to avoid closed source software as much as I can. Of course Javascript is not really closed source, but I have better things to do than looking at packed source.


This is great and I wish I saw more like this. I've been picking away at Spider Solitaire so I can tell my parents to stop downloading dodgy apps and just go to my URL. Tiny jewels like this without obligation or advertising is about the last part of the original spirit of the Internet left.


It captures my mouse cursor in a weird way, having real slow acceleration compared to when I move it outside the browser window.

I didn't even know that was possible, and also it's annoying me that it's possible. Maybe it's the "Pointer Lock" JavaScript API?


I was thinking about this game the other day! Thanks for making this. I used to play this all the time when I was a kid: https://www.youtube.com/watch?v=mk7QMxOgYTI.


It was relaxing until there were no more moves. Then I jumped a little in my seat at the noise.


That's a good point - I guess that sound effect doesn't go so well with the rest of the atmosphere.


I would also suggest letting the user stew for 10 seconds or so before declaring "No More Moves".


And maybe not make it a modal, but a little message above the board that the user might not initially notice.

(btw great work, I really enjoyed it!) (did you do the art yourself?)


Most of the tile art was taken from a GitHub repository [1], and most of the background assets (trees, clouds) were taken from a website called Freepik [2] where I have a paid subscription.

I just added some color and assembled everything into a single composition :)

[1]: https://github.com/FluffyStuff/riichi-mahjong-tiles [2]: https://www.freepik.com


Nice! That was a fun game back in the day.

Interesting way of dealing with a narrower browser window, where the tiles "stack" instead of squeezing the images. Works pretty well, but it was nice to see them "click" into place once I widened my window.


Very nice! Are all hands solvable?


There's always at least 1 "path" to solving a newly generated game, but if you deviate from this path by matching tiles differently, you might end up getting stuck (where you can shuffle the remaining tiles) or even in an impossible situation (where the final two tiles are stacked on top of each other).


Well done. Quick question: when there is no more move left, does that mean that I lost (and the shuffle is there in order to be less frustrating) or is the shuffle part of the game's original rules?

Yup I'm totally Mahjong solitaire newbie :)


Very nice -- well done. Must break away now lest I be trapped for the next two days. :)



Worth mentioning where this is from, SHENZHEN I/O [1], very fun and cosy programming puzzle game. Really beautiful UI and sound design.

[1] https://store.steampowered.com/app/504210/SHENZHEN_IO/


This is really nice, just wasted a few hours on a Sunday afternoon pleasantly.


Played a lot of it today! I’ve known this game forever but still don’t understand the exact rule. Also, it didn’t work well offline (I was on a boat most of the time so I had trouble restarting new games)


I like it but it does not seem to compute when a board has become impossible until all moves are exhausted. The point of impossibility can happen long before that.


This is nice, I played a few games and the game played well except for a few bugs, namely some tiles remain blank after they’re uncovered - in Safari on IOs


May I ask for the music? Do you happen to have a playlist? I really like it. And great game it looks really neat and it's relaxing.


If you refresh the page, you'll now find the playlist at the bottom - glad that you like it!


Great! Thank you


Very nice, just a small suggestion you could add sounds just when you click your mouse and when you select/deselect a tile.


Good idea!


Love this. I used to play this as a kid. Love the different patterns. Thanks for creating this. Bookmarked!


Well done! I enjoyed playing your game and thank you for making and sharing it.


I remember playing this as a kid on my grandad’s Win 95 PC. Well done :)


Wow, this is awesome. Thanks for creating this.


What song is that?


The first song in the playlist is called "Out and About" by David Renda: https://www.fesliyanstudios.com/royalty-free-music/download/...


This was really enjoyable, thank you.


This is really nice!


Really nicely done.


awesome. nice job. helped reduce anxiety


I love it.




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

Search: