Memory Match Online - Another Example...

Posted by Toon-Master on Nov. 14, 2006, 8:08 a.m.

Greetings all,

Again I did another Card Engine Experiment called Memory Match. Yes the game where you find the pair and it's yours. However it uses a new Card Engine this time with Multiple deck support. And best of all you can play it ONLINE with your friends.

And you can get this in Closing Words (it's source of course).

Heres a screenshot:

—————————

What did I do:

—————————

Well before I go there, I just had to say making a Memory Game was even more easier then Blackjack. Yeah I should of done that first <_< but oh well it's done.

Card Scripts:

For the card scripts I just change the names of the scripts like deck_drawcard to card_drawcard. And I added deck_create which just creates a deck with choice of back design or just use the default one. There is two objects one your already from my previous one called __Cards_ID and now the new one __Deck_ID. The Deck ID is just for carrying the deck information around.

Single Player Memory

For the memory card game I had to change 1 rule with the card engine. I had to change the __Deck_ID object with Persistent on because this deck is going to be created in a menu room and going to be around every room I go.

For a single player game it was the easiest part. Three scripts was needed. One to setup the deck and tell how much shots you made and pairs you got. The second was drawing all cards and placing it in 4 rows (13 cards each row). And the third was to check if the two cards are paired and does it's routine if so/not.

When the Player flips 2 cards it disables the clicking and waits 15 steps to give you the time to read what you picked up and if it is paired it destroys the instance else it is flipped face down. After that you can click again.

In the 3rd script I mentioned does the routines if all card instances are gone so it just shows message with the scores.

Online Parts:

That was the hard part. I added 6 scripts, 3 are the same like while the others are not. One script receives the message to receive the server's deck so it follows the server rules. Also that script gives the turn the player starts. It is random (choose(0,1)) pick. Another is the win routine, to see if you lose or not. And lastly, another script that receives the message of player's choice.

I dunno but I assumed the instance ID was going to be different from both sides so I added a array system that stored the card id. So when the other player clicks a card it gets the Number and writes a byte instead of a unsigned short to the buffer.

Connecting or hosting is in the Left Release Mouse event on those buttons. If hosting you accept players in obj_ControlOnline. Simple 39dll stuff using TCP.

Rest is played by assumption through the picks and right deck and is treated like normal play.

————————–

Closing Words:

————————–

Download Link: Memory Match Online Example

Ports you may need to forward if hosting: 13420 TCP

Simple Rules for Multiplayer:

Get a match and you get another shot. I think that's all you need to know.

Looking for a friend to play? Use IM and get someone.

There might be some bugs, so keep and eye if you want or play a game?

Other News:

Tommorow I got college and have to do a write up on his computer removing parts and see how well Pheonix_L3S works on it. (From last blog too)

If you read the other blog with "yak". Well I don't have to do work as long as I help her so everytime she does something I pass a task (40 tasks I done 50% for helping other people :P).

Games in college? I'll play some more Game Maker Games that I could never play on this junk in college.

I'll probably put Card_engine in Examples later maybe.

Enjoy

- Toon-Master

EDIT: Shoot, I forgot the Tie Win part. Oh well…

Comments

Warlin 18 years, 1 month ago

Weee :D Memory match sounds like fun what with randomly placed cards that look a certain way because a variable corisponds with their sprite frame :D

…. but really, you do give alot of help to new people, congrats, I could never do such. Mainly because I'm lasy.

So congrats.

Toon-Master 18 years, 1 month ago

Yeah the frames does the trick but really the point is to get the value of the card I thought. But you probably know it's more then just the frame.

- Toon-Master