Is it possible to combat the speed of a library that you don’t control?

As mentioned in Welcome to The RainEngine, I’m using the ASGE (AwesomeSauceGameEngine) for my 2D engine (which will be taking up roughly 80% of my time on the assignment, but I believe it’s worth it). The engine is extremely basic and isn’t optimized, that means that it can be slow when faced with a load it wasn’t explicitly designed for.

Take one million objects for example.

With 1m objects, the engine’s speed decreases to around .25 frames per second. This can be combated by running the built program in Release mode instead of Debug mode (where that increases to 43 frames per second, which is workable) but of course that means that it’s not possible to (easily) debug the program.

The problem lies in the engine’s renderer, specifically a loop in the render API function override where I loop over all 1m objects and tell the engine to render. This isn’t something that can easily be fixed on my side as utilizing threading wouldn’t work as it would require cross-thread communication, and detaching the thread from the main thread so that the slowness of the renderer (which will happen regardless) doesn’t slow the pre-render down. That also means that other techniques such as CUDA are out of the question.

That doesn’t rule-out the use of these techniques to speed-up other parts of the program, such as the simulation of each rain particle. I’m considering using Nvidia CUDA for that, but that would also mean that RE wouldn’t be able to run on computers not equipped with a Nvidia GPU.

For now I’ll settle with the 43FPS for production (showing off the engine) and I’ll simply have to decrease the amount of particles when working in Debug mode…

 

Leave a Reply

Your email address will not be published. Required fields are marked *