Defold 1.3.0 BETA

Defold 1.3.0 BETA

The latest beta is now released, and we invite those interested in beta testing the new features in the editor and engine to join now.
The beta period will be 2 weeks and the next planned stable release is two weeks from now.

We hope this new workflow will highlight any issues earlier, and also get valuable feedback from our users. And please comment if you come up with ideas on improving on this new workflow.

Please report any engine issues in this thread or in issues using Help → Report Issue

Thx for helping out!

Disclaimer

This is a BETA release, and it might have issues that could potentially be disruptive for you and your teams workflow. Use with caution. Use of source control for your projects is strongly recommended.

Access to the beta

Download the editor or bob.jar from Defold Downloads

Set your build server to https://build-stage.defold.com

:warning: Official Spine runtime

In this version, we are fully removing the Spine component from the engine itself and moving to the official spine runtime. If you use Spine animations in your project then extra migration steps are needed.

Migration steps are available here : Spine animation in Defold

Engine

  • Issue-5886 - Fixed: New functions gui.set_screen_position() and gui.screen_to_local()
Details

Two new function added to make it easier to operate nodes in GUI component:

  • gui.set_screen_position(node, screen_position) - set screen position for the node;
  • local local_position = gui.screen_to_local(node, screen_position) - convert screen position to a local position of the supplied node.

Also, it fixed a bug when the returned value of gui.get_screen_position() might be affected by pivot value.

Fixes #5886

  • Issue-6112 - Fixed: Add game.project field for SSL keys to verify the certificate chain during SSL handshake
Details

To verify server SSL certificate a developer should provide a pem file that contains public keys that should be used for verification.
This file may contain public CA-root certificate keys or a self-signed certificate public keys.

This fix adds a new field networkssl_certificates in game.project where this pem file may be specified. If any file is specified in this field the engine turns on verification by default for all requests.

The list of CA-root certificates is included in builtins/ca-certificates, but we don’t recommend using this file directly. Create a new pem file and copy-paste the needed CA-root certificates depending on the services you make HTTP requests to.

Fixes #6112

  • Issue-6297 - Fixed: Include debugger scripts in builtins and include the files in bundled debug builds
Details

This change adds the Lua files required by the debugger to builtins. The files are always included in debug builds (ie variant set to debug). This makes it possible to attach the debugger to a previously bundled and already running build.

Fixes #6297

  • Issue-6347 - Fixed: Make sure file path comparisons are done without any initial slash for excluded folders
Details

Fixes issues when bob doesn’t ignore files specified in .defignore

Fixes #6345

  • Issue-6354 - Fixed: Use Application Support folder for game logs if ./log.txt is unavailable
Details

Fixes path to the log.txt file for macOS bundle where the creation of the file in app is impossible.

If project.wrile_log checkbox is ON in game.project, engine writes logs in log.txt file.
The path to the file depends on the platform (see manual).

From now on macOS the file path will be /Users/user_name/Library/Application Support/projectname/log.txt

Fixes #6354

  • Issue-6355 - Fixed: Fixed: New field enabled for properties iterator.
Details

Adds new field enabled in properties iterator for Gui nodes and components that support enable/disable messages. This functionality used in extension-poco for tests automation.

Fix defold/extension-poco#4

  • Issue-6370 - Fixed: Removed support for 32-bit iPhoneOS (armv7-darwin)
Details

Defold doesn’t support armv7 platform on iOS anymore.
info.plist in builtins/manifests/ios has changed (UIRequiredDeviceCapabilities) make sure you have these changes in your custom info.plist` if you use one.

If your game is already released with armv7 then you have to change MinimumOSVersion to 11.0 in your info.plist to be able to update it on AppStore.

The platform sent to bob is now “–platform=arm64-darwin”.
The bundle output folder from Editor is now arm64-darwin.

Fixes #6369

  • Issue-6376 - Fixed: Added instantiateStreaming support for HTML5 bundles
Details

Using WebAssembly.instantiateStreaming() is the fastest way to load the engine on HTML5 since you no longer have to first load the full engine into an array buffer and then instantiate it.

The feature is enabled by default but can be disabled by setting EngineLoader.stream_wasm = false;

Closes #6324

  • Issue-6406 - Fixed: Add override for onNewIntent (#6404)
Details

Some SDKs (for example AppsFlyer) save data in intent ( in case with Appsflyer it’s deep links data).
To be able to get this data app should be in singleTop mode or manually override onNewIntent and call setIntent.

But changing activity mode to singleTop is a bit risky and maybe a reason for regression when working with native extensions.

  • Issue-6423 - Fixed: Release pressed keys when regaining focus in HTML5 builds
Details

If a key is pressed while the game lost focus and that key is released while not in focus the event will not be received for the key release. This will result in the key remaining in the pressed state when the game regains focus. To fix this we set all pressed keys to released before regaining focus.

Fixes #3186

  • Issue-6214 - Fixed: Removed Spine nodes from gui
  • Issue-6341 - Fixed: Added first iteration of ddf unpack script
  • Issue-6360 - Fixed: Updated to support Linux builds on WSL
  • Issue-6361 - Fixed: Enable Linux builds to use local compiler
  • Issue-6363 - Fixed: Added notes for how to use Terminal and chocolatey to setup on Windows
  • Issue-6364 - Fixed: Bump copyright notice
  • Issue-6367 - Fixed: Added support for using local install of Visual Studio and Windows SDK
  • Issue-6378 - Fixed: Added more dmGui::DeleteNode et al to dmsdk for use with extension-spine
  • Issue-6379 - Fixed: Make sure bash finds the binaries in the repository
  • Issue-6383 - Fixed: Added dmGui::GetParent, dmGui::GetFirstChildNode and dmGui::GetNextNode to dmsdk
  • Issue-6409 - Fixed: Detect M1 CPU and run x86 shell
  • Issue-6419 - Fixed: Always provide the stripped/unstripped versions from the build server for linux budle

Editor

  • Issue-6316 - Fixed: Add custom project templates
Details

It adds support for user defined templates in the welcome screen:

  • Create a .defold folder in your user home folder. This is the same location as any custom editor css files should be located.
  • Create a welcome.edn file with the following content:
{:new-project
	{:categories [
		{:label "From Custom Template" :templates [
			{
				:name "LowRez"
				:description "Defold template project for creation of low-res pixel art games."
				:image "empty.svg"
				:zip-url "https://github.com/britzl/lowrezjam-template/archive/refs/heads/master.zip"
				:skip-root? true
			},
			{
				:name "MyProject"
				:description "Template with everything set up my way!."
				:image "empty.svg"
				:zip-url "https://github.com/britzl/lowrezjam-template/archive/refs/heads/master.zip"
				:skip-root? true
			},
		]}
	]}
}

Notes:

  • You can create as many categories as you want.
  • For now the :image has to be one of the images in editor/resources/welcome/images.
  • The :zip-url has to be hosted on a server and downloaded using HTTP GET.
21 Likes

Love the details!

4 Likes

Really looking forward to new spine runtime, but migration with my over 100 animals and other scenes will be a nightmare)

4 Likes

@russelkgd ou should be able to script most of it?
Spine can bu used as a command line tool, and the file renaming is basically just search and replace.

2 Likes

For some reason simple renaming does not work for me:

I suspect, because all previous exports were done to versions lower than 4.0

no, it’s not enough

From the migration guide:

  • NOTE: The old spine version json files won’t work as they are too old!
1 Like

The custom template for the editor is a really welcome addition. Thanks!

3 Likes

Thank you for looking at this issue, unfortunately it is still present for me in builds I make using 1.2.193 BETA in Chrome on Windows 10, hosted on itch.io.

Also, are you able to expand on why the fix was to release the key after regaining focus, instead of upon losing focus? This means that an action which occurs while a key is held, if the key is down when the game loses focus, the hold action will continue happening until the game regains focus. I think it would be preferable to have the input be reset as soon as focus is lost, so any held actions stop happening while the game is unfocused. In fact for safety, I think it makes sense to reset all inputs on both focus loss and focus gain.

That is odd. And this is when changing tab or something?

Our thinking was mainly that you probably already have a handler to pause the game etc on lost focus and that it was only necessary to clear input before regaining focus. But I think maybe you’re right. It should be cleared on lost focus (it’s not necessary to clear on both lost and gained focus).

Here is a minimal repro project and HTML5 embed:

HTML5FocusSource.zip (2.2 KB)

It’s literally just a single keybind for Space called “spacebar” and the following script:

local function on_window_event(self, event, data)
	if event == window.WINDOW_EVENT_FOCUS_GAINED then
		print("focus gained")
	elseif event == window.WINDOW_EVENT_FOCUS_LOST then
		print("focus lost")
	end
end

function init(self)
	window.set_listener(on_window_event)
	msg.post(".", "acquire_input_focus")
end

function on_input(self, action_id, action)
	if action_id == hash("spacebar") then
		if action.pressed then
			print("spacebar pressed")
		end
		if action.repeated then
			print("spacebar repeated");
		end
		if action.released then
			print("spacebar released")
		end
		print("spacebar value "..action.value)
	end
end

And here is a video demonstrating the behaviour on my machine:

The project simply prints application focus gain/loss and the status of the spacebar to the browser console. In the demo video I press and release the spacebar and the console messages show what you would expect. I then hold the spacebar and click outside of the game into the page the game is embedded on, and the game continues printing the spacebar (since the fix atm is to clear the input on focus gain not focus loss). But when clicking back into the game, it continues printing that the spacebar is held down, until I press and release it again.

The input gets stuck on when the embedded game loses focus in seemingly any way, including changing focus from the game to the page itself, to a different browser tab, or to a different program.

2 Likes

Focus loss and gain for the embedded HTML5 build are printed when:

  • The browser is minimized and restored while the game tab is focused (even if the game itself is not focused)
  • A different maximized program on the same monitor is Alt-Tabbed to
  • A different tab in the same browser window gains focus (mouse click or keyboard shortcut)

Focus loss and gain are not printed when:

  • Focus moves between the game and the page it is embedded in
  • Focus moves to a non-maximized program on the same monitor (mouse click or Alt-Tab)
  • Focus moves to a maximized program on a different monitor (mouse click or Alt-Tab)
  • Focus moves to a browser tab in a different window (mouse or keyboard shortcut)

There may be other relevant scenarios.

2 Likes

Thanks @connor.halford ! I’ve reopened the ticket and will look more closely into the various scenarios you mentioned. I feel that all of them should generate a focus lost event.

1 Like

There’s a new PR waiting for review:

In this PR we use the “focus” and “blur” events on the canvas element to detect any kind of change to focus on the canvas. This can be simply alt-tabbing to another window or selecting some other element on the same page. Key states will be reset as soon as such a change is detected.

4 Likes

This PR has been merged. I’ve tested the changes in a number of different scenarios but I’d really appreciate some additional eyes on this from developers releasing games on the web to ensure that we do not introduce any new problems and that the window focus events work well after this change.

I’m especially thinking of web game platforms such as Poki, Yandex etc where the focus events may be used in combination with pause screens, muting of sound, showing of ads etc.

Calling on @Lampogolovii, @aglitchman, @benjames171 and others to test the beta!

4 Likes

Ok, I’m using the latest beta and will check the new behaviour.

By the way, I added a new script into a project, and it turned out that the script template included the Defold copyright:

-- Copyright 2020-2022 The Defold Foundation
-- Copyright 2014-2020 King
-- Copyright 2009-2014 Ragnar Svensson, Christian Murray
-- Licensed under the Defold License version 1.0 (the "License"); you may not use
-- this file except in compliance with the License.
-- 
-- You may obtain a copy of the License, together with FAQs at
-- https://www.defold.com/license
-- 
-- Unless required by applicable law or agreed to in writing, software distributed
-- under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
-- CONDITIONS OF ANY KIND, either express or implied. See the License for the
-- specific language governing permissions and limitations under the License.

function init(self)
	-- Add initialization code here
	-- Learn more: https://defold.com/manuals/script/
	-- Remove this function if not needed
end

-- ... etc

Should we keep it in all files?

2 Likes

Oh. That’s not intentional. I’ll fix this. Thanks.

1 Like

I’m assuming that I’m just misunderstanding how to get this updated version of the 1.2.193 BETA, but none of the HTML5 focus behaviour is different for me compared to the first 1.2.193 BETA.

In Help → About, both the Editor and Engine SHA1 are both e5bf238d450fe83fc2d3fbb68b503a1fa422ea7c but this doesn’t seem to correspond to any commit on GitHub. Build time is 2022-02-26 10:37.

I’ve tried downloading from Defold Downloads and from https://github.com/defold/defold/releases/tag/1.2.193-beta

And as per the instructions in the topmost post have File → Preferences → Extensions → Build Server set to https://build-stage.defold.com

1 Like

No, it’s my mistake! I merged the PR to the dev branch but forgot to pick it for the beta. I have now added the fix to the beta as well and it is currently building. A new beta should be available in about half an hour or so.

4 Likes

Can confirm all HTML5 focus issues fixed for my setup! (Windows, Chrome, hosting on itch)

And yh I think it feels much more sensible to have all held inputs be cancelled on focus loss, rather than focus gain.

Thanks @britzl!

4 Likes

We’ve renamed this release 1.3.0 to better communicate the breaking change in regards to the Spine extension.

13 Likes