Hyperlaunch - devlog 2
Hyperlaunch is a Minecraft launcher that tries to be as efficient as possible without compromise.
Progress
-
Caching: I finally made a proper global caching system! Its purpose is minimising the network traffic, both for launch speeds and general efficiency. It can get big at times, so I also added compression, using the Brotli algorithm for speed.
The cache sits in front of every network request. The cache will try to minimise the cost of the network request where possible. Often, it will just find a cached version instead of using the network.
The cache works by URL. It splits the URL into domain name and resource. Take Hyperlaunch’s Stardance project page as an example; if it were to be
cached, the directory would be stardance.hackclub.com, and the
resource would be projects/28654. The resource name is hashed with
XxHash128, a hashing algorithm that’s not used for storing secrets, then
the file at the URL is cached at .hyperlaunch/cache/<directory>/<resource hash>. If the file came with caching instructions (either ETag or Last-Modified HTTP headers), then those are stored alongside the cached file as separate files (see the image attached.)
- Parallelism: The launcher now handles each task at the same time, instead of in order. This is probably the biggest speedup so far.
- Instances: The launcher can now handle multiple installs as instances! This means multiple setups can coexist, and users can pick between them. Think MultiMC or PrismLauncher.
- CLI: Reworked a lot of the CLI as part of these changes.
Difficulties
- Maybe I’m just new to C#, but I found a lot of the HTTP stuff confusing. One example is using the Last-Modified header. If you want to use this header, you need to access the
response.Content.Headersvariable. For all other headers, you accessresponse.Headers. - Brotli compression also seemed unusually difficult. It only works on
Streamobjects, and the syntax was strange which resulted in a few unintentional logic bugs that I just didn’t know how to spot.
Video and some photos of the cache in action below.
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.