Dbug wrote:
To my knowledge it's the only (so far) vsync controlled double buffered animation done on the Oric
Yep, I think it is the only one. Am I wrong or it made use of the vsync hack only (no option for software calibration for those not having the cable)? I might offer both possibilities, as IIRC you can detect if the vsync cable is present...
I have been tidying things up a bit in my code so I can make further testing. I put another three ships moving around and timed the main engine routines:
clearing the backbuffer: 3650 cycles
rendering the background: 7763 cycles
painting sprites (5, as the shadow under the hero is a sprite): 7454 cycles
dumping everything: 6053 cycles.
That is something a bit above 25000 cycles, so 40 fps are possible, but 50 are not. That means that, when I add the waiting for synchronizing with the vertical retrace, it takes nearly 15000 cycles and the result is a game at 25 fps.
(Yeah, I know I can do some optimization but I doubt, with all the extra stuff needed in a game, I could keep at 50 fps.)
It is taking me around 1500 cycles per 2x2 sprite, so I think that, even adding the AI and other details, I should be able to manage 5-7 enemies while keeping the frame rate at 25 fps. This is the first time I deal with synchronization with the retrace, so I am not sure if I am being optimistic.
I was about to post another video, but I need to face a horrible bug I am experiencing. The speed of the hero defines when to scroll, usually every n game frames (n being something 2,3, or 4; 1 is reserved for shots, which must be the quickest thing). Enemies also have a speed, which moves them around the map.
The thing is that it is possible to have a situation in which you update the enemies, moving them one square to the right while it is no time to scroll yet; then, at the following frame, you scroll and they don't move, so there is an ugly effect if this repeats, as if they moved back and forth.
There must be some obvious solution for this... I know scroll must be synchronized with enemy movement to avoid this error, but you want your hero to accelerate/decelerate, so you get out of sync quite easily.