At the fourth week I have done:
- reworked sound system( now volume from objects attributes is used)
- implemented sound balance depending on sprite position.
- implemented dirty rectangles
- various fixes
Earlier engine was redrawing full screen each frame when smth updated. This was very ineffective.
An interesting thing that the original engine consumes full core of CPU. Probably it hasn’t any delay or just redraws screen each frame.
I have implemented various ways of effective drawing and compared their performance.
- Redraw only parts of the temporary screen, but make a full copy to the system. When sprite updates it is redrawn and intersecting parts of other sprites.
- Same as previous, but only dirty rectangles are copied to the system.
- When sprite updates, get dirty rectangles from decoder, merge them and redraw to the temporary surface. Then to the system. This method can be worse than simpler methods if there are too many dirty rectangles, which can’t be unioned. To solve this, a sprite must be redrawn fully if there are more than 100 – 200 rectangles.
I have compiled ScummVM in release mode with optimizations and set delay 5 ms. This means that maximum FPS will be 200.
Not big gain using dirty rectangles from decoder, but a huge improvement from dirty rectangles which are copied to the system because scalers redraw only parts which are changed.