#Bevy and FFI

13 messages · Page 1 of 1 (latest)

tepid obsidian
#

I'm interested in writing my game in language X, but, unfortunately, language X's infrastructure for making games isn't any good. Bevy, though, looks very promising, so I've thought of using Bevy for all I/O (like rendering, getting user input, UI), but to entirely ignore the "ECS" part and handle all the game logic via FFI, passing user input to language X and getting back scene updates.

I'm new to FFI and Bevy, so I have some fears regarding this approach. Would it be possible to use Bevy this way? What are the penalties?

Thanks.

still copper
#

You'll have a performance and latency overhead, and a ton of boilerplate to write

#

Would be feasible though

tepid obsidian
#

I hope that boilerplate won't be that huge. Thanh you very much.

still copper
#

Do a very small proof of concept first before you commit 🙂

#

And try to pass messages back and forth, rather than doing arcane memory sharing nonsense

tepid obsidian
#

Oh, that's an important suggestion. Haven't thought of it.

still copper
#

Yeah, decoupling things and making a nice API will help a ton. Mostly comes up in the context of modding, but relevant here

sharp spruce
#

also out of my own language nerd curiosity, what is language X? Curious if it's something I've heard of or not

tepid obsidian
#

That's Haskell. I'd like to build game logic and handle game state changes via FRP, Functional Reactive Programming (specifically Monadic Stream Functions). Rust just seems not to support such constructs in such extent without tons of macro.

still copper
#

oh super interesting

sharp spruce
#

ah, neat. And yeah if you want monads in rust the best you can get is some hacks with GATs. I'm very much in favor of rust getting HKTs but unfortunately few others seem to be :(
Be interesting to see how well the integration works out.