From d7bc5d183c1bd12aef3480353cf9cea9e21fca34 Mon Sep 17 00:00:00 2001 From: NaySurGithub <96527285+NaySurGithub@users.noreply.github.com> Date: Wed, 4 Nov 2026 23:52:37 +0100 Subject: [PATCH 1/2] docs: document webassembly plugins and deprecate dotnet --- index.html | 2 +- plugins.html | 32 +++++++++++++++++++++++--------- plugins.js | 48 +++++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 71 insertions(+), 11 deletions(-) diff --git a/index.html b/index.html index dcbc2b9..5308ca9 100644 --- a/index.html +++ b/index.html @@ -196,7 +196,7 @@

Behavior packs

Plugins

-

Events, commands, custom content and services, in C++, C# or Java. Plugin API →

+

Events, commands, custom content and services, in C++, Java or WebAssembly. Plugin API →

diff --git a/plugins.html b/plugins.html index 69526e0..066a4c9 100644 --- a/plugins.html +++ b/plugins.html @@ -4,8 +4,8 @@ Plugins - Falcon - - + + @@ -16,7 +16,7 @@ - + @@ -24,7 +24,7 @@ - + @@ -52,14 +52,14 @@

Plugins for Falcon

- Extend the server with plugins written in C++, C# or Java. Every language sits on the same stable API, so a + Extend the server with plugins written in C++, Java or WebAssembly. Every language sits on the same stable API, so a plugin keeps working when the server updates.

API 1.2 C++17 - C# Java + WebAssembly Windows, Linux & macOS
@@ -73,6 +73,17 @@

Plugins for Falcon

Pick a runtime

+
+

WebAssembly New

+

Sandboxed plugins in any language with WIT bindings for core modules. The recommended choice for + new plugins: a broken or hostile plugin is stopped without taking the server down.

+
    +
  • No file system or network access
  • +
  • Memory capped by wasm-plugin-memory-mb, work per server call by + wasm-plugin-fuel
  • +
  • "runtime": "wasm"
  • +
+

Native C++ Available

Header-only C++ classes over a stable C ABI. Build with any compiler and the plugin loads on every @@ -94,8 +105,9 @@

Internal C++ Available

-

C# Available

-

.NET class libraries loaded in-process, with the same events, commands and content as C++.

+

C# Deprecated

+

.NET class libraries loaded in-process. Deprecated and removed in a future release: move to + WebAssembly, native C++ or Java.

  • Needs the .NET runtime
  • "runtime": "dotnet"
  • @@ -169,10 +181,12 @@

    Your first plugin

    -
    diff --git a/plugins.js b/plugins.js index a78514d..984732a 100644 --- a/plugins.js +++ b/plugins.js @@ -51,6 +51,51 @@ FALCON_PLUGIN(MyPlugin)` "main": "MyPlugin", "depend": [], "softdepend": [] +}` + } + ], + wasm: [ + { + title: "Build the module", + text: "Generate the C bindings from falcon.wit with wit-bindgen and build a " + + "core module with clang and a WASI sysroot. The server loads the core module, not a component.", + file: "build.sh", + syntax: "cmake", + code: `wit-bindgen c wit --out-dir build +clang --target=wasm32-wasip1 --sysroot="$WASI_SYSROOT" -mexec-model=reactor -O2 \\ + -Ibuild -Iwit/c -o build/MyPlugin.wasm \\ + MyPlugin.c wit/c/falcon_wasm.c build/falcon_plugin.c build/falcon_plugin_component_type.o` + }, + { + title: "Write the plugin", + text: "Implement falcon_enable, subscribe to events and register commands. The " + + "falcon_wasm.h helper hides the bindings; everything else stays reachable through them.", + file: "MyPlugin.c", + syntax: "cpp", + code: `#include "falcon_wasm.h" + +static void welcome(void) { + falcon_player player; + if (falcon_event_player(&player)) + falcon_send(player, "Welcome!"); +} + +bool falcon_enable(void) { + falcon_on(FALCON_EVENT_PLAYER_JOIN, welcome); + return true; +}` + }, + { + title: "Install it", + text: "Put the module next to a plugin.json in plugins/MyPlugin/. It runs " + + "with no file system or network access.", + file: "plugin.json", + syntax: "json", + code: `{ + "name": "MyPlugin", + "version": "1.0.0", + "runtime": "wasm", + "main": "MyPlugin.wasm" }` } ], @@ -158,7 +203,8 @@ public class MyPlugin extends Plugin { const KEYWORDS = { cmake: ["include", "FetchContent_Declare", "FetchContent_MakeAvailable", "falcon_add_plugin"], - cpp: ["#include", "class", "public", "bool", "override", "return", "true", "false", "const", "auto"], + cpp: ["#include", "class", "public", "bool", "override", "return", "true", "false", "const", "auto", "static", + "void", "if"], csharp: ["using", "namespace", "public", "class", "override", "bool", "return", "true", "false"], java: ["package", "import", "public", "class", "extends", "boolean", "return", "true", "false", "@Override"], json: ["true", "false", "null"], From 56ee6cee74b588d8d0787cbbdc51291870b44686 Mon Sep 17 00:00:00 2001 From: NaySurGithub <96527285+NaySurGithub@users.noreply.github.com> Date: Wed, 4 Nov 2026 23:55:32 +0100 Subject: [PATCH 2/2] docs: point the wasm tutorial at the plugin sdk --- plugins.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/plugins.js b/plugins.js index 984732a..226fbd5 100644 --- a/plugins.js +++ b/plugins.js @@ -57,14 +57,15 @@ FALCON_PLUGIN(MyPlugin)` wasm: [ { title: "Build the module", - text: "Generate the C bindings from falcon.wit with wit-bindgen and build a " + - "core module with clang and a WASI sysroot. The server loads the core module, not a component.", + text: "Generate the C bindings from wasm/falcon.wit in the plugin SDK with " + + "wit-bindgen and build a core module with clang and a WASI sysroot. The server loads " + + "the core module, not a component.", file: "build.sh", syntax: "cmake", - code: `wit-bindgen c wit --out-dir build + code: `wit-bindgen c PluginAPI/wasm --out-dir build clang --target=wasm32-wasip1 --sysroot="$WASI_SYSROOT" -mexec-model=reactor -O2 \\ - -Ibuild -Iwit/c -o build/MyPlugin.wasm \\ - MyPlugin.c wit/c/falcon_wasm.c build/falcon_plugin.c build/falcon_plugin_component_type.o` + -Ibuild -IPluginAPI/wasm/c -o build/MyPlugin.wasm \\ + MyPlugin.c PluginAPI/wasm/c/falcon_wasm.c build/falcon_plugin.c build/falcon_plugin_component_type.o` }, { title: "Write the plugin",