Posted November 25, 2019 by soapbubble
So last time I was working on Morpheus (now almost 3 months ago 😞 I rewrote the canvas renderer to render all scenes in a single canvas rather that one scene per canvas and multiple canvases stacked on top of each other. For a quick refresher, each canvas is a full screen copy of the screen in memory and there can be as many 7 scenes active at once. This means there are 7 copies of entire screen being held in memory, plus all of the source assets. So obviously if we can draw everything on a single canvas always then we save a lot in memory.
However, that code only worked for the 2d scenes and movies, but not for the panoramas, which are drawn in WebGL. So last weekend and now I am working on accomplishing the same task for the 3D scenes namely only use a single WebGL scene for all scenes. I also plan on bringing in the prior work and rendering the 2D scenes in WebGL as well so that when all finished there will be a single WebGL scene for the game.
These changes should drastically reduce the memory footprint of the game which is a problem I believe that was keeping the game from working on iOS devices. In addition, since everything is being rendered in a single scene the bugs I was having where assets were being shared across multiple scenes should be fixable because I will always have access to all assets used everywhere during rendering rather than when I was rendering each scene separately. I haven't exactly fixes those problems, but I do already have code that tracks when assets are being used by multiple scenes.