Advertisement

Tetris Clone: I swear this one works

Started by January 03, 2001 01:19 PM
14 comments, last by biskit 24 years ago
I swear this time it will work. The URL is the same, but for brevity''s sake, here it is: http://stono.cs.cofc.edu/~crosbyb/projects/BlockTris.zip. You will need DirectX version 6 or greater. ---------------------------------------- Implementation is everything. Period. Particle Toast
----------------------------------------Implementation is everything. Period.
hey, pretty good!

The onylt hing I can see that needs improvment is the fact that the 'level' doesnt increase past 1 - or at least, not noticably i got up to 50 lines w/o a level hehe

Congrats, and good luck int he future

EDIT: oh yeah, whats yer method for getting an FPS display in your game? I could use one in mine

--LordKaT

Edited by - LordKaT on January 3, 2001 3:06:43 PM
Advertisement
Thanks a lot man, I appreciate the opinions(good or bad). Yes, I haven't implemented the 'level' functionalit yet, right now it is just kinda freeplay. As for the FPS, I just keep track of how much time has passed using timeGetTime(), and use TextOut() with the backbuffer's DC(if you actually want the calculation code, let me know, but thats easy). My friend is doing most of the graphics, and I'm working on the programming. I'm looking for outside opinions on features to implement, so if anyone has and idea, let me know. And one last thing, if I could get the average FPS of anyone who tests it for me, I would appreciate it. Thanks.

Edited by - biskit on January 3, 2001 3:18:58 PM
----------------------------------------Implementation is everything. Period.
I get roughly 33-40 FPS (that counter needs to go somewhere else)

OH, how about this..

a special ''bomb'' block that takes out a chunk of the board with no points, or that ''explodes'' a few chunks of blocks randomly

--LordKaT
It''s a good game, I have a question: Can you rotate the blocks, is there a key, because I can''t rotate them.
quote: Original post by biskit

I swear this time it will work. The URL is the same, but for brevity''s sake, here it is:


nice game

some suggestions:
option to drop the item faster
the code that elimates the completed line seems to be a bit slow?
Advertisement
The bomb clock idea isn''t bad at all, I will definetely ponder that one. And yes, you can rotate the pieces using the spacebar. And harrys, I don''t believe the line removal algorithm is slow(it is very simple), however, there is a delay before is happens, and I believe that is what you are seeing. Thanks for the replies everyone!

----------------------------------------
Implementation is everything. Period.
Particle Toast
----------------------------------------Implementation is everything. Period.
I''m writing a tetris clone myself, and I was wondering how you did the line-clearing code. So far, my idea is that it will:

1. Use a two for loops (one for block in row, one for row) to check each block of every row to see if it is 2 in the matrix. (2 represents on, 1 is off) If so, a variable is set to true, and it checks the next block. If the next one is off, it is set to false. If it gets to the end of the line and is still true, the line is complete, and can be cleared.
2. If the line is complete, set all blocks in it to off.
3. Use two for loops (one for block in row, one for row) to shift every block down.

I don''t know (because I haven''t done it yet), but this sounds very slow. Any ideas on how to optimize it?

EonX
To find lines, I did use to for loops. Here''s some psuedo-code:

  BOOl flag = FALSE;for (int i=iBoardHeight-1;i>=0;i++){ for (int j=0;j<iBoardWidth;j++) {  if (!TetrisBoard->GetBlockStatus(j, i)) // if it''s empty  {   flag = TRUE;  } } if (flag == FALSE) // if it was a complete line {  // clear the line, and drop all blocks down 1 space }}  


So, as it seems, I have done it the same way you are talking of doing it. And no, it really isn''t slow. We aren''t doing any heavy computations, just comparisons. Hope I helped .

----------------------------------------
Implementation is everything. Period.
Particle Toast
----------------------------------------Implementation is everything. Period.
EonX two suggestions on how you could speed it up. First you don''t need to check to see if every row has a finished line every frame you only need to check the rows that the falling piece is in when it can''t move down any further. When your checking to see if a row is finished start your variable as true and as soon as you find a block that is off set it to false and break out of the loop. You only need to find one block that is off.

This topic is closed to new replies.

Advertisement