Currently, we have only one camera, the camera associated with the player. It is on my todolist for the renderer to be able to switch from one camera to another, paving the way for the concept of multiple cameras. However, as per current code, switching cameras would likely trigger a partial or complete regeneration of the world around the new active camera. From a user perspective the world would effectively disappear and then reappear as it does on startup.
To prevent this, I'm considering associating a RenderableWorld instance with each camera. Implementations of this interface keep up to date a number of chunk lists and chunk queues dependent on the camera position. The renderer then uses those to display the world on screen. Switching camera would then switch the RenderableWorld instance the renderer can chew on. And as the RenderableWorld instances would be persistent between switches, switching cameras would not trigger regeneration: a renderable world for that camera would always be there.
Of course this would take more memory as there would be more regions/chunks of the world loaded at the same time. This could be partially mitigated perhaps by automatically reducing the ViewDistance of a camera when it becomes inactive to some shorter range, to reinstate it when it becomes active again. This way a number of chunks would be unloaded while those in the immediate vicinity of the inactivated camera would remain available. Also, at this stage I'm not sure how multiple instances of RenderableWorld would really work together. Perhaps a higher-level entity would be necessary to prevent disposal of a chunk no longer needed by one instance if other instances are still using it.
Thoughts?
To prevent this, I'm considering associating a RenderableWorld instance with each camera. Implementations of this interface keep up to date a number of chunk lists and chunk queues dependent on the camera position. The renderer then uses those to display the world on screen. Switching camera would then switch the RenderableWorld instance the renderer can chew on. And as the RenderableWorld instances would be persistent between switches, switching cameras would not trigger regeneration: a renderable world for that camera would always be there.
Of course this would take more memory as there would be more regions/chunks of the world loaded at the same time. This could be partially mitigated perhaps by automatically reducing the ViewDistance of a camera when it becomes inactive to some shorter range, to reinstate it when it becomes active again. This way a number of chunks would be unloaded while those in the immediate vicinity of the inactivated camera would remain available. Also, at this stage I'm not sure how multiple instances of RenderableWorld would really work together. Perhaps a higher-level entity would be necessary to prevent disposal of a chunk no longer needed by one instance if other instances are still using it.
Thoughts?
Last edited: