Code Monkey home page Code Monkey logo

godot-wasm's Introduction

Godot Wasm

Wasmer logo

Addon Status License Version

Warning This project is still in its infancy. Interfaces are liable to change with each release until v1.0.

A Godot extension allowing for loading and interacting with WebAssembly (Wasm) modules from GDScript via the Wasmer WebAssembly runtime.

Documentation

Please refer to the Godot Wasm wiki for guides, FAQs, class documentation, etc.

Getting Started

Godot Wasm can be used as a GDExtension/GDNative addon or Godot module. See the Installation wiki page for full instructions.

Using Godot Wasm involves the following.

  1. Create a WebAssembly (Wasm) module using a language of your choice. See FAQ for more information.
  2. Create a new Godot Wasm instance var wasm = Wasm.new()
  3. Read your Wasm module bytecode var bytecode = FileAccess.open("res://my_module.wasm", FileAccess.READ)
  4. Compile and instantiate your Wasm module using Godot Wasm via wasm.load(bytecode)
  5. Call functions exported by the Wasm module wasm.function("my_function", [])

See the Usage wiki page for full instructions.

Known Issues

  1. A small subset of WASI bindings are provided to the Wasm module by default. These can be overridden by the imports supplied on module instantiation. The guest Wasm module has no access to the host machines filesystem, etc. Pros for this are simplicity and increased security. Cons include not being able to generate truly random numbers (without a workaround) or run Wasm modules created in ways that require a larger set of WASI bindings e.g. TinyGo (see relevant issue).
  2. Only int and float return values are supported. While workarounds could be used, this limitation is because the only concrete types supported by Wasm are integers and floating point.
  3. A default empty args parameter for function(name, args) can not be supplied. Default Array parameters in GDNative seem to retain values between calls. Calling methods of this addon without expected arguments produces undefined behaviour. This is reliant on godotengine/godot-cpp#209.
  4. Web/HTML5 export is not supported (see #15 and #18).

Relevant Discussion

There have been numerous discussions around modding/sandboxing support for Godot. Some of those are included below.

  • Proposal: Implement a sandbox mode
  • Issue Add support for WebAssembly plugins and scripts
  • Proposal Add WASM (WASI) host support (including, but not limited to, the HTML5 target)
  • Proposal: Add a method to disallow using all global classes in a particular GDScript
  • Pull Request: Added globals disabled feature to GDScript class

godot-wasm's People

Contributors

ashtonmeuser avatar trey2k avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.