Great to see some progress being made on the game. As for speed, this can of course, be overcome by cmopiling the game with Turbo.qbits wrote:
Welcome any reviews on Game and checks on my code where I might have screwed up, not having every platform to test the program on. It should Load and work on most although an original QL will need expanded memory. The QL2k emulator has a clock multiplier assuming x1 is equivalent to original QL hardware speed, the Game will run very slow as expected. At x10 its bearable-ish, x50 that might be acceptable, x500 I have no problems. My best judgement of the QPC2 and SMSQ emulators they are probably running at x1000.
QBITS
However, it would be useful to identify which parts of hte program are slowing the game down. There are some tricks in SuperBASIC which can then help:
a) Integer FOR loops are quicker (although they only work on Minerva and SMSQ/e)
b) Can you use integer variables elsewhere?
c) Some of the FOR loops include INK commands even though the INK colour does not change within the loop. Watch out for extraneous commands such as this, where they can be moved to the outside of the loop.
d) SELECT ON and IF statements can also be speeded up if you ensure that the most likely outcome appears near the start.
e) Move the less used procedures and functions towards the end of the program (as the interpreter always has to search through the listing for the required function / procedure - I cannot recall whether the interpreter retains a lookup table to the location of procedures and functions - it has been some years since I read (and re-read) Jan Jones' book).
f) Move the DATA statements to the very end of the program.
g) Commands such as :
Code: Select all
IF astro(n,7)>0 AND astro(n,5)<3:astro(n,5)=3
Code: Select all
IF astro(n,7)>0: IF astro(n,5)<3:astro(n,5)=3
I always intended to write a section on writing SuperBASIC programs for speed for the SBASIC/SuperBASIC Reference Manual, but never managed to get around to it.