Log In  
Log In  

Cart [#26646#] | Code | 2016-08-08 | License: CC4-BY-NC-SA | Embed

update 2: so i guess the bare skeleton of the flow of gameplay is implemented. right now the three opponent players just discard a tile at random after they draw. you might as well do that too, since I haven't yet begun the process of implementing any of the actual rules of mahjong. (I'm sitting at 3309/8192 tokens right now, but my code is pretty messy.)

Cart [#26159#] | Code | 2016-07-30 | License: CC4-BY-NC-SA | Embed

update: i was having trouble wrapping my head around structuring my code around the _update() and _draw functions, and realized that for a game like this (no camera movement, minimal animation, simple actions taking place on a "turn" basis), it actually makes more sense to take a more simple approach -- ie, the game logic will just be one giant loop that cycles through each players turns until the game is over. Whenever I need to animate something I can just have a little loop that calls flip() after each frame of the animation is drawn. It should be obvious that I kind of have no idea what I'm doing.

Anyway, here's the wall-building phase at the start of a round. The first dealer is selected randomly. The 136 tiles are shuffled (that's what the noise is supposed to be), then the four sections of the wall are built up tile by tile. The dealer rolls the dice (with a cool little animation) to decide where to break the wall and start drawing from. The dora indicator is flipped, and the four players each take turns drawing their hand of 13 tiles.

Cart [#25633#] | Code | 2016-07-20 | License: CC4-BY-NC-SA | Embed

test test test

don't look at my code, it's bad

P#25634 2016-07-20 15:23 ( Edited 2016-08-10 21:03)

:: matt

Solitaire or proper Mahjong?

P#25635 2016-07-20 16:00 ( Edited 2016-07-30 19:52)
:: bab_B

Riichi mahjong (note the dancing yakuman). This will probably never be a full game -- I'm just doing this as a learning exercise and experiment. If I get far enough I'll end up having to write a rudimentary AI for the three opponents, but that's seriously a stretch goal. It'll be enough of a challenge to get drawing/discarding/calling and hand scoring to work.

P#25638 2016-07-20 16:13 ( Edited 2016-07-20 20:13)
:: matt

Nice! Best of luck. Should be fun!

I started a Hanafuda Koi-Koi game that I really should finish.


P#25695 2016-07-21 19:21 ( Edited 2016-07-21 23:21)
:: matt

Super cool!

P#26160 2016-07-30 15:52 ( Edited 2016-07-30 19:52)
:: Felice

Will you be doing solitaire as well? I've been thinking solitaire is something my semi-addled brain could actually work on and finish, in time, but I don't like stepping on others' toes. :)

P#26653 2016-08-08 00:54 ( Edited 2016-08-08 04:54)
:: bab_B

I probably won't, so go for it. If you do, hopefully you can find a way to make the tiles a bit more distinguishable than I did (my wind tiles are particularly hard to tell apart at a glance). I restricted myself to 6px wide for the tile faces in order to squeeze everything I needed onto the screen at the same time, but for a solitaire game you can probably allow yourself the full 8px. (Some other strategies to increase tile recognizability might include replacing the character tiles with arabic numerals, replacing the wind/season tiles with simple shapes like a star/tree/etc., stuff like that). From what I can tell, the standard mahjong solitaire formation is 15 tiles across at the widest, so you'd be able to get it all on screen with 4px to spare on either side. It could be a fun project. Bonus points if you include animated backgrounds and cool screen effects whenever you clear a layer.

P#26656 2016-08-08 01:51 ( Edited 2016-08-08 05:51)
:: Felice

I think you might be able to work around your own pixel limits by drawing the highlighted tile at a higher resolution, like 2x or 1.5x. That way, even if it's not clear at a glance, one can inspect at least.

P#26738 2016-08-10 15:06 ( Edited 2016-08-10 19:06)
:: bab_B

That could work, but I'd have to find a way to make some room on my already-full sprite sheet.

Obviously there's some optimizations I can do there (like getting rid of the sprites for the fake-dithered background, which I don't think looks that good anyway... and i dunno why i felt like I needed four sprites for the animated dice), but I'd still be looking at a minimum footprint of 33 sprites (one 8x8 "enlarged" version per tile, minus the pure white haku which I'd want to just draw with a rectfill()).

P#26744 2016-08-10 17:03 ( Edited 2016-08-10 21:12)

[Please log in to post a comment]

About | Contact | Updates | Terms of Use
Follow Lexaloffle:        
Generated 2019-03-24 01:13 | 0.024s | 4194k | Q:52