Current memory stores a set of tiles without difference what cell they belong to, using a following structure:
- Key:
- agent half extents
- tile position
- tile collision geometry data as a single mesh
- off mesh connections
- water levels
- Value - recastnavigation navmesh data (array of bytes)
- Key size takes 70% of cache size.
- Total cache size is about 1.8 GiB for default Morrowind including only all official expansions and mods, default agent half extents and initial objects transformations.
- Format can't be changed without keeping compatibility. Users should not be forced to regenerate cache each time we decide to change things because it's a fast operation.
- Separate in-memory index has. This allows to avoid reading from disk if tile is not present in the cache.
- Index should not bloat memory usage. In-memory cache key can't be used as is.
- Cache access should be asynchronous. It should not block threads for realtime navmesh generation.
- It can be pregenerated from .esm/.esp files without openmw application involvement. Standalone tool and component that can be used from launcher and editor.
1. Find tile by full key in-memory cache, use tile if found.
2. Find tile by short key in disk cache index, schedule (3) reading from disk if found or fallback to generation (4).
3. Find tile by full key in disk cache, use tile if found or fallback to generation (4).
4. Generate a navmesh tile from a given full key.
5. Store tile to in-memory cache.
6. Schedule tile writing to disk cache.
7. Update disk cache index.
There are open questions:
1. What is a short key?
- Cell id (name for interior and position for exterior) and tile position.
Pros:- Small size.
- False positives for index hit.
- Loose binary files.
- ESM extension.
- SQLite database.
- Custom single binary file storage.