Skip to content

tpill90/epic-lancache-prefill

Repository files navigation

epic-lancache-prefill

view - Documentation ko-fi

GitHub all releases dockerhub

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

Overview

Features

  • Select apps to prefill through an interactive menu.
  • No installation required! A completely self-contained, portable application.
  • Multi-platform support (Windows, Linux, MacOS, Arm64)
  • High-performance! Downloads are significantly faster than using Epic Games, and can easily reach 10gbit/s or more!
  • Game downloads write 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!

Table of contents

Initial Setup

Note New to Linux? See this detailed tutorial : Install Guide For Linux Beginners

Note Interested in using Docker instead? See : Docker Setup Guide

Note Using Unraid? See : Unraid Setup Guide

  1. EpicPrefill can be run on both the Lancache server itself, or on your gaming machine as an alternative Epic client. You should decide which one works better for your use case.
  2. Download the latest version for your OS from the Releases page.
  3. Unzip to a directory of your choice

Warning Linux and macOS will require executable permissions to be granted with chmod +x ./EpicPrefill prior to running the app.

Note Alpine Linux requires additional dependencies to be installed for the .NET runtime : Alpine Linux Dependencies

Optional Windows Setup

Configuring your terminal to use Unicode will result in a much nicer experience with EpicPrefill, for much nicer looking UI output.

Initial Prefill

As the default console in Windows does not support UTF8, you should instead consider installing Windows Terminal from the Microsoft App Store, or Chocolatey.

Once Windows Terminal has been installed you will still need to enable Unicode, as it is not enabled by default. Running the following command in Powershell will enable it if it hasn't already been enabled.

if(!(Test-Path $profile))
{
    New-Item -Path $profile -Type File -Force
}
if(!(gc $profile).Contains("OutputEncoding")) 
{ 
    ac $profile "[console]::InputEncoding = [console]::OutputEncoding = [System.Text.UTF8Encoding]::new()";
    & $profile; 
}

Getting Started

Selecting what to prefill

Warning This guide was written with Linux in mind. If you are running EpicPrefill on Windows you will need to substitute ./EpicPrefill with .\EpicPrefill.exe instead.

Prior to prefilling for the first time, you will have to decide which apps should be prefilled. This will be done using an interactive menu, for selecting what to prefill from all of your currently owned apps. To display the interactive menu, run the following command

./EpicPrefill select-apps

Afterwards your Browser of choice will open to ask you to login to Epic Games. Simply login with your mail-address, your password and hopefully a mfa-token from your authenticator app of choice. Epic Login

Now copy the "authorizationCode" thats shown in your Browser and paste it in your terminal and press enter. Your login should be cached and automatically being refreshed everytime you use EpicPrefill.

Once logged into Epic Games, all of your currently owned apps will be displayed for selection. Navigating using the arrow keys, select any apps that you are interested in prefilling with space. Once you are satisfied with your selections, save them with enter.

Interactive app selection

These selections will be saved permanently, and can be freely updated at any time by simply rerunning select-apps again at any time.

Initial prefill

Now that a prefill app list has been created, we can now move onto our initial prefill run by using

./EpicPrefill prefill

The prefill command will automatically pickup the prefill app list, and begin downloading each app. During the 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 300mbit/s connection was used). Once the prefill has completed, the Lancache should be fully ready to serve clients cached data.

Initial Prefill

Updating previously prefilled apps

Updating any previously prefilled apps can be done by simply re-running the prefill command, which will use same prefill app list as before.

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

Prefilled app up to date

However, if there is a newer version of an app that is available, then EpicPrefill will re-download the app. 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 app has an update

Frequently Asked Questions

Can I run EpicPrefill on the Lancache server?

You certainly can! All you need to do is download EpicPrefill 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 EpicPrefill 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

Can EpicPrefill be run on a schedule?

Yes it can! Scheduled jobs can be easily setup on Linux using crontab, and can be flexibly configured to run on any schedule that you desire. Jobs are configured by specifying an "expression" that describes the schedule to run on. Some examples of cron expressions:

Schedule Cron Expression
Every day at 2am

0 2 * * * $PWD/EpicPrefill prefill

Every 4 hours

0 */4 * * * $PWD/EpicPrefill prefill

If the above examples don't cover your use case, crontab.guru is an online cron expression editor that can interactively edit cron expressions, and explain what they mean.

Once you have determined a cron expression, you can then create a job using the following:

Note This command should be run in the same directory where EpicPrefill is installed

job="cron expression here"; { crontab -l; echo "$job"; } | crontab -

After running the command, you can verify that the job was successfully created with crontab -l. If the output matches below, then your job is correctly configured!

Crontab jobs

Can I fill my cache using previously installed Epic games?

Unfortunately it is not possible to fill a Lancache using games that have been installed with Epic. The installed games are in a different format than what Lancache caches, as they are decrypted and unzipped from the raw request. The decryption/unzip process is not reversible. Thus, the only way to get games properly cached is to redownload them using either EpicPrefill or Epic

How can I limit download speeds?

You may want to limit the download speed of EpicPrefill to prevent it from potentially saturating your entire connection, causing other devices to suffer from massive latency and poor speeds. This issue is known as bufferbloat, and more detailed information on the issue can be found here: What is bufferbloat?

EpicPrefill does not currently contain any functionality to limit its own download speed, and due to the way that downloads are implemented will likely never be able to throttle its own download speed. Additionally, even if EpicPrefill was able to throttle itself, the same issue would persist with downloads through Epic.

One method to limit bandwidth would be to configure Quality of Service (QOS) on your router, limiting bandwidth to the Lancache server, or by prioritizing other network traffic. A general overview of QOS can be found here : Beginners guide to QOS

For more brand specific guides (non-exhaustive), see :

Detailed Command Usage

Note Detailed command documentation has been moved to the wiki : Detailed Command Usage

Updating

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

Update available message

Automatically updating

  • Windows
    • Run the .\update.ps1 script in the executable directory
  • Linux
    • First time only : Grant executable permissions to the update script with chmod +x ./update.sh
    • Run the ./update.sh script in the executable directory

Manually updating:

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

Docker updating:

  • sudo docker pull tpill90/epic-lancache-prefill:latest

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 #epic-prefill channel.

Additional Documentation

Acknowledgements

  • @Joly0 for all your help with testing!