Downloading/Editing/Compiling an Open-Source App (VS, Git)

Patchmaking tutorials for NBA 2K13.

Downloading/Editing/Compiling an Open-Source App (VS, Git)

Postby Leftos on Wed May 15, 2013 1:05 am

So, I see that some of you are disappointed to see me go to the other side of the fence considering I won't be working on game-specific tools (Roster Editor, Roster Workshop, Speech Recognition, etc.). However, as I've mentioned, all my work outside of 2K Sports will remain open-source, so anyone may pick up any of my projects, edit it, improve it, wreck havoc on it, and then compile and release it. The process is quite easier than you might think, as it requires no programming knowledge to just grab the latest version of the source code and compile it to enjoy on your own or release to the public.

A note before we begin: Some of my programs come with a explicit, yet quite unrestrictive, license. Whether this license exists explicitly, I'd appreciate that no matter what you do, you keep credit to me as the creator of the software intact. Feel free to add credit to your own amazingness wherever, but please, do not remove any existing notices or any places where my name appears.

So, here's how to download the source code of any of my tools using Git and the free version of Visual Studio (an Integrated Development Environment for C++ and all .NET languages (C#/F#/VB.NET, etc.)) from Microsoft. Same instructions apply to any other open-source project you find on GitHub or other Git repository hosting services (e.g. BitBucket) and that includes a Visual Studio solution file (i.e. a project file that will allow you to open, edit and compile the whole app in Visual Studio).

1. Download Microsoft Visual Studio Express 2012 for Desktop Applications:
1a. Go to http://www.microsoft.com/visualstudio/e ... s-products.
1b. Click on Download.
1c. Click on Visual Studio Express 2012.
1d. Click on Visual Studio 2012 Express for Windows Desktop.
1e. Click Install Now (this is the web installer; you can use the alternative options if you want to download the whole installer and install on another computer).
1f. Download and run the installer.
1g. Accept the user agreement, click on Install Now, wait a bunch.
1h. Run Visual Studio once. You may register online for a free key at some point if you plan to use it beyond 30 days.
1i. Once it opens, it may prompt you for an update. I highly recommend you download and install it before continuing.
1j. Whether you decide to install the update or not, close Visual Studio.

2. Download GitExtensions:
2a. http://code.google.com/p/gitextensions/
2b. Click on Download latest version.
2c. Download and run the installer.
2d. Remember to check both MsysGit and KDiff to be installed. You can leave the rest of the settings on default.
2e. If the installer seems like it's stopped progressing, check your Taskbar for any windows of other installers that may have popped under GitExtensions' installer window. Default options for both KDiff and MSysGit's installations should suffice.

Start here if you want to download a project you haven't previously downloaded.
3. Go to Documents > Visual Studio 2012. Right-click on Projects, and click on Git Clone.
3a. First time you do this, you may be asked to select the interface language, as well as set a Username and E-mail. Do both. Setting a good username and e-mail are important so that if you end up contributing to a project, everyone knows it was your contribution.
3b. In the Repository to Clone box you want to enter the Git Read-Only address of the Git repository of the project you want to download (or clone, in Git terms). For example, if you go to https://github.com/leftos/roster-workshop, you need the git://github.com/leftos/roster-workshop.git address. If you want to be able to contribute directly to the repository by having write access, you'll need to read that up somewhere else, as that's beyond the scope of this tutorial. You don't need write access to the repository if you're only going to do local edits, without "pushing" them back to the publicly available codebase in the Git repository. You can still release the source code with your edits, if any, outside of Git, if all that confuses you. However, I hightly suggest you take the time to learn the basics of Git.
Image
3c. Click on the arrow next to branch. Wait for a second as it downloads the branches of the project, and you'll probably want the "master" branch. Branches are different versions of the source code, such as the latest stable ("master") version, and maybe some experimental or in-development branches where new features or bug-fixes are being tested, without affecting other branches.
Image
3d. Click on Clone. The project's branch will be downloaded, and a subfolder with the project's name will be created inside the Projects folder. Open the project's folder.
You now have the source code downloaded on your computer.

4. Let's compile!
4a. Double-click the solution file to open it.
Image
4b. Do any edits you want.
4c. From the main toolbar, find the Drop-Down that's second to the right of the Start button. It should have two options: "Debug" and "Release". You want the "Release" one, so that the compiled executable (i.e. the program itself) has optimizations that make it faster.
Image
4d. Go to Build > Build Solution.
4e. Go to Documents > Visual Studio 2012 > Projects > [The name of the project here] > [The name of the project again, probably] > bin > Release. There should be an executable file there with the name of the project, or something close to it, and a bunch of other files.
Image
You now have the program compiled on your computer! Ready to run and have fun!

5. Run the program and have fun with it!
6. If you want to release the compiled amazingness to the world for you to show off and for them to enjoy, then make a compressed package (using 7-zip, WinRAR, WinZIP or any equivalent) of every file in the Release folder, upload it wherever, and give others the link!

That's pretty much it. You don't have to do any of this if you want to just run the program again, you'll have the EXE ready to enjoy after completing all of Step 4. If you want to grab another project, just start from Step 3.

Here's a video showcasing Steps 3 to 5 using my Roster Workshop project as an example.
phpBB [video]


So, basically, after setting up your environment by installing Visual Studio and GitExtensions, all you need to do is:
1. Get the URL that gives you read-only (or read-write) access to the Git repository.
2. Clone it somewhere in your computer.
3. Open the Solution file.
4. Switch to Release.
5. Build.
6. Enjoy!
Eleftherios "Leftos" Aslanoglou
NBA 2K AI Software Engineer
Visual Concepts Entertainment / 2K Sports

Used to be "That Tools Guy" around here during the good ol' days. Although you probably remember me as your favorite Podcast host.
User avatar
Leftos
I'm The Pipeline, The Pipeline Is Me
NBA 2K Developer
 
Posts: 5223
Joined: Sun Jun 07, 2009 7:44 am
Location: Novato, CA, USA

Return to NBA 2K13 Tutorials & FAQs

Who is online

Users browsing this forum: No registered users and 1 guest