Jump to content





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

Posted by Thomas Jentzsch, in Atari 30 March 2014 · 4,541 views

2048 Threes Puzzle Atari 2600

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):

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

Attached Thumbnails

  • Attached Image
  • Attached Image
  • Attached Image
  • Attached Image
  • Attached Image
  • Attached Image

Attached Files






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.

  • Report

Note: 2048 is a clone of 1024, which is a clone of Threes: http://gamasutra.com...asual_games.php

 

(I haven't played any of them...)

  • Report
Yes, the code is not very effective. I am sure it can be optimized quite a lot. For now it works as required.
  • Report
IMO Threes is the better game. Probably I will switch the game mechanics to this game, but keep the graphics more like this.
  • Report

Started creating a version of Threes (v0.1). It is playable but there are still quite a lot of TODOs and some occasional glitches.

  • Report

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.

  • Report

I hadn't played any version of 2048 until a friend posted a link to the Doctor Who Edition this weekend on Facebook.  Played it on my iPad last night while watching TV.  Best score so far 6676.

  • Report

Created a SVN repository and uploaded all code versions there.

 

Read access for everyone!

  • Report

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!

  • Report
Polishing the game a bit more. Except for sound and (hopefully) undo, it is done.
 
Unless someone finds a gap. :)
  • Report

Almost done (v0.9)

  • Report

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.

  • Report

I've got good news! There will be an announcement soon.

 

Stay tuned... :)

  • Report

Just added the final version 1.02 to the attachments. Enjoy!

  • Report

Just added the final version 1.02 to the attachments. Enjoy!

Thanks Thomas!

  • Report

Search My Blog

Recent Entries

Recent Comments

January 2019

S M T W T F S
  12345
6789101112
1314 15 16171819
20212223242526
2728293031  

Categories

0 user(s) viewing

0 members, 0 guests, 0 anonymous users

Latest Visitors