I’ve spent the last 6 weeks or so working on a big project. I’ll document that in a lot of other posts.
While doing that, I’ve learned a lot about UE4 and found that most of the things that you want it to do, it already does. It’s just not documented. I’ll have a lot of articles about this stuff. It’s part my contribution to my community, and part reminder so I don’t forget the tricks I have learned.
So, sometime in the last 6 months, the Epic developers switched from an old school system where they made you download a couple massive zip files every time the version changed (Required1.zip and Required2.zip, remember those?) to using a piece of software called GitDependencies, which they’ve hooked to git checkout and git merge so that it runs every time you could potentially need new dependencies.
This software is a lot better than I originally gave it credit for. It checks a manifest XML, and then checks what files you have. If the hashes don’t match, it downloads the new stuff you need.
That’s great – except when you have a slow internet connection like mine sometimes is here in Vietnam. So, I spent the last 6 weeks or so cursing this piece of software and vowing to take a look at it to add some intelligent caching behaviour to it when I got a moment.
Turns out, Epic already did that. And they did it pretty well. The command line options of GitDependencies include a way to specify the cache path, as well as the cache size, retention time and some other options.
If you don’t set a cache path (and the defaults don’t do that), it defaults to storing a cache per clone of UE4. This is great if you only have one copy of UE4. It’s terrible if you don’t. But they’ve thought of that as well.
To use a global cache (which you should do if you have more than one engine directory!), simply set the UE4_GITDEPS environment variable. This is a path to your global cache. When set correctly, it will pull things you’ve already downloaded for other engines out of the cache directory and use that, instead of downloading them again.
Now, there’s some features missing. You can’t set the other cache settings via environment variable, which you sorely need since you don’t want to have to change the GitDependencies bat file for each engine install you have.
That will be a project of mine soon – I’ll fork the engine and add those environment variables to GitDependencies.
Hope this helps someone.