Gothic-UnZENity-Project / Gothic-UnZENity

Community rebuild of classical Gothic 1 and 2 in Unity engine. Currently focusing on a native VR implementation.
GNU General Public License v3.0
10 stars 2 forks source link

Cache world mesh + static VOB mesh to be calculated only once #117

Closed JaXt0r closed 1 month ago

JaXt0r commented 2 months ago

Background

Loading world.zen currently takes about two minutes (on a Quest2). Most of the time is consumed by calculating world mesh chunks and assigning the mesh (etc.) to the proper game objects.

Solution

We can store the created objects and its components in cache files. Either via plain YML/JSON/binary files or to something sophisticated like glT where we can Export/Import whole GOs+Components at runtime.

Tasks

Links

JaXt0r commented 1 month ago

WARNING: I checked with glTF implementation, but it lacks features which we need to store and retrieve in parallel

  1. It stores UV values as Vector2 only
  2. It doesn't store Color32 data
  3. It also doesn't store SkinnedMeshRenderer data. Therefore the water pipe is broken and can't be used
  4. Not quite sure, but I also think meshes won't be reused but when restored from glT file, they leverage new vertices all the time.

Therefore I recommend we build the save+retrieve logic fine tuned to our needs on our own. We can still check their open source implementation for details: https://github.com/atteneder/glTFast

JaXt0r commented 1 month ago

Closing for now due to lack of performance gain and complexity increase on the named solution above. Alternatives and possible next steps are documented in here: https://github.com/Gothic-UnZENity-Project/Gothic-UnZENity/pull/146#issuecomment-2393713233

Feel free to create a new ticket with some proper solution based on the current investigations and dead ends. ;-)