Ñ SPEED BY RICHARD MARTIN ----------------------- § Hello Again WAC readers. In this article I am going to give you a few pointers onto the problems I have occured and how I got around them and some of the useful methods of programming games. This is an old chestnut for all AMOS users. How to get your programs to run fast. Well to start with I`ll start off explaining WHY AMOS is slower than Blitz 2 normally. AMOS is an interpreted laungage. Blitz is compiled. BASIC is in many respects simular to a conventional laungage such as Latin or English. The most skilled programers can read a computer laungage as if it was English! So Imagine you are in France and know no French. But you do have a French translation guide. A French man comes up to you and says "Bonjour Monsieur!". If you knew no French you would have to look it up. AMOS is like this. Every command you tell it do it converts it machine code. It TRANSLATES it. A compiled laungage is the same as someone spending a while learning a laungage and then when someone asks them a question they can respond instantly. But I am not trying to get you all to buy Blitz. (personally I Hate Blitz) but it means that these AMOS vs Blitz comparisons are a little biased. AMOS has a compiler which lets you protect your source and lets AMOS LEARN your program. ¦ Anyway, away from the lecture. There are some ways to speed up your program even when it is interpreted. The first is to update parts of your program that do not to be checked every loop fewer times. Type in these examples that follow and see what happens. ` SLOW EXAMPLE. CLS 0 INK 2,0,0 BOX 50,50 TO 75,75 GETBOB 1,50,50 TO 75,75 INK 6,0,0 CIRCLE 100,100,25 GETBOB 2,75,75 TO 125,125 ` SCORE=0 X=0 Y=0 DOUBLE BUFFER BOB 2,RND(320),RND(200),2 DO IF JUP(1) Y=Y-1 ENDIF IF JDOWN(1) Y=Y+2 ENDIF IF JLEFT(1) X=X-1 ENDIF IF JRIGHT(1) X=X+1 ENDIF IF BOBCOL(1,2 TO 2) BELL INC SCORE BOB 2,RND(320),RND(200,2 WAIT VBL END IF INK 0,0,0 BAR 0,0 TO 100,12 LOCATE 0,0 PRINT SCORE BOB 1,X,Y,1 WAIT VBL LOOP Ï You will notice that the above example is dreadfully slow and it is nearly impossible to get the square to touch the circle. Now add these lines. just after the Do Add: INC COUNTER And before Ink 0,0,0 add the extra lines so it looks like. IF COUNTER=10 INK 0,0,0 BAR0,0 TO 100,12 LOCATE 0,0 PRINT SCORE COUNTER=0 END IF Now rerun the program. It should update 5 times a second and be faster than it was before. In updating the score we can go a step further by only updatinging it when there is a change in it. But I have not the time or space ( I am not sure how much text Pauls Engine lets a doc be in length) so I`ll explain in the code. They should be on the disk label SPEEDEX1.AMOS ,SPEEDEX2.AMOS and (you guessed it) SPEEDEX3.AMOS. I hope to continue this article if Paul will let me. Richard Martin.