![]() |
We present a number of improvements to our URL system, which is the basis for all engine resource loading and saving:
- We introduced castle-config:/ URL protocol, to save files in a system-specific place (directory) that is “persistent” for given user.
- It points to a specific directory that is by convention writeable and should be used to save user data. For example, something like
C:/Users/<username>/AppData/Local/<application_name>/
on Windows or/home/<username>/.config/<application_name>/
on Linux and FreeBSD. We follow system-specific conventions and APIs. - This replaces previous
ApplicationConfig
routine. - It is consistent with castle-data:/ which is read-only location with your application data.
- It points to a specific directory that is by convention writeable and should be used to save user data. For example, something like
- We added
TCastleMemoryFileSystem
– useful to create a temporary filesystem, living only in memory, registered at given URL.It is, for now, our implementation of
castle-config:/
on the web — so the data is not persistent if you reload the page, but at least it makes sense within a single session. This made our portable editor possible. Of course it is a TODO to actually persist the data using WWW browser mechanisms.That said,
TCastleMemoryFileSystem
may be useful for your own purposes too, if you want a temporary virtual filesystem in your application. -
RegisterUrlProtocol
exposes now a class that allows to configure URL behavior. (So we can extend the functionality offered by custom URLs, aka virtual file systems, without adding more and more parameters toRegisterUrlProtocol
.)- One can register an
TRegisteredProtocol.ExistsEvent
handler for custom URLs, to configure howUriExists
behaves for them. - And
TRegisteredProtocol.FindFilesEvent
, to configure howFindFiles
behaves.
- One can register an
- Many built-in URLs, and URLs pointing to ZIP (using
TCastleZip
), and URLs pointing toTCastleMemoryFileSystem
, use above, so their resources can be tested usingUriExists
and searched usingFindFiles
. -
Queries like
UriExists('castle-data:/my_texture.png')
on the web are also useful now, as we usecastle-data:/auto_generated/CastleDataInformation.xml
to test data files existence.
What’s the image shown at this news post? Chibi Gear Solid by glenatron on Sketchfab, cool 3D scene rendered using our Castle Model Viewer. It has no relation to this news post (except that’s it’s rendered using our engine and you can download it too and turn into a game right now!), just something pretty I wanted to show 🙂
Start the discussion at Castle Game Engine Forum