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).
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