The end of the todo list is fast approaching, however the remaining entries each pose their own challenge.
Not every entry from the todo is mentioned here, as there are a dozen minor changes to be made around the codebase.
NewEngine's level rendering works by rendering the level tiles into a buffer.
This buffer is then copied into the display at varying offsets and sizes, as dictated by viewport objects.
Batch, the language NewEngine is written in, slows down logarithmically with the amount of defined variables and values.
Due to this memory limitation, keeping a big level in memory would significantly hurt performance.
The solution to this problem is dynamically loading and unloading segments of the render buffer as needed.
This system is implemented in NewEngine, and is referred to as "render buffer swapping".
Render buffer swapping greatly improves performance, completely tossing the memory usage problem out of the window.
The problem with the current implementation is the need to read new buffer data from the disk.
Reading files from disk every few seconds is generally fine, the problem is needing to load the entire buffer into memory, trimming, then unloading.
Performing such an amount of operations while dealing with possibly 1MB+ of memory without hampering performance is highly unrealistic.
The solution? Render buffer chunking.
This new system splits the render buffer into 32x32 character (4x4 tile) files.
Using smaller files gives us the best of both worlds; creating massive levels, and having far less stutters when reloading the render buffer.
With render buffer chunking, transitioning from chunk to chunk will have almost unnoticably short reload time.
Render buffers are currently handled in a rather messy manner.
There are 4 buffers for each level, those being:
- Temporary monochrome buffer
- Temporary colored buffer
- Persistent monochrome buffer
- Persistent colored buffer
When a tile is modified, the new tile should be rendered into both temporary buffers.
This is done by loading the full colored buffer, making a change, then dumping both buffers.
When a new level is rendered, both temporary buffers are deleted from disk, and are regenerated from the newly loaded persistent buffer.
Unloading data which is no longer actively in use is important for stability, safety, and performance.
When a script sets a temporary variable, the name of this variable will be added to a list.
This list contains the names of every temporary variable NewEngine has defined, and can be quickly unloaded by calling a script.
In NewEngine, rendering an object is as simple as creating an object and appying the sprite
property.
Additionally, an object may be rendered relative to a viewport.
The behavior detailed above currently works as intended.
However, things get tricky when one of the following conditions occur:
- The viewport is no longer in the bottom left of the screen
- The viewport no longer takes up the entire screen in width and/or height
- More than one viewport is present
As can be seen in the screenshot below, both players are rendering on both viewports as intended:
Problems occur when an object sprite position is set to render outside a viewport.
Even though the top player is way outside the bottom viewport's display area, the player is still being rendered unintentionally
This problem persists for the top viewport and the bottom player.
Both problems can be seen below:
Unless plans change, I will not be releasing a game once NewEngine 1.0 is released.
All NewEngine 1.0 will provide at launch, is a stable and (hopefully) bug-free runtime environment for the public to create and run games with.
As for a proper NewEngine project editor, it's in the works and expected to be ready for release late 2023 or early 2024, although this is only a prediction.
An exact release date for NewEngine 1.0 will not be announced until I know for a fact it's stable and polished enough.
Documentation will be available at release here.
This page will also be linked on the NewEngine home page.
And lastly, as for the inactivity on the development blog, I've been holding off the big changes for when the easy stuff is off the todo list.
Expect to see semi-frequent posts during the coming weeks.