You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit b779826
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: docs/en/manuals/android.md
+15-2Lines changed: 15 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -85,9 +85,9 @@ For this feature to work, you will need *ADB* installed and *USB debugging* enab
85
85
86
86
An *.aab* file can be uploaded to Google Play via the [Google Play developer console](https://play.google.com/apps/publish/). It is also possible to generate an *`.apk`* file from an *.aab* file to install it locally using the [Android bundletool](https://developer.android.com/studio/command-line/bundletool).
87
87
88
-
## Shrinking Java code with R8
88
+
## Shrinking Java code and Android resources with R8 {#shrinking-java-code-with-r8}
89
89
90
-
R8 reduces the size of Java code through shrinking, optimization and obfuscation.
90
+
R8 reduces the size of Java code through shrinking, optimization and obfuscation. With Defold 1.14.0 or later and a compatible Extender build server, it also removes unused Android resources, such as layouts, drawables and raw resources supplied by extensions and their Android dependencies. Defold game assets in the game archive are not processed by R8.
91
91
92
92
### Enabling R8
93
93
@@ -102,10 +102,23 @@ Make sure every extension with Java code provides a `.keep` file for the classes
102
102
103
103
Leaving **R8 Keep Rules** empty uses D8 without shrinking. Enabling R8 uses the native extension build service, even for a project without native extensions.
104
104
105
+
Android resource shrinking is enabled by the same **R8 Keep Rules** setting; there is no separate project setting for it. Older Defold SDKs retain code-only R8 shrinking. If you host your own [Extender server](/manuals/extender-local-setup/).
106
+
105
107
### Adding rules to an extension
106
108
107
109
Keep rules for an extension belong in its `manifests/android` directory, next to `build.gradle`. See [R8 keep rules for Android extensions](/manuals/extensions/#r8-keep-rules-for-android) for how to add a file and preserve the extension's Java classes.
108
110
111
+
### Keeping Android resources
112
+
113
+
Resources looked up dynamically by name may need explicit keep rules. Android resources use an XML file with `tools:keep`, separately from the `.keep` rules for Java classes. For example, an extension can preserve a raw resource named `dynamic_data` by adding `/myextension/res/android/res/raw/com_example_myextension_keep.xml`:
Use a unique filename for each extension's XML keep file to avoid conflicts. The `tools:keep` value accepts a comma-separated list of resource names and supports `*` wildcards. See Android's [resource keep rules documentation](https://developer.android.com/topic/performance/app-optimization/customize-which-resources-to-keep) for details. Test features that load resources dynamically in a release build after enabling R8.
121
+
109
122
### Keeping the obfuscation mapping
110
123
111
124
Enable **Generate debug symbols** in the Android bundle dialog, or pass `--with-symbols` to Bob, to retain R8's `mapping.txt` when the build produces one. For example, from the project directory:
On Linux ARM64, the **OpenGL** choice uses the OpenGL ES backend. The Android combined default prefers Vulkan when available and falls back to OpenGL ES.
132
132
133
+
Since Defold 1.14.0, macOS uses the native Metal backend by default. The **Vulkan** choice on macOS and iOS uses Vulkan through MoltenVK. The iOS simulator (`arm64_sim-ios`) always uses Metal, regardless of the **Graphics (iOS)** choice for devices.
134
+
133
135
## Use full text layout system
134
136
135
137
If enabled (`true`), this includes the full text layout system for shaping text, including right-to-left languages. Enable this option together with `font.runtime_generation` in *game.project* to use runtime generation for SDF fonts from TrueType (`.ttf`) or OpenType (`.otf`) resources. Runtime generation from `.otf` resources is supported since Defold 1.13.2. Read more in the [Font Manual](/manuals/font/#enabling-runtime-fonts).
-rw-r--r-- 1 sicher staff 131926 1 Dec 10:15 state
238
238
$
239
239
```
240
+
241
+
## Build server
242
+
243
+
Since Defold 1.14.0, Bob selects the default native extension build server from the release channel of its distribution:
244
+
245
+
| Bob release channel | Default build server |
246
+
|---|---|
247
+
|`stable`|`https://build.defold.com`|
248
+
| Any other channel, including `beta` and `alpha`|`https://build-stage.defold.com`|
249
+
250
+
Run `java -jar bob.jar --version` to display the release channel together with Bob's version and build information. The `--variant` option controls the engine build variant and does not change this release channel.
251
+
252
+
Pass `--build-server <url>` to select a server explicitly, including a [self-hosted Extender server](/manuals/extender-local-setup/). This option overrides the default for every release channel.
Copy file name to clipboardExpand all lines: docs/en/manuals/editor-preferences.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,7 +27,7 @@ Track Active Tab in Asset Browser
27
27
: The file edited in selected tab in the *Editor* pane will be selected in the Asset Browser (also known as the *Asset* pane).
28
28
29
29
Lint Code on Build
30
-
: Enables [code linting](/manuals/writing-code/#linting-configuration) when the project is built. This option is enabled by default, but can be disabled if the linting in a large project takes too much time.
30
+
: Enables [code linting](/manuals/writing-code/#linting-configuration) when the project is built. This option is disabled by default.
31
31
32
32
Engine Arguments
33
33
: Arguments that will be passed to the dmengine executable when the editor builds and runs.
Copy file name to clipboardExpand all lines: docs/en/manuals/extensions.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -97,6 +97,8 @@ If the extension relies on annotations at runtime, also include:
97
97
98
98
These rules are combined with the project's selected keep file when [R8 is enabled](/manuals/android/#enabling-r8).
99
99
100
+
With Defold 1.14.0 or later and a compatible Extender server, R8 also shrinks Android resources. If the extension looks up resources dynamically by name, add [XML resource keep rules](/manuals/android/#keeping-android-resources) under `res/android/res/raw` in the extension folder.
Copy file name to clipboardExpand all lines: docs/en/manuals/lua.md
+2-5Lines changed: 2 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -543,12 +543,9 @@ end
543
543
544
544
## Lua contexts in Defold
545
545
546
-
All variables that you declare are by default global, meaning that they are available through all parts of the Lua runtime context. Defold has a setting *shared_state* setting in *game.project* that controls this context. If the option is set, all scripts, GUI scripts, and the render script are evaluated in the same Lua context and global variables are visible everywhere. If the option is not set, the engine executes scripts, GUI scripts, and the render script in separate contexts.
547
-
548
-

549
-
550
-
Defold allows you to use the same script file in several separate game object components. Any locally declared variables are shared between components that run the same script file.
546
+
Variables are global unless declared with `local`. All game object scripts, GUI scripts and render scripts share one Lua context, so globals and the cache of modules loaded with `require()` are shared between them. Store state that belongs to a single script instance in `self`, or create separate state tables explicitly, instead of keeping it in shared globals or module tables.
551
547
548
+
Defold allows you to use the same script file in several separate game object components. Variables declared with `local` at the top level of the script file are shared between components that run that file. Variables declared with `local` inside a function are local to that function call.
552
549
```lua
553
550
-- 'my_global_value' will be available from all scripts, gui_scripts, render script and modules (Lua files)
The same is true for matrix attributes, if the attribute is a matrix type other than a `Mat4` you can still set the data using `go.set`.
159
+
Since Defold 1.14.0, `Mat2`, `Mat3` and `Mat4` attributes all use `vmath.matrix4` values with `go.set()` and `go.get()`. Setting a `Mat2` or `Mat3` attribute takes the upper-left 2×2 or 3×3 part of the matrix. Reading it returns a `vmath.matrix4` with the unused rows and columns filled from an identity matrix.
160
+
161
+
For example, with a `Mat2` attribute named `custom_mat2` and semantic type `None` in a model's material:
Always assign the complete matrix. Flattened values such as `vmath.vector4` and assignments to individual attribute sub-properties are rejected for matrix attributes. To change an element, modify the matrix in Lua and pass it back with `go.set()`.
Copy file name to clipboardExpand all lines: docs/en/manuals/optimization-size.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -93,6 +93,9 @@ Another way of reducing initial application size is to exclude parts of the game
93
93
Excluded content can be anything from entire levels to unlockable characters, skins, weapons or vehicles. If your game has a lot of content, organize the loading process so that the bootstrap collection and the first level collection include the bare minimum resources required for that level. You achieve this by using collection proxies or factories with the "Exclude" checkbox enabled. Split resources according to the player's progress. This approach ensures efficient resource loading and keeps initial memory usage low. Learn more in the [Live Update manual](/manuals/live-update/).
94
94
95
95
## Android specific size optimizations
96
+
97
+
Enable [R8 shrinking](/manuals/android/#shrinking-java-code-with-r8) to remove unused Java code. With Defold 1.14.0 or later and a compatible Extender server, this also removes unused Android resources from extensions and their dependencies.
98
+
96
99
Android builds must support both 32-bit and 64-bit CPU architectures. When you [bundle for Android](/manuals/android) you can specify which CPU architectures to include:
Copy file name to clipboardExpand all lines: docs/en/manuals/project-settings.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -685,6 +685,8 @@ Whether or not the application can be debugged using tools such as [GAPID](https
685
685
#### R8 Keep Rules
686
686
`android.r8_keep_rules` selects a `.keep` file to enable R8 shrinking, optimization and obfuscation of Java code in Android builds. Leave the setting empty to use D8 without shrinking.
687
687
688
+
With Defold 1.14.0 or later and a compatible Extender build server, this also removes unused Android resources. Resources loaded dynamically may need separate [XML keep rules](/manuals/android/#keeping-android-resources).
689
+
688
690
Select `/builtins/manifests/android/dmengine.keep` to use Defold's default rules directly. Extensions supply their own [keep rules](/manuals/extensions/#r8-keep-rules-for-android), which are combined with this file.
689
691
690
692
Only copy the built-in file into your project if you need to add project-specific rules. Preserve the built-in rules in the copy: selecting a custom file replaces the complete project rule set.
Copy file name to clipboardExpand all lines: docs/en/manuals/zerobrane.md
+1-5Lines changed: 1 addition & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -59,10 +59,6 @@ Debugging session started in '/Users/my_user/Documents/Projects/Defold_project'.
59
59
60
60
Now it is possible to use the debugging features available in ZeroBrane; you can step, inspect, add and remove breakpoints etc.
61
61
62
-
::: sidenote
63
-
The debugging will only be enabled for the lua context from where debugging is initiated. Enabling "shared_state" in *game.project* means you can debug your whole application no matter where you started.
64
-
:::
65
-
66
62

67
63
68
64
Should the connection attempt fail (possibly because the debugging server is not running), your application will continue to run as normal after the connection attempt has been made.
@@ -96,4 +92,4 @@ The first step is to access the editor configuration file. It is recommended tha
0 commit comments