Tape length limit

Found a bug in R'n'D? Report it here!

Moderators: Flumminator, Zomis

Post Reply
Flumminator
Posts: 184
Joined: Fri Jun 18, 2004 8:08 pm
Location: Germany

Tape length limit

Post by Flumminator »

After a long absence on Rocks'n'Diamonds I recently updated to the newes version and had some fun with it again. (still an awesome game!)

And so it came that I got to play the excellent Zelda2-"level" from Alan Bond (which I can highly recommend to everybody). It is advertised at the Download page with "about 3 hours of gameplay". Well, apparently I am a bit on the slower side and at about 3h 40m, suddenly the tape recording stopped working. First I thought I accidentially hit the stop-button, so I played back with "pause before end" (takes some time for such a tape) and started recording at the end and shortly after it stopped again. And so I learned that Rocks'n'Diamonds has a maximum tape length.

After a short search in the code, I found the potential culprit:

Code: Select all

// values for tape properties
#define MAX_TAPE_LEN        (1000 * FRAMES_PER_SECOND) // max.time x fps


At first, I thought that meant that tapes are limited to 1000 seconds - which struck me as odd, because I've created much longer tapes in the past. But when I assume that only frames with changed input are stored, this would explain why tapes can be longer than 16 minutes, but still be limited.

So though this is not strictly speaking a bug, Holger, would you consider increasing that number for future builds? For re-using my tape, I've just built a version with 10,000 instead of thousand. This should probably be enough for everyone ;) and the additional memory required should ne a non-issue these days.
Flumminator->PostCounter += 1;
User avatar
Holger
Site Admin
Posts: 4073
Joined: Fri Jun 18, 2004 4:13 pm
Location: Germany
Contact:

Re: Tape length limit

Post by Holger »

Hello Flumminator, welcome back to R'n'D and to the forum! :D
And so it came that I got to play the excellent Zelda2-"level" from Alan Bond (which I can highly recommend to everybody).
I totally have to agree -- this one-level set is just awesome, and I think it is Alan Bond's true masterpiece! :)
and at about 3h 40m, suddenly the tape recording stopped working
Oops! :shock:
And so I learned that Rocks'n'Diamonds has a maximum tape length.
Umm ... yes. :?
So though this is not strictly speaking a bug, Holger, would you consider increasing that number for future builds?
Yes, I will do this! Sorry for the inconvenience caused by this limitation, and I am happy to hear that you were at least able to (temporarily) solve this issue for yourself! :-)

I defined this limitation for the tape length at a time where no such levels like "Zelda 2" existed, so the resulting maximum tape length of around a few hours would have been enough for all "classic style" levels ... but not for Zelda 2! (I also played this level, and had a tape length of 42156 (maximum is 50000), but the tape length for me was 3 hours and 57 minutes (so I was even slower :-) ), so it really depends on input events.)

I will fix this for the next version!
User avatar
Holger
Site Admin
Posts: 4073
Joined: Fri Jun 18, 2004 4:13 pm
Location: Germany
Contact:

Re: Tape length limit

Post by Holger »

I've just built a version with 10,000 instead of thousand.
Just added this change to the code.
This should probably be enough for everyone ;)
Yes, this should give maximum tape playing times (depending on recorded input events) of around 30 to 40 hours. :-D
and the additional memory required should be a non-issue these days.
That's right -- the tape buffer now uses 4 MB instead of 400 KB, which should be no problem at all.

However, when I created R'n'D (and the tape functionality was already existing in the very first release version 0.9 in 1995), I used a 486DX/33 with 4 MB RAM, so 400 KB just for recording tapes was a serious amount of memory! ;-)

Never changed it since then ... until now. :-)
Anonycat
Posts: 47
Joined: Thu Mar 27, 2008 4:45 am

Re: Tape length limit

Post by Anonycat »

Assuming every input change were to last for an exact multiple of 255 frames (the maximum that the tape system's run-length encoding can represent), the old limit allowed a maximum theoretical tape time of 70 hours, 49:54.92 before it decides the tape is full and refuses to write anything more (so a little under 3 days). The new limit allows you to have a tape running up to 29 and a half days of sitting motionless with no inputs, provided the level allows you to get away with such a thing.

Interestingly, if I load up a forged tape on a version with the old limit, and have BODY set to a length of 100,002 bytes (50,001 input windows) with an intended runtime of 70h50:00.02, it ends up reading a length of 70h50:01.54, as though it's reading a garbage value of 77 frames for the length of the last window, rather than 1.
Post Reply