Author Topic: Yet another late 2048 clone  (Read 7369 times)

0 Members and 1 Guest are viewing this topic.

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Yet another late 2048 clone
« on: June 19, 2014, 04:12:05 pm »
Basically, I wanted a 2048 that was as fast as nikitouzz's (or at least with a constant speed) and as beautiful as JWinslow's, but I can't understand anything in JWinslow's code o.o

So here's mine. It lacks a lot of features (like score saving for example) but it's not bad for something made in one day :P
2705 bytes when compiled for Ion.

Plus, Streetwalrus is going to be happy since I plan on adding an undo button :P

edit yeah, those are the same graphics as in JWinslow's version and I have the permission to use them as I was the author and gave them to JWinslow :P
« Last Edit: June 19, 2014, 04:46:48 pm by Hayleia »
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

Offline Streetwalrus

  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3821
  • Rating: +80/-8
    • View Profile
Re: Yet another late 2048 clone
« Reply #1 on: June 19, 2014, 06:36:08 pm »
I was waiting for this one actually. :P

Also yeah, undo button. I'm at 131072 now. <_<

Offline ClrDraw

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 627
  • Rating: +61/-2
    • View Profile
    • GitHub
Re: Yet another late 2048 clone
« Reply #2 on: June 19, 2014, 06:39:39 pm »
I like this! Good work :)
Visit my GitHub for all my TI programs as well as other projects.
Also check out my website.

Offline Aspiring

  • LV3 Member (Next: 100)
  • ***
  • Posts: 81
  • Rating: +5/-0
  • The only source of knowledge is experience-Einsten
    • View Profile
Re: Yet another late 2048 clone
« Reply #3 on: June 19, 2014, 09:32:50 pm »
Nice!  :thumbsup:  Maybe I should add better graphics to my 2048 clone.  ::)

Offline JWinslow23

  • Coder Of Tomorrow
  • LV7 Elite (Next: 700)
  • *******
  • Posts: 556
  • Rating: +43/-6
  • I make quality calculator games...when I have time
    • View Profile
Re: Yet another late 2048 clone
« Reply #4 on: June 19, 2014, 09:59:41 pm »
...I can't understand anything in JWinslow's code o.o
Rude! :P

But yeah, this is good. Maybe I might release a new version of mine with that new animation! (as soon as I figure out how you did that XD )

However, I would like to clear some stuff up, as far as my animation algorithm goes. Here is my animation subroutine with comments as to the exact details as to what everything does.
Code: [Select]
.Just so we're clear, GDB1 is:
.0,16,32,48,0,16,32,48,0,16,32,48,0,16,32,48,0,0,0,0,16,16,16,16,32,32,32,32,48,48,48,48
.That should clear some stuff up.
.
Lbl ANIM
Copy(GDB1,L1+48,32)
.This copies the X values and Y values of the tiles to a memory location where they can be changed, but still remain somewhere in its original form.
.(overwriting GDBs overwrites the program code itself)
0->[r3]
For(16)^^r
abs([r3]-{[r3]+32+L1})->{[r3]+32+L1}
[r3]++
End
.The preceding code puts the distance in tiles that any tile will move in any direction in {L1+32} to {L1+47}.
For(4)^^r
.(as we are moving 4 pxls/frame, and 16/4=4 :p)
15
For(16)^^r
Rect(->[r3]^4*16,[r3]/4*16,15,)^^r
[r3]-1
End
.That whole loop was to redraw the gray squares in the background, as they are erased when the tiles are moving.
For(16)^^r
.Loop for every tile
[r3]+48+L1->[r4]
[r4]+16->[r5]
.X and Y positions of the currently looped tile
If {[r3]+16+L1}
.If the tile being moved is not 0
WRect({[r4]},{[r5]},15,)^^r
Bitmap({[r4]},{[r5]},{[r3]+16+L1}-1*32+Pic1)
.Erase the gray area behind the tile, and draw it at the X and Y positions it is now supposed to be in on the screen.
End
!If K
{[r5]}+({[r3]+32+L1})->{[r5]}
Else!If K-1
{[r4]}-({[r3]+32+L1}*4)->{[r4]}
Else!If K-2
{[r4]}+({[r3]+32+L1}*4)->{[r4]}
Else
{[r5]}-({[r3]+32+L1})->{[r5]}
End
.That whole If/Else statement is supposed to update the X and/or Y positions of the tiles.
.(I'd've done it smaller, but Z-Test() in a subroutine causes the compiler to choke :p)
[r3]++
End
DispGraph^^r
.Draw the current iteration to the screen.
WRect(and 0,,63,)
.Erase every tile now drawn on the screen, so we can redraw it in a later iteration.
End
And that inconsistency with speed you're talking about? It's actually intentional, but not in the way anyone has percieved it.
How my code works is: tiles move a certain speed towards their targets depending on their distance (a la the original). Therefore, it makes sense that the less tiles on the screen, the faster it seems; that means tiles may move a greater distance, and with a greater "speed". And this also stands with the more tiles on the screen, the less of a distance the tiles move, the slower it seems to go.

I'm not saying my animation is perfect. It isn't, by any means. I'm just saying, there's less wrong with it than you think there is. You did very good with yours! (Although it could be a bit faster... :P )
yeah, those are the same graphics as in JWinslow's version and I have the permission to use them as I was the author and gave them to JWinslow :P
She (she? he?)'s not wrong. :P
« Last Edit: June 19, 2014, 10:03:24 pm by JWinslow23 »
Did you know that "Ammonia Gas" rearranged is "As Omnimaga"?
Click here for the only set of games you'll ever need
= ?

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: Yet another late 2048 clone
« Reply #5 on: June 20, 2014, 12:14:10 am »
Dat grayscale when moving, though O.O

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: Yet another late 2048 clone
« Reply #6 on: June 20, 2014, 03:11:22 am »
Thanks all :D

Dat grayscale when moving, though O.O
That's just Wabbitemu, I recorded with weird settings with a low number of shades. But on calc you don't see anything weird like that ;)

...I can't understand anything in JWinslow's code o.o
Rude! :P
Lol, I didn't mean "he codes like his foot" but just "I can never understand people's code since I don't know which RAM area is used for what" ;)
I even have to comment my code to understand what I did sometimes :P

And that inconsistency with speed you're talking about? It's actually intentional, but not in the way anyone has percieved it.
How my code works is: tiles move a certain speed towards their targets depending on their distance (a la the original). Therefore, it makes sense that the less tiles on the screen, the faster it seems; that means tiles may move a greater distance, and with a greater "speed". And this also stands with the more tiles on the screen, the less of a distance the tiles move, the slower it seems to go.
Well I did that too but for some reason I had the impression that I had to wait longer when more tiles moved, not just that they moved slower.

You did very good with yours! (Although it could be a bit faster... :P )
Thanks, and yeah, I think I'll make them move twice as fast. When tiles have to move great distance it might be visible that they skip pixels but on small distances they still won't skip any pixel and they'll still be faster.

Just something about my code, there's some Action Replay during the animation, as in "you can't see shit when tiles are moving so I am not drawing properly and you can't tell the difference" :P
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

Offline Streetwalrus

  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3821
  • Rating: +80/-8
    • View Profile
Re: Yet another late 2048 clone
« Reply #7 on: June 20, 2014, 04:45:06 am »
Ooooooh you cheater. :P

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Yet another late 2048 clone
« Reply #8 on: June 20, 2014, 11:52:23 am »
Good job :D. Also Jwinslow maybe your code being unreadable actually means it's too good, as in runer11fic2? :P (I didn't check tho)

Offline JWinslow23

  • Coder Of Tomorrow
  • LV7 Elite (Next: 700)
  • *******
  • Posts: 556
  • Rating: +43/-6
  • I make quality calculator games...when I have time
    • View Profile
Re: Yet another late 2048 clone
« Reply #9 on: June 20, 2014, 01:03:10 pm »
I was joking about the "Rude!" thing. That's why I added a :P face.

And I will add a practice mode, complete with undo button, as soon as I know that the current version is good enough to be released on ticalc.
Did you know that "Ammonia Gas" rearranged is "As Omnimaga"?
Click here for the only set of games you'll ever need
= ?

Offline Streetwalrus

  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3821
  • Rating: +80/-8
    • View Profile
Re: Yet another late 2048 clone
« Reply #10 on: June 20, 2014, 01:05:59 pm »
Good job :D. Also Jwinslow maybe your code being unreadable actually means it's too good, as in runer11fic2? :P (I didn't check tho)
Lol yeah. Never read Runer's code tho. :P

Offline chickendude

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 817
  • Rating: +90/-1
  • Pro-Riot Squad
    • View Profile
Re: Yet another late 2048 clone
« Reply #11 on: June 20, 2014, 01:25:10 pm »
JWinslow23, your version seems like it's already ready for ticalc. It's the version i've got on my calc, at least.

Hayleia, yours looks nice, too, though i think skipping a pixel or two would be nice.

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: Yet another late 2048 clone
« Reply #12 on: June 20, 2014, 01:30:45 pm »
@DJ_O: Thanks, and it's unreadable as in "I don't know what this part does", I can't even know if it's good or not :P

@JWinslow23: I know you were joking, but still, I don't want to have any misunderstanding. And as chickendude said, I think yours can go on ticalc already. At worst, if you change anything, you still can update your archive.

@chickendude: Thanks. And there's already some kind of pixel skipping. If a tile moves to an adjacent tile, it doesn't skip pixels. If it goes one tile further, it still doesn't skip pixels, but for the two remaining distances, there is pixel skipping. I just didn't want the animation to look kind of laggy. It is also faster on calc ;)
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

Offline JWinslow23

  • Coder Of Tomorrow
  • LV7 Elite (Next: 700)
  • *******
  • Posts: 556
  • Rating: +43/-6
  • I make quality calculator games...when I have time
    • View Profile
Re: Yet another late 2048 clone
« Reply #13 on: June 20, 2014, 07:12:44 pm »
Well, thanks, everyone.
Hold on, lemme make a readme and upload it... :D
Did you know that "Ammonia Gas" rearranged is "As Omnimaga"?
Click here for the only set of games you'll ever need
= ?