GothicKit / ZenKitCS

C#-bindings for ZenKit, the ZenGin asset parser.
https://zk.gothickit.dev/
MIT License
4 stars 1 forks source link

Materializing World causes two issues for Vobs #2

Closed JaXt0r closed 6 months ago

JaXt0r commented 6 months ago

Materializing world is fine for calling ZenKit DLL only once and might add small performance improvements. Unfortunately there are two issues as of now:

  1. If we Materialize the world, we also materialize the whole Vobs. From what I understood, materialized objects/structs have no representation inside ZenKit after materializing and are therefore readonly on ZenKit side (e.g. no saving of changed values possible).
  2. Vobs are only materialized as VirtualObjects, but not as subclasses like the unmaterialized ones. But it's needed to fetch specific properties. (see image below)

image

Suggestions from my current understanding:

  1. Add a world materialization option to stick with Vobs "unmaterialized" and keep the possibility to store them on a savegame later. (As only VobItems will have position changes, I could also think of materializing everything except VobItems)
  2. When creating materialized VirtualObject class, then subclass the actual types as it's done for unmaterialized ones.
JaXt0r commented 6 months ago

After discussions with Luis:

  1. If we materialize, we have no handle back to ZenKit for Vobs. But as we want to save changes, we need this and therefore can't use Materialize(). With unmaterialized Vobs, we can use the existing subclassing already.
  2. It's possible to Materialize() certain world elements only. The solution for us is now:
    • zkWorld.Mesh.Materialize()
    • zkWorld.BspTree.Materialize()
    • zkWorld.WayNet.Materialize()
    • zkWorld.RootObjects #Vobs

Closed as a workaround exists already.