Programming Mah Jongg

Basic and Machine Language

Moderator: Moderators

Post Reply
Dusty
Vic 20 Amateur
Posts: 51
Joined: Sun Feb 13, 2011 7:43 am

Programming Mah Jongg

Post by Dusty »

Last night I was wondering, if there was a Mah Jongg game like Atari's "Shanghai" for the VIC and if not, how to write one... ;) I thought a little bit about it during the day and I guess, the main problem is the low resolution of the VIC:

The game consists of 42 different tiles, AFAIK. The classic game play has 8 rows, of which the longest one is 15 tiles at the start of the game, so one tile can have a max. of 11 pixels (max. X resolution of the VIC is 22*8=176px / 15 tiles = 11 px per tile) -- I know, there is the one or other trick to expand the X res. a little bit, but I don't know, how useful they are, so let's calculate with the "normal" limitations...

As the graphics on the tiles are pretty complex, it's not possible to put a tile in an 8*8 matrix, even 11*11 is very hard, not calculated the additional px I'd need for the 3D view of the tiles or using multi color, which would halve the X resolution :(

Assuming I write (or use an existing?) "hi"-res graphics solution (which means basically a routine, that allows to set and clear single dots in a matrix), I would need (without multicolor) 15 tiles * 11 px / 8 px per char = 21 chars in X and 11 chars in Y, which means 231 re-defined chars - is this possible? (Sorry, I can't remember the limitations). Okay, I could save the one or other char by cutting the hi-res matrix where no tiles are, but I definitely would need more than 128 chars... possible or not?

A scrolling playfield is not practicable, the player needs the overview of the whole figure. I think, *if* it is realisable at all, I'd have to simplify the tiles a lot... or do I think completely wrong and there is another solution for the "Mah Jongg problem"?
User avatar
Jeff-20
Denial Founder
Posts: 5759
Joined: Wed Dec 31, 1969 6:00 pm

Re: Programming Mah Jongg

Post by Jeff-20 »

I'm fond of atari 2600 solutions to complex games: simplify. Card games on that console didn't seem to suffer from a limited ability to depict actual playing cards or even suits.

Older generation games presume the player's imagination will pick up where technology leaves off. If this were my project, I would trust the 8x8 standard character size to be sufficient. Is the visual of actual Asian tiles important to you? I bet you could hint at it and have enough variation for each tile to be distinct in hires mode. Maybe music and colorful borders could help with atmosphere.


Sent from my iPhone using Tapatalk
High Scores, Links, and Jeff's Basic Games page.
User avatar
tokra
Vic 20 Scientist
Posts: 1123
Joined: Tue Apr 27, 2010 5:32 pm
Location: Scheessel, Germany

Re: Programming Mah Jongg

Post by tokra »

I would suggest a 192 x 160 pixel layout with double height chars. This would be 24 chars in x-resolution and would still be visible on NTSC. You can set up the screen on PAL/NTSC with these commands, courtesy of Mike:

Code: Select all

poke 36866,(peek(36866)and128)+24 ; display 24 columns
poke 36864,peek(60900)-2          ; 2x4 pixels to the left
poke 36867,21                     ; 20 double-height chars
poke 36865,peek(60901)+6          ; 6x2 pixel down
192 x 160 also fits nicely into RAM - use chars 16 to 255 (= 240 chars in double height = 30720 pixels = 192 x 160) to start screen-ram and char-ram both at $1000

With this setup you can have 15 tiles of 12 pixels wide each and you can make the tiles 20 pixels high which leads to nice square tiles because of the 5:3 PAL-pixel aspect ratio. Or go with 16 pixels high which might be easier to address and would look fine on PAL and NTSC - this would also leave 32 lines for status/score display.
User avatar
Mike
Herr VC
Posts: 4830
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: Programming Mah Jongg

Post by Mike »

Dusty wrote:The classic game play has 8 rows, of which the longest one is 15 tiles at the start of the game, so one tile can have a max. of 11 pixels (max. X resolution of the VIC is 22*8=176px / 15 tiles = 11 px per tile)
A tile size of 11 pixels width (including border) would also fit into a 160x192 bitmap (with 15x10+1 = 151 pixels width of the longest row, when you let adjacent borders overlap). That resolution also would have the big advantage, that there are already a plenty of tools around.
As the graphics on the tiles are pretty complex, it's not possible to put a tile in an 8*8 matrix, even 11*11 is very hard, not calculated the additional px I'd need for the 3D view of the tiles or using multi color, which would halve the X resolution. :(
In any case, you'd need some way to select a tile - that method could include a zoomed view of the selected tile in one of the screen's corners, with more detail.
Jeff-20 wrote:If this were my project, I would trust the 8x8 standard character size to be sufficient. Is the visual of actual Asian tiles important to you? [...]
Sorry, but no. The VIC-20 can do better than that. Like thus:

Image
Vic20-Ian
Vic 20 Scientist
Posts: 1214
Joined: Sun Aug 24, 2008 1:58 pm

Re: Programming Mah Jongg

Post by Vic20-Ian »

Wow, really impressive tiles - not my favourite game but great to see it starting on the Vic-20
Vic20-Ian

The best things in life are Vic-20

Upgrade all new gadgets and mobiles to 3583 Bytes Free today! Ready
TBCVIC
Vic 20 Hobbyist
Posts: 127
Joined: Thu Mar 05, 2009 3:38 am

Re: Programming Mah Jongg

Post by TBCVIC »

It's funny, I have just last week been playing Mahjong on a Sord M5. It's a very rare cartridge for Sord which I bought from Japan. I think the game is identical as this one for MSX though: http://www.generation-msx.nl/software/h ... lease/174/
It doesn't use the flowers and seasons tiles.
Ola Andersson
Image
User avatar
Mike
Herr VC
Posts: 4830
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: Programming Mah Jongg

Post by Mike »

Just to reassure our Denial fellows (and especially Dusty) that there is active development on this project, a pre-alpha version of Mah Jongg could be spotted on a Retro-Meeting in Cologne yesterday:

Image

It's already fully playable. :twisted:

The full game will be released on Revision 2015. :mrgreen:
User avatar
Mayhem
High Bidder
Posts: 3026
Joined: Mon May 24, 2004 7:03 am
Website: http://www.mayhem64.co.uk
Location: London

Re: Programming Mah Jongg

Post by Mayhem »

Oooo, funky! What memory expansion does it use? :)
Lie with passion and be forever damned...
User avatar
Mike
Herr VC
Posts: 4830
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: Programming Mah Jongg

Post by Mike »

Mayhem wrote:Oooo, funky! What memory expansion does it use? :)
The main game engine runs in +16K, but the full game most probably will require +24K or +32K.
16KVIC20
Vic 20 Nerd
Posts: 510
Joined: Tue Apr 06, 2010 5:02 am

Re: Programming Mah Jongg

Post by 16KVIC20 »

Looks really impressive.

This is exactly the type of thing I love to see for the VIC. Stuff that was beyond belief back in the 80s.
User avatar
orion70
VICtalian
Posts: 4340
Joined: Thu Feb 02, 2006 4:45 am
Location: Piacenza, Italy
Occupation: Biologist

Re: Programming Mah Jongg

Post by orion70 »

Mike has been a precious guest here in Italy a while ago, and I had the opportunity to give this game a first look... well, I'm lucky enough to have my own copy on the FE3, and play it on a regular basis - it's not a good work Mike, it's a GREAT one.

He also explained me in person some programming tricks and the general path leading to the present version, and it was one of the most interesting times I've had with a VIC (and with a friend :)) lately!
User avatar
Jeff-20
Denial Founder
Posts: 5759
Joined: Wed Dec 31, 1969 6:00 pm

Re: Programming Mah Jongg

Post by Jeff-20 »

I'm excited to see this one. It looks great.


Sent from my iPhone 6 Beta using Tapatalk
High Scores, Links, and Jeff's Basic Games page.
Dusty
Vic 20 Amateur
Posts: 51
Joined: Sun Feb 13, 2011 7:43 am

Re: Programming Mah Jongg

Post by Dusty »

Yes looks great! And if I had known that it takes the time it is about to take now, I surely had joined the development - but Revision 2014 was much too short for me. Better I keep my ideas next time?! :P
Post Reply