Okay, this might get pretty technical. Many Image Overlay commands are time sensitive. They use SDL_GetTicks() to get current time and, based on that, determine when commands should finish and next ones start.
But DROD renders in a limited number of frames per second, I think it's 60 FPS so I'll assume that's correct. So only every 16(.666...) milliseconds does something get displayed.
This means that from the point of view of the player everything that should happen between those 16 frame should happen. From the point of view of code though, there is a small chance that is not the case. Let me explain.
Suppose you have this Image Overlay script (annotated) used twice in the same room:
SetAlpha 0 // As soon as the image is loaded it is made invisible
Display 504 // Then we wait 504 ms, the 4 in tens is important
SetAlpha 255 // Make it fully visible
Display 500 // And display it for whatever amount of time, it's not important
Assuming there is no lag, after 30 frames 500 millisecond have elapsed. Okay, next frame starts, DROD is calculating things like effects and such, let's say it takes 3.x ms (meaning between 3 and 4, exclusive, milliseconds) to do it.
Then it draws things to the screen. It starts processing the first image overlay. Calls SDL_GetTicks(), it returns 503, end time for our Display command is 504, good, we keep displaying this image.
Let's process the next image overlay. Calls SDL_GetTicks(). Because we were unlucky, the time between the last call to the next call was enough for it to return 504, which means we run the next command and we make the overlay visible.
Which means that for a single frame the player saw only a single image instead of two. Not a deal breaker, but can be annoying when you want to make something pretty in your hold or achieve certain visual effect and a random chance can throw a wrench into your plans.
This could potentially be a problem for different effect if they use SDL_GetTicks() too.
--------
There are two solutions:
1. If there is an universal "
Render frame now"
code, we could just store the value of SDL_GetTicks() there and in other places refer to the value that was stored at that time.
2. Alternatively for this specific problem I suggest that CEffectList::DrawEffects() would make a call to SDL_GetTicks() at the start (or accept it as argument) and all CEffect will just accept the time in the Draw() command.
--------
It's also possible that it's not a situation that can happen because SDL_GetTicks() is smart enough to return the same value each time it's called until a screen was refreshed in which case I jut wasted your time.
@mrimer - thoughts?
____________________________
My website
[Last edited by skell at 10-11-2020 01:15 PM]