{"id":14648763,"url":"https://github.com/libriscv/godot-sandbox","last_synced_at":"2025-09-08T01:31:34.634Z","repository":{"id":70710486,"uuid":"583929964","full_name":"libriscv/godot-sandbox","owner":"libriscv","description":"Sandboxing that enables safe modding for Godot games","archived":false,"fork":false,"pushed_at":"2024-09-09T21:28:03.000Z","size":1305,"stargazers_count":81,"open_issues_count":23,"forks_count":7,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-09-10T00:54:54.731Z","etag":null,"topics":["cpp","godot","godot4","modding","rust","sandbox","scripting"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/libriscv.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-12-31T14:06:23.000Z","updated_at":"2024-09-09T21:28:09.000Z","dependencies_parsed_at":"2024-06-29T07:42:13.834Z","dependency_job_id":"24f011aa-7e17-40e2-a7e9-659b9aefa28d","html_url":"https://github.com/libriscv/godot-sandbox","commit_stats":null,"previous_names":["fwsgonzo/godot-sandbox","libriscv/godot-sandbox"],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libriscv%2Fgodot-sandbox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libriscv%2Fgodot-sandbox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libriscv%2Fgodot-sandbox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libriscv%2Fgodot-sandbox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/libriscv","download_url":"https://codeload.github.com/libriscv/godot-sandbox/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":218587313,"owners_count":16355373,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpp","godot","godot4","modding","rust","sandbox","scripting"],"created_at":"2024-09-10T22:00:50.923Z","updated_at":"2025-09-08T01:31:34.624Z","avatar_url":"https://github.com/libriscv.png","language":"C++","funding_links":[],"categories":["**Godot 4 Modules (C++)**"],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://github.com/libriscv/godot-sandbox/blob/main/banner.png?raw=true\" width=\"312px\"/\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n\n\u003cp align=\"center\"\u003e\n        \u003cimg src=\"https://github.com/libriscv/godot-sandbox/actions/workflows/runner.yml/badge.svg?branch=main\"\n            alt=\"Godot Sandbox Build\"\u003e\u003c/a\u003e\n        \u003cimg src=\"https://img.shields.io/badge/Godot-4.3-%23478cbf?logo=godot-engine\u0026logoColor=white\" /\u003e\n\u003c/p\u003e\n\n\u003cp align = \"center\"\u003e\n    \u003cstrong\u003e\n        \u003ca href=\"https://libriscv.no\"\u003eWebsite\u003c/a\u003e | \u003ca href=\"https://github.com/libriscv/godot-sandbox-programs\"\u003eCode Examples\u003c/a\u003e | \u003ca href=\"https://discord.gg/n4GcXr66X5\"\u003eDiscord\u003c/a\u003e | \u003ca href=\"https://gonzerelli.itch.io/demo\"\u003eWeb Demo\u003c/a\u003e\n    \u003c/strong\u003e\n\u003c/p\u003e\n\n\n-----\n\n\u003cp align = \"center\"\u003e\n\u003cb\u003eSafe, low-latency and fast sandbox\u003c/b\u003e\n\u003ci\u003efor the Godot game engine.\u003c/i\u003e\n\u003c/p\u003e\n\n\u003cp align = \"center\"\u003e\n\t\u003cstrong\u003e\n  \t\t\u003ca href=\"https://github.com/user-attachments/files/17729740/Introducing.the.New.Godot.Sandbox.pdf\"\u003eGodotCon 2024 Presentation\u003c/a\u003e\n\t\u003c/strong\u003e\n\u003c/p\u003e\n\n-----\n\nGodot Sandbox allows Godot creators to implement safe modding support, such that they can pass around programs built by other players, knowing that _restricted_ programs cannot harm other players. All Godot platforms are supported.\n\n\n## Installation\n\n- Automatic (Recommended): Download the plugin from the official [Godot Asset Store](https://godotengine.org/asset-library/asset/3192) using the **AssetLib** tab in Godot by searching for **Godot Sandbox**.\n\n- Manual: Download the [latest github release](https://github.com/libriscv/godot-sandbox/releases/latest) and move only the **addons** folder into your project **addons** folder.\n\n### What can I do?\n\n- Modding API\n\t- You can implement a modding API for your game. This API can then be used by other players to extend your game, in a safe manner.\n\t- Put restrictions on resources, classes and objects to say what is accessible inside the sandbox.\n- Build once, run everywhere\n\t- You can publish your game for all mobile and console platforms, without paying a performance penalty. It's not going to be laggy on some platforms, which is a risk with solutions that are only fast when JIT is available.\n- High-performance\n\t- You can use this extension as a way to write higher performance code than GDScript permits, without having to resort to writing and maintaining a GDExtension for all platforms.\n\t- Enable full binary translation to increase performance drastically. Also works on all platforms, but has to be [embedded in the project or loaded as a DLL](https://libriscv.no/docs/godot_docs/bintr).\n\t- Yields [2.5-10x performance boost by default](https://libriscv.no/docs/performance/#godot-sandbox-performance), 5-50x with binary translation\n\t- Experimental JIT builds are also available in the Releases section for Windows and Linux. The JIT will enhance performance automatically in the background for all programs.\n- Publish and then make updates without re-publishing\n\t- You can distribute programs from a server to clients as part of the login sequence. You can use this to live-distribute changes like bugfixes or even new features to the game without having to re-publish the game itself. I do this in my game.\n\n## Usage\n\n- Write C++ or Rust in the Godot editor. An accompanying ELF resource is created. This resource can be loaded into any Sandbox instance on every platform without recompiling.\n\n- Create a new `Sandbox` and [assign the ELF resource to it](https://libriscv.no/docs/godot/sandbox/#create-a-sandbox)\n\t- Lifetime as any other node\n\t- Auto-completion from other GDScripts using @export\n\n- Or, [directly assign an ELF script resource to a node](https://libriscv.no/docs/godot/sandbox/#using-programs-directly-as-scripts)\n\t- Shared sandbox among all instances with that script\n\t- Maximum scalability\n\t- Call functions and attach signals like GDScript\n\n## Examples\n\n```C++\n#include \"api.hpp\"\nstatic int coins = 0;\n\nstatic Variant reset_game() {\n\tcoins = 0;\n\treturn Nil;\n}\n\nstatic inline void add_coin(const Node\u0026 player) {\n\tcoins ++;\n\t// In our demo project we can access the coin label from the player\n\t// using a node path: Player -\u003e get_parent() -\u003e Texts -\u003e CoinLabel\n\tLabel coinlabel = player.get_node\u003cLabel\u003e(\"../Texts/CoinLabel\");\n\tcoinlabel.set_text(\"You have collected \"\n\t\t+ std::to_string(coins) + ((coins == 1) ? \" coinyboys\" : \" coins\"));\n}\n\nstatic Variant _on_body_entered(CharacterBody2D body) {\n\tif (body.get_name() != \"Player\")\n\t\treturn Nil;\n\n\tget_node().queue_free(); // Remove the current coin!\n\tadd_coin(body);\n\treturn Nil;\n}\n\nstatic Variant _ready() {\n\tif (is_editor_hint()) {\n\t\tget_node().set_process_input(false);\n\t}\n\treturn Nil; //\n}\n\nstatic Variant _process(double delta) {\n\tif (is_editor_hint()) {\n\t\tAnimatedSprite2D sprite(\"AnimatedSprite2D\");\n\t\tsprite.play(\"idle\");\n\t\tsprite.set_speed_scale(1.0f);\n\t}\n\treturn Nil;\n}\n\nstatic Variant _input(InputEvent event) {\n\tif (event.is_action_pressed(\"jump\")) {\n\t\tget_node\u003cNode2D\u003e().set_modulate(0xFF6060FF);\n\t} else if (event.is_action_released(\"jump\")) {\n\t\tget_node\u003cNode2D\u003e().set_modulate(0xFFFFFFFF);\n\t}\n\treturn Nil;\n}\n\nint main() {\n\tADD_API_FUNCTION(_on_body_entered, \"void\", \"CharacterBody2D\");\n\tADD_API_FUNCTION(_ready, \"void\");\n\tADD_API_FUNCTION(_process, \"void\", \"double\");\n\tADD_API_FUNCTION(_input, \"void\", \"InputEvent\");\n\tADD_API_FUNCTION(reset_game, \"void\");\n}\n```\n\nScript of a simple Coin pickup, with a counter that updates a label in the outer tree. This script can be attached to the Coin in the editor just like GDScript.\n\nYou may also have a look at our [demo repository](https://github.com/libriscv/godot-sandbox-demo) for the Godot Sandbox. It's a tiny platformer that uses C++ and Rust. There is also [a 3D plane demo](https://github.com/libriscv/godot_bird_plane) that enables controlling the plane from C++ scripts.\n\n## Module Build\n\nIn order to build module, add it to a godot repo:\n\n```\ngit submodule add https://github.com/libriscv/godot-sandbox modules/sandbox\ncd modules/sandbox\ngit submodule update --init --recursive\n```\n\n## Contributing\n\nRequirements:\n- [SCons](https://www.scons.org)\n- [python3](https://www.python.org)\n\nIf you want to contribute to this repo, here are steps on how to build locally:\n\n```sh\n./build.sh\n```\n\nYou can also use `scons` similar to how godot-cpp addons are built.\n\n## Contributors ✨\n\nThanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\u003c!-- prettier-ignore-start --\u003e\n\u003c!-- markdownlint-disable --\u003e\n\u003ctable\u003e\n  \u003ctbody\u003e\n    \u003ctr\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/fwsGonzo\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/3758947?v=4?s=100\" width=\"100px;\" alt=\"Alf-André Walla\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eAlf-André Walla\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/libriscv/godot-sandbox/commits?author=fwsGonzo\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://chibifire.com\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/32321?v=4?s=100\" width=\"100px;\" alt=\"K. S. Ernest (iFire) Lee\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eK. S. Ernest (iFire) Lee\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/libriscv/godot-sandbox/commits?author=fire\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"#research-fire\" title=\"Research\"\u003e🔬\u003c/a\u003e \u003ca href=\"https://github.com/libriscv/godot-sandbox/commits?author=fire\" title=\"Tests\"\u003e⚠️\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://appsinacup.com\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/2369380?v=4?s=100\" width=\"100px;\" alt=\"Dragos Daian\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eDragos Daian\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/libriscv/godot-sandbox/commits?author=Ughuuu\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n\n\u003c!-- markdownlint-restore --\u003e\n\u003c!-- prettier-ignore-end --\u003e\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!\n\n## Other Projects\n\nThe [Jenova Framework](https://github.com/Jenova-Framework/) has a built-in C++ compiler, and supports writing C++ in the Godot editor with hot-reloading support.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flibriscv%2Fgodot-sandbox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flibriscv%2Fgodot-sandbox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flibriscv%2Fgodot-sandbox/lists"}