Defold 1.10.0 BETA

I had a crash while testing one of the assets. This might be related to the model, but I would like to share it.

Assets: KayKit - Character Pack : Skeletons by Kay Lousberg

Vertex attribute bone_weights(3) is missing from the vertex descriptor.
ERROR:GRAPHICS: Vulkan Error (../src/vulkan/graphics_vulkan.cpp:1631) VK_ERROR_INITIALIZATION_FAILED
Assertion failed: (0), function GetOrCreatePipeline, file graphics_vulkan.cpp, line 1631.
0   libsystem_kernel.dylib        	       0x18697f720 __pthread_kill + 8
1   libsystem_pthread.dylib       	       0x1869b7f70 pthread_kill + 288
2   libsystem_c.dylib             	       0x1868c499c __abort + 136
3   libsystem_c.dylib             	       0x1868c4914 abort + 140
4   libsystem_c.dylib             	       0x1868c3c1c __assert_rtn + 284
5   dmengine                      	       0x103172688 dmGraphics::DrawSetup(dmGraphics::VulkanContext*, VkCommandBuffer_T*, dmGraphics::ScratchBuffer*, dmGraphics::DeviceBuffer*, dmGraphics::Type) (.cold.3) + 88
6   dmengine                      	       0x102e9e29c dmGraphics::DrawSetup(dmGraphics::VulkanContext*, VkCommandBuffer_T*, dmGraphics::ScratchBuffer*, dmGraphics::DeviceBuffer*, dmGraphics::Type) + 1536
7   dmengine                      	       0x102e9a820 dmGraphics::VulkanDrawElements(void*, dmGraphics::PrimitiveType, unsigned int, unsigned int, dmGraphics::Type, unsigned long, unsigned int) + 236
8   dmengine                      	       0x102d4c6e0 dmRender::Draw(dmRender::RenderContext*, dmRender::Predicate*, dmRender::NamedConstantBuffer*) + 1152
9   dmengine                      	       0x102d4c198 dmRender::DrawRenderList(dmRender::RenderContext*, dmRender::Predicate*, dmRender::NamedConstantBuffer*, dmRender::FrustumOptions const*) + 3144
10  dmengine                      	       0x102d4eda8 dmRender::ParseCommands(dmRender::RenderContext*, dmRender::Command*, unsigned int) + 632
11  dmengine                      	       0x102d536cc dmRender::UpdateRenderScriptInstance(dmRender::RenderScriptInstance*, float) + 144
12  dmengine                      	       0x102c357c4 dmEngine::Step(dmEngine::Engine*) + 1292
13  dmengine                      	       0x102c35dd0 dmEngineUpdate(dmEngine::Engine*) + 32
14  dmengine                      	       0x102c36ba8 dmEngine::RunLoop(dmEngine::RunLoopParams const*) + 104
15  dmengine                      	       0x102c36a14 engine_main(int, char**) + 104
16  dyld                          	       0x186638274 start + 2840

I came across another strange behavior when using skinning. They have different material tags(model and outline) and are rendered like this (nothing special)

  render.enable_state(graphics.STATE_CULL_FACE)
    render.draw(predicates.model, draw_options_world)
    render.draw(predicates.outline, draw_options_world)
    render.set_depth_mask(false)
    render.disable_state(graphics.STATE_CULL_FACE)

It looks like the bones are mixed up. I guess this is not related to the models, so I should add an issue?

Edit: If I render them separately(just model or just outline), their animations work properly.

3 Likes

We have decided to mark this version as 1.10.0 instead of 1.9.9 to more clearly signal the fact that the Box2D 3.0 update is a breaking change for certain use cases. Also the fact that the implementation of Box2D has been rewritten from scratch is enough reason to flag this as a breaking change.

We ask you to pay extra attention to the release notes about the Box2D update so that you can take the appropriate action and deal with known breaking changes OR use an app manifest to fall back and use the legacy Box2D version.

12 Likes

Yes, there is some strange when we call render.draw for skinning model more than once per frame. This happens if we want to render shadow map, outline, etc.

3 Likes

Aha, good catch! I didn’t think about testing this. :smiley:

Here’s a docs issue:

In stable, resource.create_texture_async has two return values.

In the beta docs, it now only has 1 return value.

The examples section (same page, immediately under the ā€œreturnsā€ section) still shows two return values.

local tpath, request_id = resource.create_texture_async("/my_texture.texturec", tparams, tbuffer)

Either a return value was removed from the docs by accident, or the example has gotten outdated.

As far as I can tell the return value was removed by mistake. The code still returns two values:

Is this reported already?

You can label drag general properies value, but can not drag a script properties.

4 Likes

No, thanks for the report!

2 Likes

Yes, it’s a breaking change. That is, our Puffy Cat, a fairly simple game, is completely non-functional - the triggers don’t work (we got the point about kinematic/trigger bodies and collision_response message in Box2D 3.0 and we’ll fix it) and the joints we use to create the ā€˜soft body’ behave very differently. We’re still investigating what the cause is. :folded_hands:

3 Likes

Note that trigger to trigger collisions are not working in the new Box2d version, but trigger to kinematic and trigger to dynamic objects should work just as before.

This is not something we noticed while testing the new version. Please let us know more about the specifics of your joints.

1 Like

I’m getting a crash related to changing walls in my map to empty tiles with
tilemap.set_tile("#map", "walls", 21, y, 0)

This works fine in 1.9.8. I see this in the crash dump for 1.10.0:

ERROR:CRASH: 0 0x7FF7E4CF4C90 dmPhysics::CreateGridCellShape D:\a\defold\defold\engine\physics\src\physics\box2d\box2d_physics.cpp:1086

Is there any way to regain this functionality so I can use Defold 1.10.0 with my game?

Ok, this is another Box2D 3.0 related problem. Can you please report this on GitHub?

You can revert to the legacy Box2D version by using an app manifest:

1 Like

We’ve merged another small editor fix into the beta:

  • FIX: (#10424) Correctly apply Gui template rotation to imported nodes when building (by matgis)
4 Likes

This should be fixed in the latest build.

3 Likes

A fix has been pushed, and a new beta should be available within an hour.

1 Like

I decided to make a small demo project to test the performance of Box2D on different versions. You can try it here, there are two links:

On my test device on Box2D 3.0 I see performance 2 times lower than on legacy Box2D, i.e. 25 fps vs 12 fps. The device is based on Unisoc T616 - probably the most popular chip for low end phones. Perhaps performance in 3.0 isn’t the main thing.

The second thing is more important: the project built on Defold 1.10.0 BETA for web does not run on iPhone 7, Safari 15.6 at all because of the error:

CompileError: WebAssembly.Module doesn't parse at byte 499: invalid opcode 253, in function at index 217

7 Likes

Great update, thank you so much! I found another small difference in physics:

legacy Box2d

	local id = factory.create(factory_url, position) -- go with dynamic collisionobject (sphere shape)
	local co_url = msg.url(game_hash, id, co_hash)
	b2d.body.set_linear_velocity(b2d.get_body(co_url), velocity)

VS

new Box2d 3.0

	local id = factory.create(factory_url, position) -- go with dynamic collisionobject (sphere shape)
	local co_url = msg.url(game_hash, id, co_hash)
	timer.delay(0, false, function()
		b2d.body.set_linear_velocity(b2d.get_body(co_url), velocity)
	end)

So, do we have to wait 1 frame to be able to set linear velocity for the dynamic object?.. :melting_face:

1 Like

Not sure what he’s referring to. Setting the linear velocity is a synchronous function call.

Edit: Reading his code a few times, I guess that the component’s body doesn’t register immediately.
Not sue why that is though. If it’s a Box2D thing, I’m not sure we want to add extra code to handle it, as we generally want to avoid making custom changes to the Box2D code.

2 Likes