5 releases

0.2.0 Jan 13, 2023
0.1.3 Jan 2, 2023
0.1.2 Dec 30, 2022
0.1.1 Dec 30, 2022
0.1.0 Dec 15, 2022

#1060 in Game dev

MIT license

480KB
1.5K SLoC

defold-rs

defold-rs

Crates.io

Tools for creating Defold native extensions in Rust.

Quick Start

You will need:

Follow the instructions in the build server's README to get it built and running. Once it's up, open the template project in Defold and open /myextension/src in a Rust-compatible IDE. To tell Defold to use your build server, select File > Preferences > Extensions and set Build Server to http://localhost:9000. Once that's done, you can just press Ctrl+B in Defold to begin compiling your project! The first build will take some time while it downloads files from Defold's servers and compiles the crate from scratch.

What is Defold?

Defold is a free and open-source game engine focused on making fast, lightweight games for desktop, web, mobile, and console with zero setup. Almost all game logic is written in Lua scripts, but the engine also provides a way to extend its functionality with C++ using native extensions.

What are native extensions?

Native extensions allow you to extend Defold's functionality using C++ or any platform-specific language. You can write extensions in JavaScript for web games, Java for Android, or Objective-C for macOS/iOS. Defold's extension SDK (dmSDK for short) grants you much deeper control of the engine than standard Lua scripts and is great for performance-sensitive processing.

So what's defold-rs then?

It's two main pieces that come together to let you write native extensions in Rust:

  • defold-rs - This repository is home to the dmsdk and dmsdk_ffi crates. In short, dmsdk_ffi contains auto-generated bindings to the dmSDK and dmsdk wraps those unsafe bindings into a nice Rust-y package.
  • defold-rs-extender - A fork of Defold's extension build server with added Rust support. You'll need to run one of these yourself in order to use this project.

Dependencies

~1.1–3MB
~69K SLoC