Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Demo project for comment, and my own thoughts on the Bevy API. #73

Open
LaserWitch opened this issue Sep 10, 2023 · 1 comment
Open

Comments

@LaserWitch
Copy link
Contributor

As touched on in #65 I have a little demo project that I've been using for prototyping, and it encapsulates both my expected usage and my hacks in service of #65 and #69 pretty well. That project is now public at https://github.com/LaserWitch/lw_bevy_lua_demo. The code is rough in spots, and probably the documenting too, but it currently checks all the boxes I expect to need checked for my game project. Any pointers for improvement or other thoughts on it would be useful, and anything that can be made a crate feature you're welcome to lift of course.

After working with it a bit, the provided bevy API is surprisingly solid in many ways. I originally expected to need to do more work myself when it came to providing direct access to fields on components. My thoughts on potential areas of improvement might show in where I wrote helpers, but I'll try to think of them now...

  • Adding functions to an API is somewhat crunchy syntax. A few macros to ease that might make sense, though just helper functions might be as good in many cases...
  • Which brings to mind a more meta point: the crate can take a long time to build, which I found when I was making and testing changes on pr branches. Not sure if macros are the cause or not, or if it's avoidable, but seems worth mentioning.
  • I have (Vec3) component that's Deref and DerefMut, and if memory serves I needed to do v.1 in lua to get at it's components at all. That surprised me.
  • I believe at one point I had a Vec<> that was exposed to lua, and I found that it was 0-indexed and lua's length() reported it one element shorter than it actually was.
  • I think we have to register any tuple type we're going to expose to Lua, which might be unavoidable but was an unpleasant surprise.
  • How we're able to just stack up API providers is quite nice. The one questionmark I am left with is if it's possible to for two API providers to provide world methods without conflict...
  • Also it'd be nice if we could iterate over userdata members with pairs() but I think that's probably deeper Lua nits.

That's what I can recall right now!

@makspll
Copy link
Owner

makspll commented Sep 16, 2023

Great work! I am a bit stretched for time right now but I'll be trying to incorporate a lot of the features discussed recently into the next release (albeit slowly). Your feedback is invaluable and thank you for taking the time to write it out!

After working with it a bit, the provided bevy API is surprisingly solid in many ways

That's good to hear! it's in very early stages at the moment and I am also quite surprised myself haha!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants