Open Noxmore opened 1 week ago
It's also very likely with this new approach I'll make maps spawn via a regular Bevy Scene asset, then having Map (to be renamed to QMap most likely) and Bsp acting like Gltf: just a middle man containing handles and source data.
I figure I'd put this into an issue to track it, make sure my thoughts are in order, and in case anyone who is using this crate wants to weigh in on the new API's design.
The current system
My problems with this approach
Requirements for a new solution
.map
s and.bsp
s. I want to be able to do things like edit brushes at runtime if loading a.map
, and it should be able to serialize just fine.My current idea
Because you can derive from as many base classes as you want in FGDs, we might be able to just treat them like an analog to Bevy components, this should fit in very nicely with the required components coming in Bevy 0.15, which I'm planning to release the next version of this crate using. Specifically, the programmer will use procedural macros, sort of like this:
This gets a bit dicey when requiring components that aren't don't implement BaseClass, we could use a
#[base(...)]
attribute instead, but I'd really like to treat entity classes as close to components as possible. An alternative could be the user just not being able torequire()
such components, and using component hooks instead?Entity classes will only be able to contain fields of types that implement FGDType (currently called TrenchBroomValue).
Geometry
For BSPs,
Mesh3d
s pointing to a mesh handle from the BSP asset should be just fine. For.map
s, we'll probably have a Brushes component that computes the meshes at runtime, and can be easily serialized. This would be wasteful for use cases that only include static geometry, but in those cases i can't think of a reason BSP wouldn't be preferable to use anyway, so it's probably fine.Registering
app.register_point_class::<InfoPlayerStart>()
).bsp
branch, TrenchBroomConfig is stored behind an Arc inTrenchBroomServer
), because the registry shouldn't really change.inventory
. This gives up flexibility and verbosity for simplicity. Right now i don't really have a strong preference for any of these, but i don't think it matters nearly as much as the API covered above.