The new class TCastleDownload allows to download data over
https asynchronously, without blocking the main thread of the application. This means that you can trivially continue rendering and game logic, while some resource are being downloaded over the network.
I made a demo in examples/network/asynchronous_download/. It demonstrates multiple simultaneous downloads, and underneath a glTF animation is playing with smooth 60 FPS without any breaks.
The class supports all CGE URLs, like
castle-data and more.
Manual chapter about networking was updated to reflect all new possibilities.
- The download can be observed (looking at Status, DownloadedBytes, TotalBytes).
When it’s finished, look at Contents (if success) or ErrorMessage (if error, that is
Status = dsError).
We can read MIME type from server (can be used throughout our engine to designate file type).
It’s actually a full-featured HTTP(S) web request. You can specify HttpMethod, like GET, POST, PUT etc. For POST, you can provide form data as PostData. Arbitrary HTTP headers can be specified using AddHeader.
- examples/network/castle_download/ was reimplemented. It implements a simple command-line downloading tool (like
curlusing our engine) using
examples/network/remote_logging/ sends now asynchronous HTTP POST message using new
This feature was done thanks to your support on Patreon. It was requested by Peardox. Many thanks! If you like what I’m doing, please support our engine.
Start the discussion at Castle Game Engine Forum