Skip to content

Releases: libriscv/godot-sandbox

v0.28: Live-profiling and Godot module support

03 Nov 15:25
9cb7535
Compare
Choose a tag to compare

Godot Sandbox can now be built as a module, thanks to @Ughuuu. There is now also a live-profiling feature that enables automatic sampling of Sandbox programs in order to show where time is most spent. The feature works on all platforms, including Web. Documentation here.

image

The image shows live-profiling being displayed in the demo project. The profiling information is automatically gathered over time.

PRs

  • Add support for instruction-counter profiling by @fwsGonzo in #199
  • Build as both addon and module. Part 1, integration. by @Ughuuu in #184
  • Make static libs too by @Ughuuu in #202
  • package everything for modules by @Ughuuu in #203

Full Changelog: v0.27...v0.28

v0.27: Hot-reloading support

26 Oct 11:53
69d2e2d
Compare
Choose a tag to compare

This release adds hot-reloading support to the Sandboxes initialized with set_program, directly or indirectly.

It also adds method argument names with default values to the run-time API. The full run-time API has higher compilation times, but the argument names can be disabled in project settings. It's also possible to filter out classes in order to reduce the generated API down to a more manageable size for the compiler. There is a default filtering of things like OS, multiplayer and networking.

Screencast.from.26.okt.2024.kl.18.18.+0200.webm

Full Changelog: v0.26...v0.27

v0.26: Run-time generated C++ API

25 Oct 17:55
5383d75
Compare
Choose a tag to compare

A new run-time generated C++ API is made available to Docker- and CMake-based projects. The API is auto-generated on first save, and contains all loaded classes including extra modules and GDextensions. This adds auto-complete to your external editor as well, which greatly increases productiveness.

Since it's a run-time generated API it will automatically follow Godot versions forward.

	JSON j = ClassDB::instantiate<JSON>("JSON");
	j.parse(
	R"({
		"pi": 3.141,
		"happy": true,
		"name": "Niels Nielsen",
		"nothing": null,
		"answer": {
			"everything": 42
		},
		"list": [1, 0, 2],
		"object": {
			"currency": "USD",
			"value": 42.99
		}
	})");
	print(j.get_data());

Even the Sandbox class can be auto-completed in your favorite editor, as it is a loaded extension:

extern "C" Variant test_sandbox_pass(Sandbox s) {
	Sandbox s2 = s.FromBuffer(PackedArray<uint8_t>((const uint8_t *)binary_data, binary_data_size));
	return s2;
}

In the future we may add better support for static functions in classes and also try to add inline documentation to classes, properties and methods.

A new load<Class> resource loading helper has been added:

Node2D scene = load<PackedScene>("res://scenes/mod/mod.tscn").instantiate();

You can iterate nodes by group:

    for (Node node : get_tree().get_nodes_in_group("Coins")) {
    }

Other changes include preventing access to restrictions while in an active VM call, even indirectly.

What's Changed

Full Changelog: v0.25...v0.26

v0.25: API and stability improvements

23 Oct 15:06
78a41cf
Compare
Choose a tag to compare

A small release that adds stability and continues to improve the C++ API surface

  • Adds complete support for the Plane variant type
  • Adds opaque RID support, pass-through
  • Adds constructors to all Vector classes
  • Add print/stdout redirect to Callable
  • Add new PROPERTY(name) macro for objects to simplify adding properties
  • Add proper index operator Array that can get/set
  • Improve performance of getting/setting properties on objects
  • Improve performance of get_node() and derivatives
  • Prevent reloading/resetting a Sandbox while it's in a function call
  • Expose ELFScript::get_content() so that the program bytes can be directly loaded into a Sandbox
  • Several other bug fixes

PRs

New Contributors

Full Changelog: v0.24...v0.25

v0.24: New restriction system

19 Oct 21:17
f03f962
Compare
Choose a tag to compare

This release adds new features for Sandbox restrictions, completes the C++ API for Array, Dictionary and String, and fixes many problems.

  • Add new property to Sandbox called restrictions
  • Add support for user-provided Callables for handling classes, objects, methods, properties and resources respectively
  • Add setting for disabling custom named Sandbox instances
  • Automatically build CMake project when CMakeLists.txt is detected instead of trying to use Docker
  • Precise simulation now also applied to VM calls, making them easier to debug
  • Fix a bug when creating Packed*Arrays. They are not mananged by reference in Variants.
  • Fix issue when using sandbox.vmcall() with no arguments
  • Fix issue with counting active global Sandbox instances
  • Fix issue with assigning temporary to permanent Variants. It is now kept permanent.

The new restrictions system is documented here.

The rules for CMake building is documented here.

The Sandbox node API reference

What's Changed

Full Changelog: v0.23...v0.24

v0.23: Bugfixes

13 Oct 12:45
96f1d69
Compare
Choose a tag to compare

This release fixes many bugs reported and otherwise.

  • Add missing Locale environment variables for compatibility with other libraries, eg. Mir
  • Clear Variants fully when re-initializing Sandboxes (hot-reloading). They would fill up over time and generate errors.
  • Remember to stop async compilation thread on exit. Prevents hanging executable on Windows. Thanks @CycloneRing
  • Fix C++, Rust and Zig scripts appearing in New Scene dialogue. Thanks @CycloneRing
  • Implement remaining Quaternion ops.
  • Add Variant::is_permanent() to check if it's permanently stored.
  • The current tree base of a Sandbox could become clobbered by re-entrant calls. Fixed.

Full Changelog: v0.22...v0.23

v0.22: Hot-reloadable programs, 3D variants

10 Oct 20:40
55633cf
Compare
Choose a tag to compare

There is now support for Transform2D, Transform3D, Basis and Quaternion. Some Variants can be now in-place updated, including permanent ones. And finally, if a program is updated it will be reloaded in the editor, including its properties. Property values are retained across updates.

  • Added Variant::make_permanent() to promote/move a temporary variant into permanent storage
  • Some Variants can now be in-place updated, including permanent ones
  • Improved error messaging around Variants and Objects
  • Hot-reloadable Sandboxes with preserved Sandbox property values
  • Introduce wrappers and several methods for Transform2D, Transform3D, Basis and Quaternion
  • Implement several new methods for Vector2
  • Add use_precise_simulation property to Sandbox for the purposes of debugging exceptions
  • Add new experimental binary translation option automatic N-bit address space, which improves performance but won't support all types of programs

What's Changed

  • Add initial support for Transform2D, Transform3D and Basis by @fwsGonzo in #172
  • Add support for in-place reuse of Variant references by @fwsGonzo in #173
  • Reload sandboxes when ELF files change by @fwsGonzo in #174

Full Changelog: v0.21...v0.22

v0.21: High-performance binary translations

06 Oct 15:57
f324db7
Compare
Choose a tag to compare

High-performance binary translation support has now been added, with support for all platforms including Web. The exact process is documented here. The extension has also been upgraded to 4.3 in order to work around a bug in Web export.

We're seeing 6-30x performance improvements in benchmarks against GDScript.

  • Binary translations can now be emitted at run-time and written to .cpp files, later to be embedded. They auto-activate by themselves.
  • It's now possible to disable Docker usage completely. It's a project setting.
  • Added initial support for tracing system calls. It's a compile-time flag for the moment.
  • Avoid caching functions when loading Sandbox from buffer. Instant instantiation.
  • Add a new resumable mode which lets you slowly initialize a Sandbox over many frames, if needed. Must not be called into, while doing this, as it will disable resumable mode.

What's Changed

Full Changelog: v0.20...v0.21

v0.20: Modding and custom builds support

03 Oct 19:50
551b273
Compare
Choose a tag to compare

In this release focus has been on supporting the creation of sandboxes that take remotely downloaded programs as input. There is now also Callable support that can refer to C++ lambdas, which can be used with signals. Finally, asynchronous compilation has been made available, enabled by default. It is backed by a single worker thread to avoid problems with ccache and Ctrl+Z + Ctrl+S, where a long compilation would eventually overwrite a newer one.

  • Added support for Callable with wrapper in the C++ API
  • Allow Sandboxes to be created using PackedByteArray
  • Add support for loading resources
  • Add settings for global defines and debug info for C++ programs
  • Add asynchronous compilation setting, default enabled
  • There is now a LuaJit example that can be embedded into C++ programs
  • Simplify and improve CMake build system for easier integration into game projects

LuaJit example

What's Changed

Full Changelog: v0.19...v0.20

v0.19: Various improvements and fixes

29 Sep 20:51
18b0bba
Compare
Choose a tag to compare

This release completes much of the work done in previous release to be able to support most (if not all) of Variant types in the sandbox.

  • Most Variant types are now supported.
  • It's now possible to create Variants during startup, which won't be forgotten
  • There is now a CMake project for building complex sandbox projects, meant to be used in Ubuntu or WSL
  • The Sandbox programs in the unittests are now being built using the new CMake project
  • Most properties are now visible in the inspector for shared Sandbox instances too
  • PackedStringArray was missing among the packed arrays, but is now fully supported
  • The C++ docker image has been reduced 25% in size, which should reduce project startup times

Example of how to create Variants that can be used between calls:

// This works: it's being created during initialization
static Dictionary d = Dictionary::Create();

extern "C" Variant add_to_dict(Variant key, Variant val) {
	d[key] = val;
	return d;
}
extern "C" Variant failing_add_to_dict(Variant key, Variant val) {
	// This won't work: it's being created after initialization
	static Dictionary fd = Dictionary::Create();
	fd[key] = val;
	return fd;
}

PRs

  • Add getters/setters for registers and resume functionality for Sandbox by @fwsGonzo in #145
  • Allow using Variants that were created during initialization by @fwsGonzo in #146
  • Add an example CMake project for building complex Sandbox programs by @fwsGonzo in #148
  • Add test for CMake example program by @fwsGonzo in #149
  • Build the unittest ELF file in GA by @fwsGonzo in #150
  • Expose properties from shared instances in the inspector through ScriptInstance by @fwsGonzo in #152
  • Implement support for PACKED_STRING_ARRAY by @fwsGonzo in #153

Full Changelog: v0.18...v0.19