Skip to content

Getting The Project

Eric R edited this page Aug 12, 2019 · 1 revision

Overview

There are two important differences about this project that may trip you up if you're not familiar:

  • The project contains a submodule
  • The project uses git LFS

Submodules

A submodule is essentially a repository that exists inside another repository, its parent. In this project, the submodule is the UnityChessLib repository, which exists in both the UnityChess and UnityChessServer projects.

Q: "Why use submodules at all?"

A: The reason has to do with the decision to not use a Unity-built server build. In order to build my own server, the server needs to know how the game works. The UnityChessLib submodule is the logic of "how the game works", and does not depend on Unity at all. Not using a submodule would mean having to manually keep the two versions (UnityChess version, UnityChessServer version) in sync, which just sounds extremely tedious.

Q: "Why do you want to build your own server?"

A: Cuz.

Git LFS (Large File Storage)

You can think of Git LFS as software that augments git. It speeds up how git handles serving large files when you, say, checkout another branch. The downside of LFS is Github doesn't serve those aforementioned large files when you ask for them in a zip. Instead, what you'll get are pointers, which are of no practical use to you. If you'd still like to get a zip, you'll unfortunately have to wait until Github addresses the issue (if ever), or ask someone who's cloned the project to zip it for you.

Q: "Can you zip it for me?"

A: I'd rather you learn how to clone the project yourself. The issue is that a zip is a static version of the project, so the second you want to import a new change, you'll be wanting another zip. Multiply that by the number of people that want a zip...

Getting the Project

Okay, so you've decided to bite the bullet. I'll give you the rundown on how to clone the project using SourceTree, because that's what I use. If you're using command line then I refer you to this down by the "Cloning a Project with Submodules" section, and do read the section about forking below.

  • Download/Install SourceTree
    • At some point in the installation process, it'll ask if you want to install git. Do install it.
    • When you're finished installing, I recommend associating your Github account in the settings. That process may or may not be involved depending on how you've set up permissions with your Github account.
  • Download/Install Git LFS
  • Clone the project
    • Copy the HTTPS git URL from project page.
      • You might consider forking the repo at this time and using your fork's URL just so you can have a remote you can actually push to. Keep in mind that if you do fork UnityChess, you'll probably also want to fork UnityChessLib and subsequently change the submodule URL to point to your UnityChessLib fork. But you knew that already, didn't you ;)
    • In SourceTree, open a new window/tab and hit the Clone button.
    • Paste the URL in the "Source Path / URL" text box, then click out of the box to trigger SourceTree to verify the URL.
    • Under "Advanced Options":
      • Set Checkout branch to 'development' branch.
      • There is an advanced option to "Recurse submodules". Be sure that is checked.
    • Hit the big blue Clone button, wait for it to finish cloning.
  • Verify you're on the right submodule branch.
    • With the project cloned, SourceTree should have opened a UnityChess repo window. There should be a drop-down in the left pane called "Submodules". Use that to find and open the UnityChessLib submodule by double-clicking its name.
    • If you were able to open the submodule, SourceTree should have opened a new repo window for you. In the UnityChessLib repo window, verify you're on the right branch (branch with the same name as the branch you're currently on in UnityChess repository window). NOTE: SourceTree will sometimes kick you off your current submodule branch if you switch branches on the parent repo. Always double check you're on the right branch when you do something like that.