Game Development Community

dev|Pro Game Development Curriculum

TDN - TGB Match 3 Tutorial Update

by Gavin · 07/16/2010 (4:14 am) · 5 comments

Hi all,

Just a quick announcement: I just finished updating my TGB Match 3 tutorial in the Torque Developer Network website. This is the 3rd revision of the tutorial and I had spent a couple of hours earlier completing a basic implementation of gravity on falling pieces. I also spent quite some time adding in comments and explaining some important concepts on the tutorial page itself. And finally, I added a link to the source code and graphics on my personal website.

I hope that the tutorial helps to serve as a learning tool for those just starting off on TGB and Torquescript. I know that there are still some bugs in the tutorial, but after all it's a tutorial whereby you can have a hand at correcting the bugs (grins). The Match 3 tutorial is currently just the bare bones - and obviously without the bells and whistles of modern Match 3 games, but I would think it serves as a template for someone really wanting to produce such a game.

If you ask me, writing this tutorial has truly been a good learning experience for me, and I would definitely have implemented it differently from the original code found in the forums. But that would be too much of a re-write.

And having TGB Pro (source code accessibility at hand) and Torsion is of utmost importance on your path to learning how to use Torque products!

Have fun!

About the author

Skilled Game Programmer/Tester/Gamer and Budding Game Designer at large <big grin>... and an ecstatic owner of a shiny license plate which says - I am a TGB Pro + T3D Pro + Torsion owner!


#1
07/17/2010 (1:39 am)
I was actually looking at this tutorial the other day, and was quite happy. Usually grinding my teeth while in the TDN. I'm going to have to check your updates out!

+1 to ya for helping the community!
#2
07/18/2010 (12:11 pm)
Thanks Gavin. I got your previous match 3 tutorial working great thanks and now I will update with the new changes.
Cheers
Scott
#3
08/09/2010 (3:41 am)
Update: Fixed a bug #4.

I have fixed a few problems in the code and added return swap when there are no matches.

replace gem.cs with www.deanparker.com/gem.zip

This is what was done. I really did not do a lot of code changes, split functions to expose various parts (resulting in not having to add more code).

1) Split gem swap code in function onPositiontarget.

2) Split gem match code in function CheckForMatches1.

3) Fixed string comparision, should be binary compare. gem.cs

OLD
if ($swap $= false)

NEW
if ($swap == false)

4) Fixed problem with multi gem drops, where gems would disappear.

This was a little difficult to figure out. If there are additional matches (combos) once they drop, a schedule calling match2 would fire before all the gems dropped. Tested with random(4) gems. This would cause more matches being found during mid drop and it would start to move gems from wrong location.

I put in a function to cancel/reset the schedule before it would call match2.
#4
11/24/2010 (10:56 pm)
First off I want to say thank you for the tutorial it has helped me understand programming better. The only thing I wish to ask is how to get different shaped layouts other than the standard square layout. I have experimented with it and it just gets confusing. I appreciate any help thank you.
#5
03/15/2011 (4:57 am)
Spam removed by moderator