🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

rvscript: Fast RISC-V-based scripting backend for game engines

Started by
0 comments, last by Kaptein 4 years ago

https://github.com/fwsGonzo/rvscript

This script requires compiling ahead of time. If that is not for you, then you should still be using LuaJIT or v8.

If you like the thought of being able to use C++, Rust, Zig (or any other language capable of producing RISC-V binaries) as script for your game engine, then this is for you!

Having implemented scripting in several ways over the years, this is my favorite so far. Back in the day I wrote my own silly language, before I realized I could use VBscript from .OCX. Once I graduated to C-like languages I learned about TCC which let me compile C code to memory and run natively - fairly unoptimized of course, but that doesn't matter. There are several issues with running natively and I never want to do it again. Not knowing if a symptom could come from the script trashing your memory, or even just registers is really bad.

Later on I moved on to Lua and I never really started using LuaJit because I liked being able to use the newest features all the time. I have since benchmarked LuaJit and it's on normal short script-like code only around twice as fast as Lua. It's much faster on math, of course.

So why even bother using a compiled script of all things? Well, to be brutally honest it was the “local” and starting at 1 on arrays and other things. Lua is awesome, but I wanted to see if I could use any language I wanted that could produce RISC-V. So far I've only tried C++17 and Rust and no problems with each. Setting everything up and making it all play nice together took me several months, but most of that work is now in that single repo. I don't expect this to be something for everyone - in fact, I expect it to be for almost no one ?

But, just in case you're interested in using whatever language you want in a VM, here it is.

-gonzo

This topic is closed to new replies.

Advertisement