QuirkyCort / gears

Generic Educational Robotics Simulator
Other
65 stars 41 forks source link

Add UI control to reduce rendering resolution for low end or high density devices #76

Open germanicianus opened 3 years ago

germanicianus commented 3 years ago

Reducing the rendering resolution makes it possible to either save battery (see also #75) or to increase FPS - depending on the needs. Examples with default world - approximate FPS:

Some info (if needed): https://www.html5gamedevs.com/topic/22907-how-to-control-enginecanvas-screen-resolution/

QuirkyCort commented 3 years ago

I've put in some optimizer code, you can enable it from the console with "babylon.optimizer.start()".

From my tests on a slow laptop, the optimizer didn't make much of a difference in the FPS (...from around 30 to around 40), despite a very aggressive (...and ugly) reduction in resolution. More importantly, the robot behaviour didn't improve and seems even worse, but I haven't done enough testing for this to be conclusive.

The biggest issue with slow systems is that the robot tends to miss detecting lines using the color sensor. In game worlds like WRO or Fire Rescue, this means that it'll miss detecting a junction. This is a far more serious problem than FPS and is the primary concern for any performance related changes.

germanicianus commented 3 years ago

@QuirkyCort, do the visual rendering and robot simulation run independently? I didn't have an in-depth look into the code. I ask because you wrote:

The biggest issue with slow systems is that the robot tends to miss detecting lines using the color sensor. [...] This is a far more serious problem than FPS and is the primary concern for any performance related changes.

QuirkyCort commented 3 years ago

They are not independent. The robot simulation requires the rendering to take place, as it relies on the rendering to determine what the color sensor sees. There are many other places where the rendering and simulation are linked, but those can be separated with (...a lot) of work.