I start learn rust lang.
Seems very good for games.
How about add rust support to UE?
I think it be big step to UE game stability.
No any try?
Donât want to re-learn another language. I tried it a bit and seems pretty different. Not bad but i feel like C++ is more suited for game development anyway. Plus there are other more important things like improving the C++ workflow and improving Live++ and so on.
Maybe Unreal Basic will make the engine complete, one day. The right way to make super basic games.
Stability doesnt come from a language.
Then instead of 50,000 lines of C++ to make a small game we would only need 4 million lines of basic!
Nope. That claim will not hold.
lol I see you donât know Futurama.
that is just a reference to an episode of Futurama
I understand! Still doesnât make it true.
I took a look.
Itâs the same as binding any DLL, in Rust you wrap everything into a extern âCâ {âŚ} and then compile your Rust application as *.so or *.a library.
Then you load the library into Unreal and call functions from it. Boring stuff, making extern C functions is the most boring thing to do even if you use automatic header generation tools.
Every time you need something more you have to add more extern functions
No need to poll, no need to ask. If you think it is good, why dont you make it yourself, and then present it here?
Rust is actually interesting as a binding because no need for memory management AND no garbage collector needed either.
But yeah, if you want to use it you have to write extern C api yourself and do BP â C++ â C â RustâŚ
Then Rust â C â C++ â BP.
That is very annoying code to deal with once you go above the HelloWorld level.
Btw I know that some AAA studio migrated to Rust doing that, just donât remember which one. Maybe was âReady at Dawnâ, not sure.
I went over a small test just to see if Unreal would allow this or if it would complainâŚ
Turns out itâs possible to make it work indeed:
Rust application compiled as --lib:
extern âCâ interface:
called Rust functions from within Unreal projectâs module:
works fine:
[HR][/HR]
Now all you need is an ARMY of programmers to port Unrealâs code to Rust language
Good luck lol
In theory yes.
In practice I would need funding to do that, because that would become a full-time job for me.
Also, what exactly do you mean with âsimplerâ?
My first programming language I ever used was BlitzBasic, and I still love the way it was structured.
Do you mean THAT simple or you mean âsimple like C# and Javaâ?! ( those arenât simple, they just hide complexity)
I have no ideaâŚ
I canât drop my job to do it, so what I am saying is itâs probably not going to happen anytime soon.
I wouldnât encourage anyone to wait for it. Can be done, but I wonât even talk about âwhensâ and âifsâ⌠right now I only tinker with these things on weekends.
Iâm not familiar with Rustâs FFI stuff, how much work would it be to transfer more than primitive data types across the boundary? Would it just require doing the mapping into structs on Rust side and annotating them with #[repr(C)]? What about C++ side?
Iâm not familiar either, but I think Rust has a âBoxâ (itâs literally called box) mechanism which you can use to collect C data such as complex structs and then manipulate them within an unsafe block.
I think it can also share pointer addresses with C code, but Iâm not sure how that works either.
Their docs have this example, calling C function from Rust side:
extern "C" {
ââââââ fn abs(input: i32) -> i32;
}
fn main() {
unsafe {
println!("Absolute value of -3 according to C: {}", abs(-3));
}
}
Box is just used for managing the ownership of heap allocated data, I donât think itâs required here (not sure how trait objects would work here, if at all).
Btw, Iâve found something very useful I didnât know existed:
I would reconsider UE4/5 over Unity if it had Rust. Especially since Unity may never support Rust. While I could live with C#, itâs not as ideal for games as Rust because of its GC.
The thing with Rust is that it is intended to replace C/C++ in the entire industry altogether, not just in game development. And it is getting very close to that goal.
Itâs voted 4 times(if I recall) in a row as the Github favorite.
It is almost as accessible as C# but as fast as C/C++.
Itâs even as a âsystem languageâ a safe language. No seg faults, no dangling pointers, no nulls, no headers, and it got safe threads. Data Oriented design over the OOP non-sense.
Itâs eventually going to be fully embraced by Microsoft. According to them, C/C++ is not a valid choice anymore. 70% of their security flaws could have been avoided with Rust. Security may not be an issue with games, at least offline games, but when Microsoft makes the final move to fully embrace it. Rust obviously will come to Visual Studio and the entire MS ecosystem, including DirectX. A COM Rust binding generator is already in the works by MS.
As somebody who comes from C -> C# -> F#. I got zero regrets so far with Rust. Iâm still amazed that a âsystem languageâ could be designed in such an accessible way, almost as if it was something like managed code C#/F#.
As somebody who follows not too closely, bot close enough the evolution of AI these days. And witnessed the super human genius of AI. It wouldnât come as a surprise to me if somebody like MS could come up with a AI based translator that can convert full C/C++ code to idiomatic Rust. No need to waste time on mere bindings for UE. Convert the entire engine.
For all we know UE5 could be already on a road map for such a full conversion to Rust. Like I said, Rust is meant to replace C/C++ not just to compete with it as yet another language. And so far the signs show that it does a very good job at it. Not to mention that such a converter would be a huge use outside of MS as well. There is certainly need for that.