The biggest change this release is the improved support for the different timesteps between the game update loop and the physics update loop.
The goal is to have the game using vsync, and use the delta time between the display refreshes as the dt for the game loop. This will fix the issues we’ve seen with game running on displays with variable frame rates (or rates > 60hz).
The display.update_frequency (default is 0) variable has changed somewhat, and is only limiting the frame rate if it’s lower than the current refresh rate of the display. E.g. it can be useful to limit the frequency to something low (like 30) to simulate the behavior of for instance a KaiOS device.
The fixed physics update is off by default, in order to stay compatible with the old behavior.
These are the relevant settings:
60
0
means it’s disabled30
or 60
Hz0
(false) is default0
means variable frame rate (default)1
for new projects0
means variable frame rate (default)> 0
means fixed frame rate. Capped at runtime towards the actual frame rate. I.e. you cannot update the game loop twice in an engine frame.30
to simulate the frame rate of KaiOS.0
disables vsync1
We’ve added a fixed_update(self, dt)
life cycle function to the game object scripts. When using fixed timesteps for the physics, this is where you’ll want to add the forces to your game objects, in order to keep in sync with the physics updates.
We’ve added support for frustum culling. In this initial version of the feature, it’s only used for sprites. Expected benefits are reduced vertex buffer sizes (saving GPU bandwidth), and reduced number of draw calls (depending on projects).
Frustum culling is enabled by default in the default.render_script. If you have a custom render script, you need to create a frustum matrix, and pass it into your render.draw()
calls.
In this initial version of the feature, it’s only used for sprites. Expected benefits are reduced vertex buffer sizes (saving GPU bandwidth), and reduced number of draw calls (depending on projects).
Frustum culling is enabled by default in the default.render_script. If you have a custom render script, you need to create a frustum matrix, and pass it into your render.draw()
calls.
The display.vsync
is now deprecated, in favor of display.swap_interval
:
display.swap_interval
(integer) Sets the OpenGL swap interval (new property)
display.vsync
- deprecated. Set to false to force a display.swap_interval = 0
display.update_frequency
Message set_update_frequency
to control the display.update_frequency
at runtime.
Fixes issue when showing any activity in foreground paused the game loop on Android. It might be any activity: Ads, webview, alarm indication, a status icon popup, etc.
If the game loop paused work extensions can’t receive messages from the native side which is important for communication Lua<->C++<->Java.
This adds three new functions to the dmGraphics
API:
bool IsExtensionSupported(HContext context, const char* extension);
uint32_t GetNumSupportedExtensions(HContext context);
const char* GetSupportedExtension(HContext context, uint32_t index);
The following constants are set if supported on the device and are otherwise nil if not supported:
Fixes issue when application crashes on start because of AVFAudio
framework. Minimum iOS version increased to 9.0, it’s a requirement for Xcode 13. Info.plist
file updated. If you use custom Info.plist
make sure you apply the same change for MinimumOSVersion
.
The option to stream the .wasm file in HTML5 builds was introduced and made the default option in Defold 1.2.130. This option will load faster and use less memory, but it requirers the server to respond with content type “application/wasm” for it to work. This change makes the wasm streaming option an opt-in instead of the default for HTML5 build. It is now possible to enable wasm streaming via the html5.wasm_streaming
game.project option.
When a GUI scene is created each textured box node with an implicit one frame flipbook animation will generate an internal animation reference. This is a problem in complex GUI scenes where these animations take up animation slots towards the max animation count (currently 1024). This is not necessarily a problem but if there are a lot of these nodes and they are disabled in the init()
function of an attached gui_script
it means that the animations will not complete until the node is enabled.
This fix adds a check on scene creation for all textured box nodes with one frame animation and completes these animations immediately.
In HTML5 builds if a font is created with outline and shadow alpha set to 0 it still renders the outline behind the font if the font face itself is (semi-)transparent. The problem was caused by a difference in texture format between different platforms (GL_LUMINANCE vs GL_RED) and how these are sampled in the shader, (L,L,L,1) vs (R,0,0,1). This, combined with the fact that if the font was a bitmap ttf font, the face, outline and shadow alpha weren’t copied to the compiled font, was the cause of the problem.
When using tilemap.set_tile()
we currently broadcast a message to all collision components on the same game object that a tile was changed. This is potentially problematic if there are multiple collision components referencing different tilemaps as their shapes because all collision components will react to the message and update, regardless if they used the same tilemap shape or not. What’s worse is if the tilemaps have different number of layers it will in fact result in a crash.
This kind of very loose coupling between tilemaps and collision components is unfortunate and does only really work well in a scenario where you have ONE tilemap and ONE collision component using the tilemap as its shape. Solving this design flaw is not covered by this fix which only adds improved error handling to avoid a crash.
Child game objects containing convex collision shapes were not correctly scaled when created using a collection factory. Previously only the first four vertices of the shape were scaled. This works for a box shape but obviously not for a more complex shape.
Some device configurations can change during runtime (such as screen orientation, keyboard availability, global font size, etc). When such a change occurs, Android restarts the running game Activity. This behavior may be a reason for immediate app closing that looks like a crash and sometimes the reason for ANRs.
This fix adds all possible configuration changes into the lists configuration changes that the activity will handle itself (android:configChanges
in AndroidManifest.xml
)
AndroidManifest.xml
has changed. Make sure you have these changes in your custom AndroidManifest.xml
if you use one.
Our Clojure plugin system expect Clojure files to return a function to call when the plugin is loaded. Previously the editor crashed if a Clojure file didn’t return a function. With this fix the editor will handle this and log that it failed to load the plugin.
The duration of a particle emitter can be configured to go below 0 if using a spread value larger than the duration. If this happens while previewing a particle fx animation in the editor the whole editor will freeze. Using a negative duration at runtime should also not be allowed. This fix will prevent the duration from becoming negative.