Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

ECS is like a whole another language on top of Rust, and it is dynamically typed.

If you add a scripting language and blueprints, you're shortening the feedback cycles by using Rust less.

I like Bevy, but it seems like Rust currently is much better suited for making game engines than the games themselves. Some "RustScript" is needed.



> ECS is like a whole another language on top of Rust, and it is dynamically typed.

Can you elaborate? Or did you mean dynamically dispatched?


1. You dynamically add components to any entity, so entities don't have a static type. Semantically they're comparable to a JavaScript Object where you can add and remove properties at will, rather than being structs or class instances with a closed set of fields.

2. Bevy's entity references are generational IDs, without static lifetime guarantees (and restrictions) of Rust's references.


> so entities don't have a static type.

They do, they're `Entity`, always.

> where you can add and remove properties at will

I don't think this is true for either `Component` or `Entity` in Bevy. You set what fields a `Component` has when writing the code, then it remains so during the runtime. There is no dynamically adding/removing fields at runtime, at least yet.

What you do tend to do in Bevy is adding/removing `Component`s to `Entity`s at runtime, is that maybe where the confusion comes in?


> They do, they're `Entity`, always

Yes, technically, but in how they're used - no. They're a dynamic type.

> What you do tend to do in Bevy is adding/removing `Component`s to `Entity`s at runtime

Yes, this is dynamic typing. Or, at least, one way to look at it - and what allows games to be iterated on quick.


> Yes, technically, but in how they're used - no. They're a dynamic type.

No, they're really not. Are you talking about Archetypes or something else? Because an Entity is just a ID + a generation, that's it. Nothing more and nothing less. You don't define them as more/less, nor do you use them are more/less either.

> Yes, this is dynamic typing. Or, at least, one way to look at it - and what allows games to be iterated on quick.

I guess a `Vec<u8>` is also then dynamic typing in your mind as you can add/remove elements to the vector? Doesn't really compute for me personally, but whatever floats your boat.


I think they used it more as an analogy: components fill a similar role as properties do in JavaScript.


But that's not really true either, is it? You don't query properties in JavaScript, at best you query for Objects of a certain shape/name. You don't encapsulate data in properties so one object has many different behavior based on those, you either split the Object into many different ones and have one parent, or you mix the behavior into the same Object.


Yeah I it's not right. Although, it's a decent early mental model for a JS dev learning ECS to adopt until better intuition develops!


Something wrong with Lua? ;)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: