Rust Development Thread

Have you tried it on real hardware? I'm willing to try if you are unable.

It works on hardware for prior versions. My device is currently 1.12.3 with no update available. I suspect it will just work on hardware, but feel free to give it a shot and report back if you feeling motivated!

Tested and working on hardware with Playdate SDK 1.13.1.

1 Like

It looks like you have already figured out an effective solution for developing games for the Playdate using the Rust language. Have you tried the other examples in the C_API folder? If so, do you have any tips or advice on how to get them up and running? Additionally, I recommend checking out the official Playdate SDK Documentation for more information and resources related to MLSDev - software development company

I wrote a "Getting Started with Playdate" blog post that covers the following. Last time I checked, the information can be used to run all of the C and Lua examples.

  • Pulp. Running downloaded PDX files in the simulator.
  • Lua. Running project-based Lua examples.
  • Lua. Running single-file Lua examples.
  • C API. Running examples.
  • Links to documentation.

Although none of the information is specifically related to Rust, it is useful in practice. crankstart provides Rust bindings to the C API, so it is important to be familiar with the C API when developing in Rust. Furthermore, last time I checked, the C API documentation was written with the assumption the reader is familiar with the Lua documentation. Understanding development with Pulp is not important when working in Rust.

I have also written related articles on getting started with Playdate development in Rust, Fortran, and ASM. The Rust post summarizes this thread, but it is written in a tutorial format. There is also a post on "Using cc-rs to Mix Rust with C, C++, and ASM", if you want to do mixed language development.

1 Like

@sgeos Great posts!
In near future, I hope, will see updated tooling for development in Rust, and so you probably update thus part about complexity. It because all goes to outer simplicity. I working on it. Look at videos in attached post.

1 Like

Thanks for doing the OS/Sim v2.0 update work Alex! I've been following along on forum threads and GitHub. Am I right in thinking that it's probably best to wait for the next SDK release before trying to get started with Rust on Playdate?

1 Like

Rust tooling was broken when I last tried to build for the latest SDK. My guess is that this is still true?

Current state as I know:
Crank is fixed and supports 2.0.1 SDK and works.
I still not regenerate new bindings but there was pr with some fixes as I remember. Will look at it tomorrow.
Currently I’m working almost fulltime on the alternative build system and “std”, kind of. probably it can become next version of crank. It can’t replace crankstart because of really different api there.
As I hope I’ll open it in a week or two, :man_shrugging:t2:
Also we’re thinking about some interesting good changes in the “pd-rs” github-org…

@sgeos do you mean crank or crankstart or both of them?
This pr fixes compatibility issues for crank.

@briandorsey depends on expected level of comfort and spending time you’re ready for. Crank works, so why not?..

Also about “probably next crank”:
I’m a little bit exhausted and need help with it, as I suppose. So I can give private access to the repo if someone want it. But state is not ideal yet. But it works as you can see on previously mentioned screencasts.

A was getting a CAPI-related crash when testing on hardware. The simulator has always just worked.

That’s probably the reason to try my private side-project :wink:

Anyway I’ll try to fix crank again.

Could you try again with current state? Latest crank should work, crankstart just updated and also should work too.

Thanks for the encouragement! I was able to build and run all three crankstart examples both in Sim and on device.

3 Likes

Has anyone been able to build/run Klondike recently? I keep failing with

error: the `#[alloc_error_handler]` in std conflicts with allocation error handler in: crankstart

error[E0152]: duplicate lang item in crate `crankstart` (which `klondike` depends on): `panic_impl`

I was able to build/run all of the examples. cargo check --all-targets (and vscode rust-analyser) does complain about crankstart with the same errors, but this doesn't seem to actually interfere with running the demos.

This is happening with:

$ rustc --version
rustc 1.82.0-nightly (a7399ba69 2024-08-31)

on 3f4db6a (HEAD -> main, origin/main, origin/HEAD) Merge pull request #91 from pathehir/main of crankstart and 2bc5428 (HEAD -> main, origin/main, origin/HEAD) Merge pull request #2 from notpeter/bump of crankstart-klondike.

Also, @fzzr, is your /playdate repo the “probably next crank” that you mentioned? :slight_smile: I found it as I was typing this comment. If you would still like some help with it, I'd be happy to chip in, although I am a newbie with both Playdate and Rust development. I'm eager to learn about both though.