PDA

View Full Version : Delphi/Pascal tetris algo or something



BytePtr
02-11-2005, 05:42 PM
I hope its correct forum, please move to correct place if its not.

I never tried to make Tetris in Turbo (Borland) Pascal/Delphi. And today i was thinking about starting writing one. Just to learn more. Is there any tutorial about creating Tetris in Pascal/Delphi? Just very basic, without score stuff etc. I just need some algo how this all must be done. I know that tetris game uses alot of arrays. I have some sources but almost all of them is without comments.
Can somebody give me some point/algorithm to start?
Im not beginner in programming, just some stuff is still new for me.
And what knowledge i must have?
Thanks in advance.

Traveler
02-11-2005, 08:26 PM
I'm not aware of a tetris game with sourcecode that has been made by a PGD member, nor do I know of a tetris clone or -tutorial that has been reported to PGD or Turbo in the past few years. I believe your best option in this case is google (http://www.google.com/search?q=tetris+delphi+source+code&spell=1).

Although I might add that tetris isn't the most difficult game in the book. If you are not the beginner you say you are then I'd suggest you give it a go before looking into other peoples code. You'll learn so much more that way.

BytePtr
02-11-2005, 10:48 PM
Yeah, i think i should code my own first and then optimize it. I found some tuts and collected some sources, i will try it out, step by step. If i will have something ready (some "mega beta") then i will let u know.

Sly
03-11-2005, 04:58 AM
If I ever did a Tetris clone, I would have a 2D array representing the game area, one array element per square. This array would initially be all zeroes. Each block is four squares, no matter what shape it is. When a block is placed, set the array elements of the grid corresponding to the position of the squares in the block to one. Then check the rows of the array that were modified for rows that are now all ones.

I hope that made sense.

BytePtr
03-11-2005, 11:13 AM
I hope that made sense.
Yep.

That's the same thing i was thinking about yesterday before falled into sleep in the evening :P
Thanks.

Firlefanz
03-11-2005, 11:29 AM
Hello BytePtr,

we have a tetris sample for Omega. Omega are DirectX Headers for Delphi.

http://www.delphisanctuary.com/forums/viewforum.php?f=4&sid=7f8230b47b02769ca40798ee011e34de

TOmegaTetris. :D

Firle

BytePtr
03-11-2005, 12:07 PM
Hmm, nice. But this requires some specific dll's like D3DX81ab.dll coz example in ZIP pack does not run without it. I have DirectX 9.0c.

Firlefanz
03-11-2005, 12:22 PM
It comes with the Omega Headers or you can download it from Clooties Site here:

http://www.clootie.ru/delphi/download_dx81.html

Look for the Download "Clootie_DX81_dlls.zip" this should include the DLL. You should then be able to run the Exe.

If you want to be able to compile it you will have to install the Omega headers.

Firle

BytePtr
03-11-2005, 12:59 PM
Yep, compiles fine, very simple to set up when using component(s).
I installed whole Omega component pack. Seems to be very useful components. nice :)

Firlefanz
03-11-2005, 01:39 PM
Hi!

Glad to hear you like it. There are several samples and some 3D samples that come with the package, there is also a DX9 version of Omega out.

We have a nice Omega forum here at Pascalgamedevelopment, the 'home' forum is at http://www.DelphiSanctuary.com and I also have a german one on my homepage.

If you need any help, let us know. :D
And keep us informed on your project. :wink:

Firle

BytePtr
03-11-2005, 02:45 PM
Hello.


Glad to hear you like it. There are several samples and some 3D samples that come with the package, there is also a DX9 version of Omega out.

Yep, found them


We have a nice Omega forum here at Pascalgamedevelopment, the 'home' forum is at http://www.DelphiSanctuary.com and I also have a german one on my homepage.

Thanks i will check this out.


If you need any help, let us know.

Thanks


And keep us informed on your project.

I will :wink: