MontyTRC89 / Tomb-Editor

Tomb Editor
55 stars 15 forks source link

TE: Build Cache #810

Open Raildex opened 3 months ago

Raildex commented 3 months ago

When you have more than 100~ rooms in a level, building it becomes extremely lengthy, depending on the complexity of the rooms.

I suggest adding a "build cache" system that saves a room mesh to disk. I propose a text format such as JSON for the cache, since it's quicker and safer to implement compared to a binary format. After a room was successfully built, a cache representation is written to disk (maybe in the OS temp folder, distinguished by level and room id). The proposed contents are (for legacy) :

Before a room is built, a representation is built and compared to the one on disk. if any of the things does not match, the room needs to be built.

Different Engines should be able to write different cache content. (I.e. the cache is part of the compilation process, not part of the models such as Room.cs )

Raildex commented 3 months ago

Maybe it is enough to store a timestamp within Room. On Compilation, the timestamps between the current data and the cache are compared. If the current data is newer, it needs to be rebuilt.

Questions to clarify: TexInfos are part of the room/vertex data. How should that be handled, since tex infos are dependent on their order and are basically unique between level compilations