Code Monkey home page Code Monkey logo

battlenet-lancache-prefill's Introduction

battlenet-lancache-prefill

Quality Gate Status ko-fi

Automatically fills a Lancache with games from Battle.net, so that subsequent downloads for the same content will be served from the Lancache, improving speeds and reducing load on your internet connection.

Prefilling game

Inspired by the lancache-autofill project for Steam games.

Features

  • Downloads specific games by product ID
  • High-performance! Downloads are significantly faster than using Battle.net, and can easily reach 10gbit/s or more!
  • Game install writes no data to disk, so there is no need to have enough free space available. This also means no unnecessary wear-and-tear to SSDs!
  • Multi-platform support (Windows, Linux, MacOS, Arm64)
  • No installation required! A completely self-contained, portable application.

Table of contents

Initial Setup

  1. Download the latest version for your OS from the Releases page.
  2. Unzip to a directory of your choice
  3. (Linux / OSX Only) Give the downloaded executable permissions to be run with chmod +x .\BattleNetPrefill
  4. (Windows Only - Optional) Configure your terminal to use Unicode, for much nicer looking UI output.
    • Initial Prefill
    • As the default console in Windows does not support UTF8, Windows Terminal should be installed from the App Store, or Chocolatey.
    • Unicode on Windows is not enabled by default, however running the following will enable it if it hasn't already been enabled.
    • if(!(Test-Path $profile) -or !(gc $profile).Contains("OutputEncoding")) { ac $profile "[console]::InputEncoding = [console]::OutputEncoding = [System.Text.UTF8Encoding]::new()"; & $profile; }

Getting Started

Selecting what to prefill

Prior to prefilling for the first time, you will have to decide which games should be prefilled.
A table of all currently downloadable games can be listed with the following command

.\BattleNetPrefill.exe list-products

List Products

This table will show a list of available games, and their corresponding product code.
These product codes will be used in subsequent commands, in order to specify which games to prefill.

Initial prefill

Now that we've decided on some games that we'd like to prefill, we can move onto running the prefill.

One or more games can be downloaded by specifying as many product codes as desired, in this example we will be prefilling 3 total games

.\BattleNetPrefill.exe prefill --products s1 d3 zeus

Alternatively, optional flags can be used to bulk preload products, without having to specify each product code individually. This can be useful when you are interested in installing most of the available games, as specifiying the individual product codes is not required.

.\BattleNetPrefill.exe prefill --all
.\BattleNetPrefill.exe prefill --blizzard 
.\BattleNetPrefill.exe prefill --activision 

During this initial run, it is likely that the Lancache is empty, so download speeds should be expected to be around your internet line speed (in the below example, a 300megabit connection was used).
Once the prefill has completed, the Lancache should be fully ready to serve clients cached data.

Initial Prefill

Updating previously prefilled games

Updating any previously prefilled games can be done by simply re-running the prefill command, with the same games specified as before.

BattleNetPrefill keeps track of which version of each game was previously prefilled, and will only re-download if there is a newer version of the game available.
Any games that are currently up to date, will simply be skipped.

Prefilled game up to date

However, if there is a newer version of a game that is available, then BattleNetPrefill will re-download the game.
Due to how Lancache works, this subsequent run should complete much faster than the initial prefill (example below used a 10gbit connection). Any data that was previously downloaded, will be retrieved from the Lancache, while any new data from the update will be retrieved from the internet.

Prefill run when game has an update

Frequently Asked Questions

Can I run BattleNetPrefill on the Lancache server?

You certainly can! All you need to do is download BattleNetPrefill onto the server, and run it as you reguarly would!

If everything works as expected, you should see a message saying it found the server at 127.0.0.1 Prefill running on Lancache Server

Running from a Docker container on the Lancache server is also supported! You should instead see a message saying the server was found at 172.17.0.1 Prefill running on Lancache Server in Docker

Running on the Lancache server itself can give you some advantages over running BattleNetPrefill on a client machine, primarily the speed at which you can prefill apps.
Since there is no network transfer happening, the prefill should only be limited by disk I/O and CPU throughput.
For example, using a SK hynix Gold P31 2TB NVME and running prefill --force on previously cached game yields the following performance Prefill running on Lancache Server in Docker

Detailed Command Usage

list-products

Displays a table of all currently supported Activision and Blizzard games. Only currently supports retail products, and does not include any PTR or beta products.

These product IDs can then be used with the prefill command to specify which games to be prefilled.

prefill

Fills a Lancache by downloading the exact same files from Blizzard's CDN as the official Battle.Net client. Expected initial download speeds should be the speed of your internet connection.

Subsequent runs of this command should be hitting the Lancache, and as such should be dramatically faster than the initial run.

-p|--products

If a list of products is supplied, only these products will be downloaded. This parameter is ideally used when only interested in a small number of games.

--all, --activision, --blizzard

Downloads multiple products, useful for prefilling a completely empty cache. Can be combined with --products.

--nocache

By default, BattleNetPrefill will cache copies of certain files on disk, in order to dramatically speed up future runs (in some cases 3X faster).
These cache files will be stored in the /Cache directory in the same directory as BattleNetPrefill. However, in some scenarios this disk cache can potentially take up a non-trivial amount of storage (~1gb), which may not be ideal for all use cases.

By running with the additional flag --nocache, BattleNetPrefill will no longer cache any files locally, at the expense of slower runtime.

-f|--force

By default, BattleNetPrefill will keep track of the most recently prefilled product, and will only attempt to prefill if there it determines there a newer version available for download. This default behavior will work best for most use cases, as no time will be wasted re-downloading files that have been previously prefilled.

Running with the flag --force will override this behavior, and instead will always run the prefill, re-downloading all files for the specified product. This flag may be useful for diagnostics, or benchmarking network performance.

clear-cache

Deletes temporary cache files stored in the /Cache directory.
These files are cached in order to dramatically speed up future prefill runs (in some cases 3X faster), however in some cases this disk cache can potentially take up a non-trivial amount of storage (~1gb).

Clear cache command

These cache files will also build up over time, as newer versions of games are released, leaving unused cache data behind that will never be used again.

In the case that you would like to save disk space without having to constantly clear the cache, running prefill with the --nocache flag specified will prevent the cache files from being written in the first place.

-y|--y

Skips the prompt asking to clear the cache, and immediately begins clearing the cache.

Updating

BattleNetPrefill will automatically check for updates, and notify you when an update is available :

Update available message

To update:

  1. Download the latest version for your OS from the Releases page.
  2. Unzip to the directory where BattleNetPrefill is currently installed, overwriting the previous executable.
  3. Thats it! You're all up to date!

Need Help?

If you are running into any issues, feel free to open up a Github issue on this repository.

You can also find us at the LanCache.NET Discord, in the #battlenet-prefill channel.

Additional Documentation

External Docs

Acknowledgements

battlenet-lancache-prefill's People

Contributors

marlamin avatar tpill90 avatar justmaku avatar macwarrior avatar turboslayer avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.