Artifacts and versions¶
Releases are built on demand by
JitPack from git tags,
under the group com.github.optical002.godot-scala-native:
| Artifact | What it is |
|---|---|
sbt-godot-scala-native |
The sbt plugin a game project adds. It brings in everything else. |
scala-native-gdextension |
The binding library. The plugin adds it, so you never declare it yourself. |
Both artifacts are released together under one version.
Versioning¶
- Versions are plain semver tags such as
0.1.5, with novprefix. - Before 1.0, a minor bump can break the API. Read the changelog before upgrading.
- The first build of a new tag on JitPack takes several minutes. Later resolutions are cached.
Upgrading a project¶
Change the version in project/plugins.sbt, then rebuild:
A clean build makes sure no stale Scala Native intermediate files from the old binding are linked.
From 0.1.8 to 0.1.9¶
0.1.9 changes how engine objects and math values are represented. The compiler points at every place that needs an edit, apart from item 2, which you have to look for yourself.
-
Engine methods return typed objects. Remove
Gd.wraparound engine calls, and usecastto narrow:// 0.1.8 val mesh = Gd.wrap[ArrayMesh](body.getMesh()) // 0.1.9 val mesh = body.getMesh().cast[ArrayMesh]Null checks on returned objects change from
x.isNulltox == null. -
Release the references you receive. Engine methods returning a
RefCounted(ResourceLoader.load,Resource.duplicate,DirAccess.open,getMesh, ...) andGd.createof aRefCountednow hand you a reference. Callunref()when done, or wrap the code inGd.scoped { ... }. Code that doesn't still runs, but leaks those objects, and the binding printsRefCounted reference(s) still owned by Scalaat shutdown, naming the classes. See Memory and object lifetimes. - Object reads from containers are borrowed.
Arr/Dictelements andObject.getno longer take a reference. CallrefInc()on an element you keep after the container is gone. Basisconstructors.Basis(row0, row1, row2)is nowBasis.fromRows(row0, row1, row2).Basis(x, y, z)takes the columns (the axes), as in GDScript.basis.row0isbasis.row(0). The X axis isbasis.x.- Math method signatures follow the engine API. Methods without arguments
take no parentheses (
v.normalized,t.affineInverse). Godotintarguments areLong.Vector3.rotatedY(a)is gone; userotated(Vector3.UP, a).Vector3.zero,Basis.identity, andTransform3D.identitystill work but are deprecated in favour ofZEROandIDENTITY. - Free containers you create. An
ArrorDictyou build yourself (Arr.empty,Dict.empty) holds engine storage untilfree(). Exported container properties are released by the binding. - Build mode. Projects now build with Scala Native's optimizer
(
releaseFast). AddgodotNativeMode := "debug"to keep the previous behaviour. See Performance.
Companion libraries¶
Game-development libraries built on the binding live in
godot-scala-native-utilities:
reactive cells, HOCON config, prefabs, an init system, and more. They are
published on JitPack under com.github.optical002.godot-scala-native-utilities.