News for hackers. Stuff that matters.
Re:The Bevy Foundation by 999900000999 on Tuesday March 12, 2024 @11:41AM (#39680858)
Thanks, I'll donate soon.

Also this is a long shot, but any chance of supporting higher level languages. Maybe it calls the underlying Rust code from C#

Re:The Bevy Foundation by james7132 on Tuesday March 12, 2024 @12:36PM (#39681525)
A scripting language is an explicit non-goal for first-party support, but there have been tools for using the ECS entirely without Rust types which can be exposed via FFI or embedded languages like Lua.

Just search "_by_id" in the bevy_ecs docs, and you'll find all of the associated APIs for access. There are then (unsafe) APIs for creating the internal mappings necessary to use them. These are normally called via the monomorphized generics automatically, but need to be manually called since we don't have compile time knowledge of the data being stored and accessed.

Re:The Bevy Foundation by 999900000999 on Tuesday March 12, 2024 @04:44PM (#39684701)
So basically it's possible, but not recommended.

Maybe the next time I'm on vacation I'll embrace rust...

Re:The Bevy Foundation by james7132 on Tuesday March 12, 2024 @07:35PM (#39686219)
Given the fact that foreign values inherently require the use of unsafe due to not being able to verify anything about the value and it's behavior, yes, it's generally not recommended unless you're looking to write your own scripting integration plugin. Likewise, most of these scripting language runtimes are almost always not threadsafe in the slightest, requiring either single threading all scripted behavior, expensive locks, and heavy use of marshalling, which negates a lot of the performance benefits of the engine.

For more developer experience oriented reasons why this is done, I strongly suggest reading cart's reasons for making Bevy to begin with: https://github.com/bevyengine/bevy/discussions/8107#discussi.... More specifically the "Turtles all the way down" bullet point.

Re:The Bevy Foundation by LegibleCrimson on Tuesday March 12, 2024 @12:33PM (#39681479)
I think that's impossible. Bevy works heavily with Rust types and generic monomorphization. You couldn't do that in another language without literally generating Rust code and calling the compiler.