WIP: revisiting Ten Ten

Discussion, Reviews & High-scores

Moderator: Moderators

User avatar
Jeff-20
Denial Founder
Posts: 5761
Joined: Wed Dec 31, 1969 6:00 pm

WIP: revisiting Ten Ten

Post by Jeff-20 »

I'm working on revising some of my old programs. I hope someone can play test this and give me some input.

I altered the start screen, combined the Ten Ten Again levels with the original program, optimized code, added level counter, changed playfield layout.

I would like to reconsider the High Score display (how I notify the player that a high score has been achieved).

I would also like to speed up the playfield set up routine:

Code: Select all

56 T=T+2:IFPEEK(T)=4THENIFRND(1)<VTHENPOKET+1-21*(RND(.)>V),.
57 IFT<DTHEN56 
And, of course, if you notice any other opportunities to make the program faster/smaller or just more fun...

Here's a DOWNLOAD.
High Scores, Links, and Jeff's Basic Games page.
User avatar
Mike
Herr VC
Posts: 4887
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Post by Mike »

Jeff-20 wrote:I would also like to speed up the playfield set up routine.
Those four lines of the game:

Code: Select all

55 PRINT"{HOME}"TAB(98+5*E);:C=8099:D=8111:T=7747:Z=7521:V=.6:O=0
56 T=T+2:IFPEEK(T)=4THENIFRND(1)<VTHENPOKET+1-21*(RND(.)>V),.
57 IFT<DTHEN56
58 FORT=1TOP:PRINTLEFT$("{YEL,WHT}",1-(T>13))MID$("#$%&'()*+,-. KKK",T,1)"{DOWN,LEFT}";:NEXT:M=M+.02
could be re-written thus:

Code: Select all

55 PRINT"{HOME}"TAB(98+5*E);:C=8099:D=8111:Z=7521:V=.6:O=0
56 FORT=7749TODSTEP2:IFPEEK(T)=4THENIFRND(1)<VTHENPOKET+1-21*(RND(.)>V),.
58 NEXT:FORT=1TOP:PRINTLEFT$("{YEL,WHT}",1-(T>13))MID$("#$%&'()*+,-. KKK",T,1)"{DOWN,LEFT}";:NEXT:M=M+.02
... eliminating line 57.

A GOTO jumping backwards always needs to scan from the beginning of the program, and that loop is already quite far down. Conversely, a FOR remembers the jump target, and should be slightly faster in this situation.
User avatar
Jeff-20
Denial Founder
Posts: 5761
Joined: Wed Dec 31, 1969 6:00 pm

Post by Jeff-20 »

Thanks Mike. I don't know why I did that. I used FOR loops for everything else. I think I did it that way for some reason (maybe for when the maze changes shape), but I don't really remember. Works much faster now.

Is the high score notification adequate?
High Scores, Links, and Jeff's Basic Games page.
User avatar
darkatx
Vic 20 Afficionado
Posts: 473
Joined: Wed Feb 04, 2009 2:17 pm
Location: Canada

Post by darkatx »

The stuff you two do with Basic is just incredible!
Learning all the time... :)
User avatar
Jeff-20
Denial Founder
Posts: 5761
Joined: Wed Dec 31, 1969 6:00 pm

Post by Jeff-20 »

Thanks, darkatx!

Here's a new DOWNLOAD.

Now it seems I have run out of variables. This is a common problem for me. I only want to find one more free variable. Line 6, part of my main loop, has a long number. Replacing it with a variable should make movement more fast/smooth.

Code: Select all

6 R=R+M:POKER,129:IFR>ZTHEN15 
compared to this, for example:

Code: Select all

6 R=R+M:POKER,Q:IFR>ZTHEN15 
Speed isn't really so important in this game, but I like smoother movement. I need to set a variable for 129.

Overall, I feel like this is a great improvement of the Megacart version of the game. I have 35 bytes free. I may just re-add the WAIT command that checks for cassette keys. I added it for the tape collection. Not really so useful otherwise, but who knows? Is there anything else I can do with those 35 bytes?
High Scores, Links, and Jeff's Basic Games page.
User avatar
Mike
Herr VC
Posts: 4887
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Post by Mike »

Jeff-20 wrote:Line 6, part of my main loop, has a long number. Replacing it with a variable should make movement more fast/smooth. [...] Speed isn't really so important in this game, but I like smoother movement. I need to set a variable for 129.
I instrumented line 2 as follows:

Code: Select all

2 T1=T2:T2=TI:I=PEEK(J):T=((IAND4)=.)*L-((IAND8)=.)*L+((IANDP)=.)-1*((PEEK(K)ANDQ)=.)
This allows to measure the time of one game loop by assigning TI of the current loop entry to T2, and the preceding one to T1. Of course, only accurate to jiffy clock steps, and may fail if one unluckily stops the program between 'T1=T2', and 'T2=TI', but this results in T2-T1 = 0, so is easily noticed.

If the dots aren't moved, PRINT T2-T1 gives 4 jiffies.

Moving the dots (also in different directions) got me 7, 7, 7, 7, and 6 jiffies in 5 tries, i.e. ~6.8 jiffies -> 113 milliseconds per game loop.

I then benched this program:

Code: Select all

10 P=1:Q=128:R=129
11 T1=TI:FORT=1TO1000:NEXT:T2=TI
12 T3=TI:FORT=1TO1000:S=R:NEXT:T4=TI
13 T5=TI:FORT=1TO1000:S=R:S=R:NEXT:T6=TI
14 PRINT (T6-T5)-(T4-T3)
15 :
16 REM S=129 -> 213 (3.55 ms)
17 REM S=Q+1 -> 166 (2.77 ms)
18 REM S=Q+P -> 146 (2.43 ms)
19 REM S=R   ->  78 (1.30 ms)
I inserted line 11 so the user can lift off his finger from the RETURN key, so the key scan doesn't slow down the benchmark. Line 12 measures the FOR loop + one assignment, line 13 measures FOR loop + two assignments. Line 14 subtracts those two times taken, effectively giving the time for that extra assignment only, times 1000.

Replacing 129 with a predefined variable gains 2 ms for the main loop of 113 ms. I doubt you'll see any difference.

...

If you want smoother movement, you should consider redesigning the game so the player's figures are moved one pixel at a time rather than one character. One pixel every 20 or 16 ms would give roughly the same pace as with character based movement.

Most probably this requires the game main loop be translated to ML, and maybe also a +3K expansion. If you're interested, I'd take a shot at it. Even though, how should diagonal movements be handled?
User avatar
Jeff-20
Denial Founder
Posts: 5761
Joined: Wed Dec 31, 1969 6:00 pm

Post by Jeff-20 »

Thanks, but no, I think I'm happy with the final version. I'll upload it later today.

I want exact movement so that navigating the maze is easy. I think pixel movement would just be gratuitous.

I decided not to do anything about the high score. As for now, the color and position of the word "high" will have to suffice. ...and I still have over 20 free bytes.
High Scores, Links, and Jeff's Basic Games page.
saehn
Vic 20 Devotee
Posts: 235
Joined: Wed Apr 01, 2009 12:22 pm

Post by saehn »

I like this new version. It's a tiny bit more slick than the old one, which was pretty great too.

It's basically my favorite VIC-20 game ever. </napoleon_dynamite>
saehn
Vic 20 Devotee
Posts: 235
Joined: Wed Apr 01, 2009 12:22 pm

Post by saehn »

Just got a new high score... 177! Previously 99.

Image
User avatar
Jeff-20
Denial Founder
Posts: 5761
Joined: Wed Dec 31, 1969 6:00 pm

Post by Jeff-20 »

Cool! I can't tell if this one is easier, more difficult or the same as the previous version. That beats the old high scores. I'm going to assume you failed on level 4, right? Every third maze is sort of hard.
High Scores, Links, and Jeff's Basic Games page.
saehn
Vic 20 Devotee
Posts: 235
Joined: Wed Apr 01, 2009 12:22 pm

Post by saehn »

Well, I got kind of lucky. Getting past the third level is what got me time after time until that last play. Died on the fourth level, yes!
Boray
Musical Smurf
Posts: 4064
Joined: Mon May 03, 2004 10:47 am

Post by Boray »

Very nice! Shouldn't you call this something else? For example "twenty ten", for the year 2010! (And of course change the year to 2010 as well)...
PRG Starter - a VICE helper / Vic Software (Boray Gammon, SD2IEC music player, Vic Disk Menu, Tribbles, Mega Omega, How Many 8K etc.)
User avatar
Jeff-20
Denial Founder
Posts: 5761
Joined: Wed Dec 31, 1969 6:00 pm

Post by Jeff-20 »

It's not really a sequel. I just combined the two programs (ten ten with ten ten again) and made some superficial changes. So, I guess it's a v2.0 :)

I decided to leave the date 2009 because that's the year I actually made the game. I'm also working on a 3k version for an art project I am making. I'll post pics when I finish.
High Scores, Links, and Jeff's Basic Games page.
User avatar
tokra
Vic 20 Scientist
Posts: 1127
Joined: Tue Apr 27, 2010 5:32 pm
Location: Scheessel, Germany

Post by tokra »

Why not call it "Ten Ten Again Again" or "Ten Ten Yet Again"? ;-)
User avatar
e5frog
Vic 20 Nerd
Posts: 551
Joined: Sat Feb 17, 2007 5:46 pm
Website: http://channelf.se
Location: Sweden
Occupation: Service Engineer

Post by e5frog »

Jeff-20 wrote:Thanks, but no, I think I'm happy with the final version. I'll upload it later today.
Can't find anything to download from here after this message.
My other interest: http://channelf.se
Post Reply