Godot V: 4.2.1
Hey, good day everyone! long days and pleasant nights.
I was wondering about a couple of performance related things.
Context:
I am developing a VR book reading application for the quest 2 + 3 (only got a 2, but it should work on the 3) where you can actually pick up the books. So this would include a lot of book models and a library which the player can wander around in.
Bit by bit ill figure it out, but the main problem I do not want to bump into again is performance. Since this is a redo of the project, first time around was in unity, where unity itself decided to crap out on me (issues with exporting the game to the quest). Where I also ran into heavy performance issues. Some notable “fixes” include: not unzipping every .epub file every time you open it, not loading every book right of the bat.
So I wanted to put my current approach on the table and ask some kind strangers for advice on how it could improve and if my methods are sound.
As what I am intending on implementing currently is a system where every book is a frozen grab-able rigid body. frozen to avoid collisions.
Where the nodes under the rigid body are the collision shape and a “Handler”.
When the book is grabbed it calls a function within the handler which switches the low detail model the book is currently using to a high detail model (disable low detail child node, enable high detail child node) and enables text and pictures.
With this it loads in the actual “book” from the VersOne .epub library together with object references which were previously initialized as null global variables.
At the loading of a chapter (like when it opens) it assigns the chapter to the left page (so one whole chapter of a book).
At the second frame it gets the AABB.Size.Y of the text and the amount of characters on the page.
then it divides the number of characters by AABB.Size.Y/28 (28 fits on the book model properly) and cuts off the characters after the found index.
It will repeat this divide and cut until the size is under 28 (to ensure that no \n messes with it).
When going to the next page it will do the same as above but with the cut text, when going back a page it will use the index it saved of where the previous page began within the big piece of chapter text.
Thank you for any advice!
Kind regards,
Lilith