Jump to content

Photo

Tetris


126 replies to this topic

#26 atari2600land OFFLINE  

atari2600land

    Channel F Viewer

  • Topic Starter
  • 11,527 posts
  • Location:Salem, Oregon

Posted Sun Jun 21, 2009 8:17 PM

I've ran into a major problem. Suppose you've got a long 1x4 line to fit into the following hole:
trouble.png
The result is quite messed up. I need someone to go through my code and figure out why this is happening and how to fix it. The trouble code begins at line #389. The code that begins the process of erasing rows begins at line #449, and the code that moves the blocks down accordingly begins at line #465. I think you can avoid most of the code that is before line 389, so it shouldn't take that long to read all my code. I think the problem is that the game can't handle one line being full, then one not full, then one (or two lines) full again.

Attached Files



#27 atari2600land OFFLINE  

atari2600land

    Channel F Viewer

  • Topic Starter
  • 11,527 posts
  • Location:Salem, Oregon

Posted Wed Jun 24, 2009 6:22 PM

I've tinkered with the code a little bit, and while i have trimmed it a lot, i still can't get to the root of the problem i'm having. Maybe a visual aid will better convey the problem i'm having:
tetrisproblem.PNG
Note that this only works with triples that have a line between them. If you get three lines in a row, it works perfectly. Please help!

Attached Files



#28 SeaGtGruff OFFLINE  

SeaGtGruff

    Quadrunner

  • 5,566 posts
  • Location:South Carolina, USA

Posted Wed Jun 24, 2009 6:34 PM

I've tinkered with the code a little bit, and while i have trimmed it a lot, i still can't get to the root of the problem i'm having. Maybe a visual aid will better convey the problem i'm having:
tetrisproblem.PNG
Note that this only works with triples that have a line between them. If you get three lines in a row, it works perfectly. Please help!

I'll look at this when I get home later.

Michael

#29 MausGames OFFLINE  

MausGames

    Dragonstomper

  • 897 posts
  • Location:MO, USA

Posted Wed Jun 24, 2009 8:04 PM

Any chance of a two-player simultaneous version?

#30 atari2600land OFFLINE  

atari2600land

    Channel F Viewer

  • Topic Starter
  • 11,527 posts
  • Location:Salem, Oregon

Posted Wed Jun 24, 2009 9:01 PM

I used 'set debug cyclescore' and if I'm reading it right (meaning 000064 means there's 64 left), it kinda looks like i'm barely getting by the maximum allowed. It goes down to 64 when the shape is moving down, most of the time it's near 2000. So, to answer your question, probably not. This is the first time i've used 'set debug cyclescore,' so I don't really know what the number *means* in terms of how I'm programming this.

#31 RevEng OFFLINE  

RevEng

    Quadrunner

  • 5,026 posts
  • Bitnik
  • Location:bottom of the stack

Posted Thu Jun 25, 2009 5:35 AM

If you're looking for some cycles, either tune the worst offending routines or throw them in the vblank. (Provided they're less than 1000 cycles)

The latter is the easiest, the former takes some art.

In a worst case scenario in which you could do neither, you could probably make a 2 player version by doing the work for player1 during odd frames and handle player2 during even ones.

#32 MausGames OFFLINE  

MausGames

    Dragonstomper

  • 897 posts
  • Location:MO, USA

Posted Thu Jun 25, 2009 6:16 AM

30fps Tetris isn't so bad.

#33 atari2600land OFFLINE  

atari2600land

    Channel F Viewer

  • Topic Starter
  • 11,527 posts
  • Location:Salem, Oregon

Posted Thu Jun 25, 2009 11:28 AM

I am able to get 2-player tetris at a full 60fps. This is just a visual aid to see how it works, but it is still VERY VERY buggy, kind of unplayable right now (actually, if you move player 2 to the right at all, it goes back to the title screen) You can move player0's pieces normally, though, but like i said, still very very buggy right now. I also still need help with the problem above. Once i get that fixed, I can double the code to use for player 1's line clearing.

Attached Thumbnails

  • tetris2player.png

Attached Files



#34 atari2600land OFFLINE  

atari2600land

    Channel F Viewer

  • Topic Starter
  • 11,527 posts
  • Location:Salem, Oregon

Posted Thu Jun 25, 2009 2:01 PM

Here's a way better version using 'set debug cyclescore'. Sometimes the score is red, but the number is 000000. What does that mean? This is still kind of buggy, though, and may start over again. To have 2player mode, set the right difficulty switch to A. Even though the name of the file is the same, it is a different build.

Attached Files



#35 atari2600land OFFLINE  

atari2600land

    Channel F Viewer

  • Topic Starter
  • 11,527 posts
  • Location:Salem, Oregon

Posted Thu Jun 25, 2009 8:00 PM

Forgot to add a few lines of code. Here's the corrected file. Also, fire now works more smoothly for player 2. And, if anyone can tell me why it goes back to the title screen when you get player 2's shape to the right side of the well, please tell me.

Attached Files



#36 SeaGtGruff OFFLINE  

SeaGtGruff

    Quadrunner

  • 5,566 posts
  • Location:South Carolina, USA

Posted Thu Jun 25, 2009 8:08 PM

If you can be a little more patient (okay-- maybe a *lot* more patient!), I have an idea or two up my sleeve that might help, but I doubt I could get anything to you before next week.

Okay, you twisted my arm. (Well, I twisted my own arm; so sue me.) I noticed that you aren't using any of the players, missiles, or the ball in your kernel (aside from the score)-- at least, you weren't in the earlier versions I looked at. So I'm going to create a custom kernel for you that will let you draw one or two standard-size Tetris playing fields-- 10 blocks across, and 20 rows tall-- without needing to use the Superchip. And I'm going to have the kernel check each row as it's drawn to see if it's all filled, and set a bit flag for that row if it is-- so that all you have to do to see whether or not a given row is filled is check its bit flag after executing the drawscreen command. :cool:

By the way, I suggest that you use the "score color mode" for the two-player game, so the left side of the screen can be drawn in one color, and the right side of the screen can be drawn in another color-- e.g., blue for the left player and green for the right player, or yellow and red, or red and blue, or whatever two colors the players want to pick.

Michael

#37 atari2600land OFFLINE  

atari2600land

    Channel F Viewer

  • Topic Starter
  • 11,527 posts
  • Location:Salem, Oregon

Posted Thu Jun 25, 2009 8:11 PM

Cool! Although in this latest version, I'm using player0 in the title screen, but it isn't very important and i could get rid of it if need be.

#38 SeaGtGruff OFFLINE  

SeaGtGruff

    Quadrunner

  • 5,566 posts
  • Location:South Carolina, USA

Posted Thu Jun 25, 2009 8:23 PM

Cool! Although in this latest version, I'm using player0 in the title screen, but it isn't very important and i could get rid of it if need be.

I'll check out how you're using player0 in the title screen; I don't think it should be much trouble to include the players, especially on a title screen as opposed to the actual game screen.

For the two-player game, how high do you want the score to go? I should be able to split the standard 6-digit score into two 4-digit scores, or I could split it and draw 2 digits with each sprite to get two 8-digit scores.

Also, I was thinking it might make more sense to draw the next piece directly over the board, as if it's in position and just waiting for its turn to drop down. That way in the two-player game the two preview pieces won't be so close to each other in the middle of the screen, but will be clearly separated on each player's side of the screen.

Michael

#39 atari2600land OFFLINE  

atari2600land

    Channel F Viewer

  • Topic Starter
  • 11,527 posts
  • Location:Salem, Oregon

Posted Thu Jun 25, 2009 8:48 PM

For the two-player game, how high do you want the score to go? I should be able to split the standard 6-digit score into two 4-digit scores, or I could split it and draw 2 digits with each sprite to get two 8-digit scores.

Two four-digit scores would be fine.

Also, I was thinking it might make more sense to draw the next piece directly over the board, as if it's in position and just waiting for its turn to drop down. That way in the two-player game the two preview pieces won't be so close to each other in the middle of the screen, but will be clearly separated on each player's side of the screen.

This sounds good.

#40 atari2600land OFFLINE  

atari2600land

    Channel F Viewer

  • Topic Starter
  • 11,527 posts
  • Location:Salem, Oregon

Posted Fri Jun 26, 2009 6:45 PM

I stayed up until 3:30am thinking about how to do this, and one bright idea led to another, and i woke up and came back to it, and i finally solved the problem! Note that this only works on player0 (left hand) because i still haven't added line clearing logic to the right hand player yet. The solution is to go through the line dropping down process twice. While this does take longer, it does work (i think, so if you see anything not working, please let me know.)

Attached Files



#41 atari2600land OFFLINE  

atari2600land

    Channel F Viewer

  • Topic Starter
  • 11,527 posts
  • Location:Salem, Oregon

Posted Sat Jun 27, 2009 11:06 PM

I have figured out why the game resets. It is because the game goes to -1600 cycles left. So, to get rid of this problem, I have added a change to the controls. If you hold the left or right button down, it will only move to the left or right once. To move two times to the left, you need to press left twice. I had to do this, unless someone else can think of another solution.

Attached Files



#42 atari2600land OFFLINE  

atari2600land

    Channel F Viewer

  • Topic Starter
  • 11,527 posts
  • Location:Salem, Oregon

Posted Sun Jun 28, 2009 6:33 PM

I added a score counter for each player. There seems to be a little bug with the playerscores kernel. Every time it goes past 09, it goes to 0A instead of 10. I've tried using $, but to no avail. Weird. By the way, there is no game over because I deleted it and haven't put it back in yet.

@ SeaGtGruff - Would it be possible to use your line checking kernel with the SuperChip? I need the SuperChip because I need the extra variables.

Attached Files



#43 SeaGtGruff OFFLINE  

SeaGtGruff

    Quadrunner

  • 5,566 posts
  • Location:South Carolina, USA

Posted Sun Jun 28, 2009 8:47 PM

SeaGtGruff - Would it be possible to use your line checking kernel with the SuperChip? I need the SuperChip because I need the extra variables.

Sure; it should work with or without the Superchip.

Michael

#44 atari2600land OFFLINE  

atari2600land

    Channel F Viewer

  • Topic Starter
  • 11,527 posts
  • Location:Salem, Oregon

Posted Sun Jun 28, 2009 11:13 PM

Tetris mechanics question:
I have never played a two-player simultaneous Tetris before. What is the object of the game? See who lasts longer? See who gets the most lines? I'm just wondering when I should make the game say "game over, player 1 (or 2) wins."

#45 Nukey Shay OFFLINE  

Nukey Shay

    Sheik Yerbouti

  • 21,794 posts
  • Location:The land of Gorch

Posted Sun Jun 28, 2009 11:33 PM

I added a score counter for each player. There seems to be a little bug with the playerscores kernel. Every time it goes past 09, it goes to 0A instead of 10. I've tried using $, but to no avail. Weird.


Don't you need to follow inline playerscores.asm with inline bcd_math.asm? Or is that irrelevant now?
(but that would explain it...the addition to the score was handled as hex instead of bcd).

#46 atari2600land OFFLINE  

atari2600land

    Channel F Viewer

  • Topic Starter
  • 11,527 posts
  • Location:Salem, Oregon

Posted Sun Jun 28, 2009 11:43 PM

I added a score counter for each player. There seems to be a little bug with the playerscores kernel. Every time it goes past 09, it goes to 0A instead of 10. I've tried using $, but to no avail. Weird.


Don't you need to follow inline playerscores.asm with inline bcd_math.asm? Or is that irrelevant now?
(but that would explain it...the addition to the score was handled as hex instead of bcd).

I tried putting inline bcd_math.asm in and "player0score = addbcd(player0score, l)" but it didn't like it. It went back to the title screen whenever I got a line.

#47 Nukey Shay OFFLINE  

Nukey Shay

    Sheik Yerbouti

  • 21,794 posts
  • Location:The land of Gorch

Posted Sun Jun 28, 2009 11:49 PM

Just ommitting it altogether doesn't seem to be a viable solution ;)

#48 atari2600land OFFLINE  

atari2600land

    Channel F Viewer

  • Topic Starter
  • 11,527 posts
  • Location:Salem, Oregon

Posted Mon Jun 29, 2009 3:50 PM

@ Nukey Shay - I know, I'm just leaving it out for now.

I've changed the background color in-game from red to blue so I can see where the score goes red in set debug cyclescore more clearly. This allowed me to clear up a few places where the cyclescore was -1000 or more and I've also made it possible to hold left or right and have the block move more left and right. This is the result. I hope it doesn't flicker too much for you. As always, I'd enjoy some feedback on how I'm doing.

Attached Files



#49 atari2600land OFFLINE  

atari2600land

    Channel F Viewer

  • Topic Starter
  • 11,527 posts
  • Location:Salem, Oregon

Posted Mon Jun 29, 2009 7:49 PM

In a two-player game, Player 0's line counter wasn't working correctly. I fixed that. Just a minor update. I'd like to keep the site in my signature and this thread both have the latest versions now.

Attached Files



#50 MausGames OFFLINE  

MausGames

    Dragonstomper

  • 897 posts
  • Location:MO, USA

Posted Mon Jun 29, 2009 7:51 PM

This is really great, this is looking like the best tetris yet for the 2600. I mostly finished my 2 player SC tetris - it looks pretty much the same, but I used a regular 6 digit score and just have it display the player scores in different colors, and it displays the score of the last player who finished lines. I also masked the dropping pieces and previews with player0 and player1 so they can be different colors; you might try that if you aren't using them for anything else. You can also do different patterns in the background for each level.




0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users