PDA

View Full Version : Over the summer I wrote Yet Another Mahjongg Game


TomorrowPlusX
2005.01.06, 08:48 PM
So, many months ago I wrote a Mahjongg Solitaire game, to scratch an itch, since I didn't like any of the versions available for OS X, and I did like the free one that came with KDE. I wanted something simple, direct. No fancy graphics, no monkeys with fireballs, no nothing.

But then, after writing a mahjongg engine, I decided wouldn't it be fun if it were 3d, and then... well, I got carried away and made it have *physics*. So, when you get frustrated and give up on a game, it will scatter the tiles just like if you had tossed the board. Think "boxstack demo" for any physics engine, crossed with Mahjongg Solitaire.

Here's a fresh game:
http://home.earthlink.net/~zakariya/files/Yams/YAMS0.jpg

After giving up.
http://home.earthlink.net/~zakariya/files/Yams/YAMS1.jpg

It uses the Open Dynamics Engine for the scattering physics. Since there's quite a few tiles, it takes some horsepower to make them scatter smoothly. My PB 12" 1.3 Ghz is pretty decent, but I ran it on a G5 and it was nice.

So, this is basically abandoned. I made only one board layout, and the 3d code is pretty piss-poor. I had only started opengl programming about 6 months earlier...

Anyway, it's perfectly playable and you can add new tilesets and texture maps on your own. You can add them to the app bundle in Resources/ or you can add files in an identically laid out tree in %USER/Library/ApplicationSupport/YaMS

You'll have to examine the existing resources in the bundle to figure out my board layout file ( just a text file ) and the texture map layout for the tiles.

If anybody would like it, it can be downloaded here:
http://home.earthlink.net/~zakariya/files/Yams/YaMS.zip

If you have any troubles with it, I'm happy to help out. If you'd like to work on it, or mess with it, I'll upload the code. Right now I'm busy writing a more "real" game.

http://home.earthlink.net/~zakariya/files/Legion/Legion-6-1-2004-2.jpg
http://home.earthlink.net/~zakariya/files/Legion/Legion-6-1-2004.jpg

blobbo
2005.01.06, 09:53 PM
Wow, that legion game looks nice. Like the shadows - the terrain seems a bit... bare? What's the plot? What's it going to be? Got a build to post?

TomorrowPlusX
2005.01.07, 05:20 PM
Wow, that legion game looks nice. Like the shadows - the terrain seems a bit... bare? What's the plot? What's it going to be? Got a build to post?

I'm actually working on making the terrain a little less bare. I'm working out a probability-map system so that you can draw grayscale images and assign them to trees and foliage and whatnot, so you can have little oases dense with grass and trees, or you can draw out boulder-regions around the base of mountains. My current system, where n trees and n shrubs are scattered over an approx 10k square terrain is just no good!

Anyway, the "plot" is that you're a colonist on some alien planet and you've got to defend your colony from swarms of local creatures -- which will be spherical glowing entities which swarm on your colony, attracted by its energy. Anyway, I've written a swarming engine:

http://home.earthlink.net/~zakariya/files/Hoard1.png
http://home.earthlink.net/~zakariya/files/Hoard2.png

The cool thing about it is that the entities are "dumb" on their own, but they seek out others as they seek food ( the big blue dot ). As they gather, they form "Minds" which allow them to have more resources at their disposal ( like better vision, more speed, etc ). They can also "defect" to better minds -- e.g. ones with more members -- if they choose.

So, the overall behavior is pretty creepily like bacteria, and high-school ;) I call it legion, because of _The Exorcist_ where the demon refers to itself as Legion. NOWONMAI... if you've read the book.

There will also be a "mother" creature you will have to defeat after you kill ( enough of ) her children and enrage her. Probably a frikkin-huge sand-worm, since I like Dune.

Right now I'm still working on the engine. I'm learning as I go. I'd love to post a build, but I've got rendering problems on everything but the GF 5200 Go. My friend's Dual 2.5 G5 with some sweet ATI card betrays z-buffer fighting with the shadow volumes -- which beats me since I intentionally use dirt simple glPolygonOffset to fix that and that works on every NVIDIA card I've tested against. But then, the terrain won't draw on GF4MX... it *used* to, but then I broke something ;)

I've got a long way to go.

LaRue
2005.01.07, 07:37 PM
The images of the mahjongg solitare look really nice. You did a good job.
I can see this being another mahjongg that I will be addicted to for a while...

Danlab
2005.01.08, 02:56 AM
So, many months ago I wrote a Mahjongg Solitaire game, to scratch an itch, since I didn't like any of the versions available for OS X
i hope you didnt try my Mahjong Solitarus :lol:

you should finish your mahjong game, with some work it should be nice

but you work is really nice, remeber to think about the gameplay and not only physic things ;)

TomorrowPlusX
2005.01.10, 07:52 AM
I just wanted to post an update -- I've got trees and grass working now.

http://home.earthlink.net/~zakariya/files/Legion/Legion-6-10-2005.jpg

Of course, I've only got one kind of tree and one kind of grass, but I can remedy that ;)

EDIT: Also, I need to learn how to use Wings3D's UV editor so I can texture my trees.

CarbonX
2005.01.11, 01:20 PM
Wings works with UV mapping in a kinda strange way... what format for your models are you using?
although mine seems to be broken :mad: I think I can probably help you
AIM == carbonx@mac.com
or I'm CarbonX on #idevgames

TomorrowPlusX
2005.01.11, 09:25 PM
Because I'm lazy, I'm using .obj files. It works fine for me since all my models are static -- and it has the appeal that I was able to write a loader in a single morning ( about 2 hours ).

The articulated mechanisms are managed by ODE and I just position and rotate the models to accommodate, so I don't need any fancy bone or animation mechanisms.

That said, I'm pretty certain I *load* the UV coords correctly, so as long as I figure out how to use Wings3D's UV editor I'm set.

Danlab
2005.01.12, 01:28 AM
im using Cinema4D and expost all in obj file and it work well, there is UV in obj file

TomorrowPlusX
2005.01.12, 07:11 AM
Oh, I *know* OBJ files have UV, I just need to learn how to do it! Cinema4D looks nice, but I can't afford it.

Danlab
2005.01.12, 08:04 AM
just telling you its possible

TomorrowPlusX
2005.01.12, 04:12 PM
Danlab,

I just looked at your Mahjong game -- it's BEAUTIFUL. I did *not* see that before I wrote my own. If I had, I probably wouldn't have written my own ;)