Jump to content
  • entries
    39
  • comments
    622
  • views
    148,909

THREE∙S (was: 2^11 (2048))


Thomas Jentzsch

6,799 views

Getting first aware of the new hype around 2048 by this link, I started playing the game and immediately found myself wasting my time.

Since it is obvious that the 2600 could pretty easily support this game, I soon started wonder how it could be presented on the Atari. There are little bells and whistles to the game. Besides some nice animation effects when moving and merging the numbers, there are only colors. For me these colors, combined with the very reduced and clean graphics and fonts define the look of the game.

The arrangement of the numbers was pretty easy. Both NUSIZx registers are set to %010101 (three copies med, double width missiles). The missiles are used to draw the vertical gaps between the numbers (and 1 pixel left and right). Since the numbers are drawn in black, the third copy is not visible (except for a 1 pixel black line at the very right).

Then came the colors. Originally those should only come from the playfield. Since there are only 2 pixel gaps between the different number background colors, the color writes have to be timed precisely.

This lead to a problem. Not only the colors but also the player graphics have to be updated within very little time. I decided to VDEL player 0, which means that I can preload the first 3 number graphics before getting into the timing critical section. There I only have to write once to GRP1.

Still this did not work. After displaying the 2nd number I would have had to write to COLUBK and GRP1 within too little time. The COLUBK write had to happen at an exact cycle in the middle between number 2 and 3. So the write to GRP1 had to be done either before this write or after it. And there are only 1-2 cycles.

To overcome this problem, now the background color is used too (for the 3rd number)! This allows me to write to COLUBK while still displaying the 2nd number. So that I have enough time for the GRP1 write now. The critical timing requires some inefficient code, so the kernel is now running at exactly 76 cycles (75 required) without WSYNC.

Here is the code for it:

  ldy #DIGIT_H-1   ; 2.loopDigit:  sty.w .tmpY      ; 4 = 4   @73;---------------------------------------  lda (ptrGRP0a),y ; 5  sta GRP0         ; 3  lda (ptrGRP1a),y ; 5  sta GRP1         ; 3  lda (ptrGRP0b),y ; 5  sta GRP0         ; 3  lax (ptrGRP1b),y ; 5 = 29  lda colLst+0     ; 3  ldy colLst+2     ; 3  sta COLUPF       ; 3            (>=@34)  lda colLst+1     ; 3  sty COLUBK       ; 3            (<=@50)  sta COLUPF       ; 3       @44  (@44!)  lda colLst+3     ; 3  stx GRP1         ; 3  sta COLUPF       ; 3 = 27       (<=@55)  lda #0           ; 2  sta COLUBK       ; 3  sta COLUPF       ; 3  ldy .tmpY        ; 3  dey              ; 2  bpl .loopDigit   ; 2/3=15/16
 


Since I do not like to squeeze tiny multi digit numbers into just 8 pixel, I decided to display the numbers as 2^X (with only the X displayed). Also this adds a bit of a nerd factor to the game. :)

 

And this is how the result looks like:

 

Note: Rules for my Threes! variant (called THREE∙S = 3 dots):

  1. A new game starts with RESET
  2. Move the joystick to shift the tiles by one
  3. Press fire for undo (once!)
  4. '.' can only merged with ':'; resulting into a 0
  5. Digits with the same number can be merged, resulting into the next higher digit
  6. Whenever tiles are moved a new tile is created
  7. The new tile appears at an empty space in the column/row opposite to the move direction
  8. Initially the new tile can only be a '.', ':' or '0'
  9. After you reached a '4' you will sometimes get a higher bonus tile, which is between '1' and your highest tile number / 4.
  10. You get points for merging tiles, scores tripple for each higher number
  11. The game ends when no tile can be moved

2048X.png

Three.s v0.2.png

Three.s v0.3.png

Three.s v0.9 Title.png

Three.s v0.9.png

Three.s (v0.92).png

3 Dots v0.1.bin Three.s v0.2.bin Three.s v0.3.bin Three.s v0.9.bin Three.s (v0.92).bin Three.s (v1.02).bin

  • Like 6

15 Comments


Recommended Comments

Looks great! I like the colors. :)

 

 

Perhaps you could try and go for a fifth digit? I haven't looked at the timings... but you could shave 12 more cycles off what you have (for 13 total). It looks like this game won't require a lot of ram so:

 

 

- Use TIM8T for a auto-decrementing loop counter and graphics index. Requires re-arranging of graphics, but saves 4 cycles.

- Load the loop into zero page ram.

- Change the load zeropage for colors to load immediate, save 4 cycles.

- Change the indirect Y and indirect Y (lax) to lda absolute Y and ldx absolute Y, and save 4 cycles.

Link to comment

I finally managed (with some major rewrites and tests) to get a fifth tile in a row, so now you can preview the next tile. While doing that I had to drop some effects, but I will try to add them again. Also this version (v0.2) now saves the high score during a session.

 

BTW: The scoring is identical to iOS original, but divided by 3. Also you already get the score during the play and not just at the end of the game.

Link to comment

I'd heard of Threes, but only started playing it because of Thomas' version. Like I needed something else to occupy my time. ;)

 

Nice implementation though!

Link to comment

After doing some extra research about THREES I found that the current high score is > 500,000 points. Which definitely wouldn't fit into the 4 digit display I had planned. So with version 0.92 I changed the display to 6 digits. Which also gave me room to fully align the scoring with the original one.

Link to comment
Guest
Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...