1. Play and change
Task: stay on method C, set the "step cap" to 1 frame, and add enemies. From how many enemies does it slow down? Does the jump height change then?
Answer and reasoning
(With 60 screen draws per second and machine power 20) it starts at 21 enemies. With a cap of 1, each screen can only move 1 frame forward, so the work per loop is "drawing 0.8 + moving 0.2" × enemies = the number of enemies. Above 20 it no longer fits in 1 frame and slows down just like method A. The jump height stays at 3.87 squares (the step is always 1/60 s). Set the cap back to 8 and it keeps normal speed up to 66 enemies and slows from 67 (at 100 enemies, moving alone uses up all the machine power).2. Compare the 3 methods with the same input recording
An input recording that runs right, jumps to a platform 3.6 squares high and shoots at a wall (1 square thick) is calculated with A, B and C, using the "enemies, screen draws, machine power, step cap" set above.
| Clock speed | At 3 s | Peak | Platform | Bullet |
|---|
Positions and heights are in squares. The video's settings are "50 enemies, 30 draws/s, machine power 20, cap 8" (A runs at 1/4 speed, B reaches only 3.48 squares and the bullet passes through, C reaches 3.87 squares).
3. Make your own: sample code
A single HTML file with one square and one wall where you can try all 3 methods. Download sample.html and just open it in a browser (open it here). Change MODE to 'A', 'B' or 'C', and use the "weight" slider to slow down each loop on purpose. (The comments in the code are in Japanese.)
Loading…