Defold 1.9.4 has been released

Defold 1.9.4

Summary

  • NEW: (#9474) The physics contact_point_event now returns the correct contact point
  • NEW: (#9413) Upgrade emscripten to 3.1.65
  • NEW: (#9383) Start work on WebGPU adapter
  • NEW: (#9438) New vmath functions
  • NEW: (#9441) Added a font name to the .glyph_bank generated name
  • NEW: (#9450) Add configurable options for emscripten compiler.
  • NEW: (#8743) Instancing support for models
  • NEW: (#9415) Added font glyph api to dmSDK
  • NEW: (#9388) Improved Debug->Simulate Resolution functionality
  • NEW: (#9393) Show logs from a selected target in the editor’s console
  • NEW: (#9440) Build only the WASM version of the engine when running Build HTML5
  • FIX: (#464) Fix issues building certain combinations of pod dependencies
  • FIX: (#9414) Added dmUtf8 to dmSDK
  • FIX: (#9477) Added android:appCategory="game" into AndroidManifest.xml
  • FIX: (#9483) Fix the build report in JSON format.
  • FIX: (#9487) Updated zlib to 1.3.1.1
  • FIX: (#9511) Fix editor-related build scripts on windows
  • FIX: (#9532) Fix for double destroying the timer callback
  • FIX: (#9539) Fixed rare crash when reaching max number of animations
  • FIX: (#9419) Retain gui overrides if the template gui scene is modified externally
  • FIX: (#9426) Fix the issue where the hash script property can’t be reversed
  • FIX: (#9425) Fix text sync with language servers
  • FIX: (#9429) Better handling of errors in tilemaps when the tilesource is broken.
  • FIX: (#9444) Fix the detection of require in a tail function call by the editor.
  • FIX: (#9510) Make the building artifacts independent for the Build HTML5 and Build options
  • NEW: (#9531) Add editor.bob() function to editor scripts

Engine

NEW: (#9474) The physics contact_point_event now returns the correct contact point
This is a bug fix for the contact_point_event, where the position is now the contact point itself.
This makes it similar to the contact_point_response event, which was the intention.

If you need the old position (the world position of the object itself), you can use either message.a.instance_position/message.b.instance_position.

NEW: (#9413) Upgrade emscripten to 3.1.65
Emscripten has been updated to 3.1.65 from 3.1.55. This is a prerequisite for the coming WebGPU support

NEW: (#9383) Start work on WebGPU adapter
WebGPU has been added as an experimental graphics backend for web platforms. To test WebGPU, run bob.jar with the following commands in the project folder of your project:

java -jar path-to-latest-bob.jar build bundle --archive --platform=js-web --debug-output-wgsl=true

Note that this is a technical preview of our WebGPU support, and some things are not yet implemented. It is not recommended to publish an application yet that uses this backend, but it is encouraged to try it out!

NEW: (#9438) New vmath functions
Added new vmath functions:

  • vmath.quat_matrix4 - get quaternion from matrix4
  • vmath.matrix4_compose - create matrix4 from translation (vector3|vector4), rotation (quaternion) and scale (vector3)
  • vmath.matrix4_scale - create matrix4 from scale (vector3) or from number (uniform scale) or 3 number (x, y, z)
  • vmath.clamp - clamp input value in range [min, max]. Input value can be number, vector, vector3, vector4. In case of vector type clamp applies per vector component. min, max also can be number, vector, vector3, vector4.

NEW: (#9441) Added a font name to the .glyph_bank generated name
The .glyph_bank filename now includes the name of the font used for glyph bank generation.

NEW: (#9450) Add configurable options for emscripten compiler.
Add options to application manifest to control stack size (stackSize)/overall memory size (initialMemory)/minimum supported browser versions (minSafariVersion/minChromeVersion/minFirefoxVersion). In some cases it can help to reduce binary size because Emscripten doesn’t apply code-generation for supporting old browsers.

NEW: (#8743) Instancing support for models
Model components can now use hardware instancing! This means that models that share the same mesh but has its own transform and normal matrices can now be rendered with a single draw call instead of individual draw calls. This is useful for repeated geometry, such as trees, foliage, static props such as trash cans, boxes or even complete buildings.

The simplest route to start using instancing is to add an attribute in the vertex shader that holds the world matrix, or a normal matrix:

attribute mat4 mtx_world;
attribute mat4 mtx_normal;

When any attribute is marked as an instanced attribute, instanced draw calls will automatically be created. This also works for custom vertex attributes. Here’s an example of using an custom instanced attribute for storing an individual tint attribute per model:

The color attribute in this case has its vertex step function marked as instance in the material, which means that this attribute will be repeated per instance instead of per vertex:

This enables us to draw all boxes with just one draw call instead of 4, even with custom vertex data per model!

To read more about instancing in Defold, please consult the Manual entry.

A simple example that shows how to use the new functionality is available here:
instancing-test.zip

FIX: (#464) Fix issues building certain combinations of pod dependencies
This issue fixes issues when building for instance the Yandex SDK

Fixes #389

FIX: (#9414) Added dmUtf8 to dmSDK
This allows native extensions to easily convert utf8 strings into codepoints, for use with e.g. font generation.
The header file is located at <dmsdk/dlib/utf8.h>

FIX: (#9477) Added android:appCategory="game" into AndroidManifest.xml
Google Play requires the android:appCategory attribute in the AndroidManifest.xml. Since Defold is a game engine, we have added android:appCategory="game" into the default AndroidManifest.xml.

If you need a different category for your app, create a custom manifest and choose the appropriate category: https://developer.android.com/reference/android/R.attr.html#appCategory.

[!WARNING]
If you already have a custom AndroidManifest.xml, please take note of these changes.

FIX: (#9483) Fix the build report in JSON format.
Fix the issue where the build report in JSON format is not being generated.

FIX: (#9487) Updated zlib to 1.3.1.1

FIX: (#9511) Fix editor-related build scripts on windows
When running on Windows (MinGW), invoking run.command didn’t forward the env variables to the program. Previously, we had a code that did env JAVA_CMD=.../bin/java bash ./scripts/lein ..., and I removed it in favor of using the env = lein_env kwarg without knowing about the implications for Windows. Restoring.

FIX: (#9532) Fix for double destroying the timer callback
In rare cases, the timer callback was destroyed twice, causing a crash

Editor

NEW: (#9415) Added font glyph api to dmSDK
We’ve added a api to our dmSDK for manipulating font resources.
This allows for writing extensions such as extension-font, making it possible to avoid storing large amounts of pre rendered glyph images in the default game, and instead generate them at runtime.

The api has been added to dmsdk/gamesys/resources/res_font.h.

#include <dmsdk/gamesys/resources/res_font.h>

dmRender::HFont    dmGameSystem::ResFontGetHandle(FontResource* font);
dmResource::Result dmGameSystem::ResFontGetInfo(FontResource* font, FontInfo* info);
dmResource::Result dmGameSystem::ResFontGetCacheCellInfo(FontResource* font, uint32_t* width, uint32_t* height, uint32_t* max_ascent);
bool               dmGameSystem::ResFontHasGlyph(FontResource* font, uint32_t codepoint);
dmResource::Result dmGameSystem::ResFontAddGlyph(FontResource* font, uint32_t codepoint, FontGlyph* glyph, void* imagedata, uint32_t imagedatasize);
dmResource::Result dmGameSystem::ResFontRemoveGlyph(FontResource* font, uint32_t codepoint);

NEW: (#9388) Improved Debug->Simulate Resolution functionality
A few improvements were made to the Debug->Simulate Resolution functionality in the editor:

  • The selected resolution is now saved for a project, including custom resolutions.
  • The selected resolution is applied every time the engine starts.
  • A few new iPhone devices and a new “Handheld” section were added.
  • Resolution simulation now works for all launched instances.

NEW: (#9393) Show logs from a selected target in the editor’s console
When a remote target is selected, the editor tries to connect to the target’s log service to display them in the console.

NEW: (#9440) Build only the WASM version of the engine when running Build HTML5
Building two versions of the engine can take a long time, and considering that WASM is supported by 100% of modern browsers, it doesn’t make sense to build both versions every time a developer wants to test a game.
From now on, Build HTML5 will build only the wasm version of the engine.

FIX: (#9419) Retain gui overrides if the template gui scene is modified externally
Fixed an issue where gui node property overrides would be lost from referencing .gui files if the referenced template .gui file was modified by an external process.

FIX: (#9426) Fix the issue where the hash script property can’t be reversed
Hash values can be reversed to their string equivalents in Debug builds, simplifying the development process. This fix makes hashes added in go.property() reversible as well.

FIX: (#9425) Fix text sync with language servers

FIX: (#9429) Better handling of errors in tilemaps when the tilesource is broken.
If a tilemap uses a tilesource without a texture, it’s impossible to show the palette, which previously resulted in an error.

FIX: (#9444) Fix the detection of require in a tail function call by the editor.
Fixed an issue where using a tail call with require was impossible in the editor:

local result = require("my_module").call(42)

FIX: (#9510) Make the building artifacts independent for the Build HTML5 and Build options
From now on, the Build HTML5 and Build options produce separate build artifact folders in the build directory. This means alternating between these options will no longer require rebuilding the project from scratch each time, speeding up the workflow for HTML5 testing.

NEW: (#9531) Add editor.bob() function to editor scripts

Now you can perform bob tasks using editor scripts. Some examples:

  1. Print help in the console:
    editor.bob({help = true})
    
  2. Bundle the game for the host platform:
    local opts = {
        archive = true,
        platform = editor.platform
    }
    editor.bob(opts, "distclean", "resolve", "build", "bundle")
    
  3. Use a custom build server and extra settings files for overriding game.project settings:
    local opts = {
        archive = true,
        platform = editor.platform,
        build_server = "https://build.my-company.com",
        settings = {"test.ini", "headless.ini"}
    }
    editor.bob(opts, "distclean", "resolve", "build")
    
20 Likes

Thank you so much for another great release! I appreciate those a lot:
Build only the WASM version of the engine when running Build HTML5
Make the building artifacts independent for the Build HTML5 and Build options

2 Likes

The editor is crushing on this version on one of my projects. I investigated the issue and found that the source of the crush was one model. I can share it via Discord. It crushes not only on build but even if you try to open it.

Even better if you share it here or on GitHub. You can put it in a zip archive before uploading.

3 Likes

Thank you! :blush:

I have a material with two textures that was visible in the build but not visible in the editor with 1.9.3. I have already reported this in

Now with 1.9.4 the material is not visible also in the build. @jhonny.goransson

EDIT: I see no error nor warning in the console about the related shaders.

EDIT2: I managed to get the material working again in the build. I changed the Coordinate Space value for the vertex attribute position from Local to World. However, it is still not visible in the editor.

I don’t quite understand what the general ‘vertex space’ world / local option for the whole material is for since each vertex attribute now has its own option for the coordinate space it refers to.

1 Like

I’m having this issue but in reverse. I am having a 3d model appear in the editor but not in the build

Editor:

Build:

Please create a bug report on GitHub and include a small project with the model

Heh, I didn’t know that I could share ZIP.

Here the model

sea_thief_M.zip (21.1 KB)

Edit: I found the source of the issue issue. I tried re-export the model to collada and gуе the error that the model has multiple root - bones.
So, the workaround makes only one root bone.
Anyway, It would be great if that gltf exporter did not crush the Editor =)

Снимок экрана 2024-10-22 в 14.36.08


1 Like

Hi!
Thanks for reporting!
Which version of the editor are you using?
Also, as we weren’t able to reproduce this before releasing, do you have a repro case you could share with us?

image
unfortunately there is no example, this was seen on a working quiz project.

1 Like

Can you reproduce it in this project? What kind of fonts are you using? How are the fonts configured?

It happens at some point when I switch between screens via monarch.



1 Like

Chat GPT recomended use those parameters…

cache_width: 2048
cache_height: 4096

and gradually reduce them to find a balance between memory usage and performance. After that, the problem disappeared.

Everything looks like the cache width and height stopped being set automatically when the values are set to 0.

It would be nice if you share a repro case project (it would be enough to create a project with this font and one big text field that uses most of the glyphs).
Using 0/0 for Cache Width and Height should be the default way to keep it up to our build system to calculate the optimal size.

1 Like
3 Likes

Thanks for adding a ticket and a repro case!
WHile we did change the internal code, the cache should have worked the same way as before.
I’ll look into it tomorrow morning!

2 Likes

My another project also crush I have create ticket

1 Like