Consistent Render Buffers


One of the biggest optimization techniques left to be implemented in NewEngine is render buffer chunking.

While it's tempting to implement this now, some things must first be cleaned up or reworked.


Some things need to be explained first.

The directories /cache/ and /temp/ are for storing persistent and temporary render buffer files, respectably.


As mentioned in the previous development blog post, render buffers are currently handled in a messy manner.

The new methods of handling render buffers is as follows:




Rendering levels

While the level rendering code remains the same, a call to createRenderBuffers.bat has been added.

This script will first copy the newly created render buffer from /cache/ over to /temp/.

Since NewEngine needs different buffers for colored and monochrome rendering, the colored buffer in /temp/ is copied, and converted to monochrome.




Modifying tiles

Creation of alternate render buffers has been simplified here as well.

Previously, the buffer to be modified would depend on whether color rendering was enabled.

This process has been updated to always render into the temporary colored buffer.

Once the modification has been made, the new colored buffer in /temp/ is copied, and converted to monochrome, same as the last step of the above paragraph.




Saving levels

Along with modified level tile data, the modified render buffer must also be saved.

First, every saved render buffer for the current level is deleted, except for the colored render buffer inside /temp/.

The only remaining render buffer is then copied into /cache/, where it becomes the new persistent render buffer.

Since the state of /cache/ and /temp/ are now the same as when a level has just been rendered, one last call to createRenderBuffers.bat is made.