#Can someone make Bevy's Bundles make sense?

20 messages · Page 1 of 1 (latest)

white abyss
#

What's the point in bundling components if bundles can't be entities? For example, what's the point of making a "PlayerBundle" bundle to ensure players get all of the proper components, when I'd have to create a whole separate marker component for filtering, say "PlayerMarker" to query any of those components and know I'm getting the right one? How am I supposed to identify anything without creating a bunch of marker structs that are useful for nothing but filtering?

crystal wyvern
#

Bundles are effectively "suggestions of components that go well together"

#

They're primarily a documentation / learning / ergonomics thing

grand marlin
#

I also see them as a form of basic code deduplication

crystal wyvern
#

Yeah, definining constructors on them is really handy to help with that further

exotic mortar
#

What's wrong with using marker components that make you want to avoid it?

crystal wyvern
#

As for querying specific things, marker components are really handy. For the most part though, I tend to find myself thinking about broad classes of things, and systems that operate on entities regardless of the exact details of what type of object they are

#

(althoug Player often gets special treatment)

exotic mortar
#

An entity can be conceptualized as a particular set of components, so if only Players have a particular set, querying for only and exactly those will in effect get all of the Players, no marker necessary

white abyss
#

I'm just trying to figure out the clean way to handle entity component enforcement. Is there not really a good way to enforce that entities receive components other than making a commands.spawn() wrapper?

exotic mortar
#

You enforce it by writing the code that does it

grand marlin
#

You can use an injector pattern based on observers, if you'd like

white abyss
#

gotcha.

#

I'm super new to the enforced ecs thing, I came from Godot a couple months ago

grand marlin
crystal wyvern
#

You'll like the required components pattern that Cart's been proposing over in #1264881140007702558 I suspect

crystal wyvern
grand marlin
#

The required components proposal is a game changer for the ergonomics

#

Can't wait to see it in

exotic mortar
#

That looks very useful. Looking forward to it.