the-infocom-files/bureaucracy

Runs too fast on modern computers

Opened this issue · 2 comments

This was reported at https://gitlab.com/DavidGriffith/frotz/-/issues/234 by @eriktorbjorn:

Near the end of Bureaucracy, you get to connect to the hacker's computer. Throughout this puzzle, there are several cases where the game is supposed to delay for a second or two, e.g. right when you first connect:

	 <HLIGHT ,H-NORMAL>
	 <DUMP-STRING "CONNECTION IN PROGRESS...." T>
	 <DELAY 1>
	 <SET-COMPUTER-CURS 2 0>
	 <DUMP-STRING "CONNECTED TO DVH2 NODE 0106. WAITING." T>
	 <DELAY 1>

The DELAY routine, horribly, is implemented like this:

<CONSTANT DELAYS <PTABLE (BYTE) 1 ; "ZIL"
                         10     ; "ZIP20"
                         1      ; "APPLE II"
                         4      ; "MAC"
                         4      ; "AMIGA"
                         4      ; "ST"
                         1      ; "COMPAQ/PC"
                         1      ; "128"
                         1      ; "64...">>

<DEFINE DELAY ("OPT" (SEC:FIX 1) "AUX" (N:FIX <GETB ,DELAYS <LOWCORE INTID>>))
  ; "N is number of 1000s to count down to get 1-sec. delay"
  <SET N <* 1000 .N .SEC>>
  <REPEAT ()
    <COND (<L=? <SET N <- .N 1>> 0> <RETURN>)>>>

That is, it uses a busy-wait loop and hard-codes how many iterations it needs for every interpreter to get approximately a one-second delay. Of course, this does not work on modern hardware. I don't know why they didn't use timed input - which I think should have been available to them by then - but the game did have a long and troubled development history...

Now @DavidGriffith speaking... Could this be repaired in the ZIL code by redoing the DELAY routine using timed input as suggested in the above paragraph?

I haven't tried it yet, but I plan on experimenting with it when I get around to testing Bureaucracy unless someone beats me to it. Since I'm testing them in chronological order, that's at least a few months away though. (I'm not quite done with Leather Goddesses of Phobos, and I still have Moonmist and Hollywood Hijinx to get through before I get to Bureaucracy.)

By the way, thanks for filing this bug report. I meant to, but forgot about it. :-)

Here's a suggestion:

<DEFINE DELAY ("OPT" (SEC:FIX 1))
	;"Wait for input SEC s ((SEC x 10) x 0.1 s) then call a routine that 
	  returns true and aborts the input."
	<INPUT 1 <* .SEC 10> ABORT-WAIT>		
	<RETURN>>

<ROUTINE ABORT-WAIT () <RTRUE>>

Havn't tried it yet, but building a copy now with the other changes to see if it fixes them.