Difference between revisions of "FAF Dev School Client"

From FA Forever Wiki
Jump to navigation Jump to search
m
Line 8: Line 8:
 
First thing to do is to make sure you've got yourself a GitHub account, and a local copy of the code at https://github.com/FAForever/client
 
First thing to do is to make sure you've got yourself a GitHub account, and a local copy of the code at https://github.com/FAForever/client
  
For a guide to doing this, see the lesson on GitHub: http://wiki.faforever.com/index.php?title=FAF_Dev_School_Git
+
For a guide to doing this, see the [[FAF_Dev_School_Git|lesson on GitHub]]
  
 
We'll also need an install of python 2.7 '''(32 Bit version)''', 'python' and 'pip' added to the system path, as well as PyQT (version 4) installed from https://riverbankcomputing.com/software/pyqt/download
 
We'll also need an install of python 2.7 '''(32 Bit version)''', 'python' and 'pip' added to the system path, as well as PyQT (version 4) installed from https://riverbankcomputing.com/software/pyqt/download
Line 43: Line 43:
  
 
More detail on the code to be added soon!
 
More detail on the code to be added soon!
 
 
 
  
 
== The Hard Way ==
 
== The Hard Way ==

Revision as of 08:06, 14 May 2016

This lesson is all about the Git - a version control system that FAF uses to manage it's codebase.

We're going to cover how to run the code once we've downloaded it, and do a quick overview of what different parts of the code do.


The Easy Way

First thing to do is to make sure you've got yourself a GitHub account, and a local copy of the code at https://github.com/FAForever/client

For a guide to doing this, see the lesson on GitHub

We'll also need an install of python 2.7 (32 Bit version), 'python' and 'pip' added to the system path, as well as PyQT (version 4) installed from https://riverbankcomputing.com/software/pyqt/download




At this point, I'm assuming you've got the GitHub Desktop client open and have successfully loaded the FAForever/client repository into it.

Right click on the client fork (on the left side) and select "Open in Git Shell"

Before we do the next step we might want to edit the client/requirements.txt file, removing the line "lupa". This isn't actually needed in the code, and can save us some trouble trying to install it.

Now type the following command into the open shell window:

   pip install -r requirements.txt

This installs all the extra stuff we need to run the client.

To run the dev client, all we need to do now is run the command:

   python src

Now we've got the client running, we can start making changes and testing them to see what happens.

An overview of the code:

appveyor/ - some fun stuff for turning the code into an executable (but not something we need to worry about) lib/ - some external bits of code that FAF requires to run, again something we don't need to worry about. res/ - this folder contains all the non-code materials that FAF uses. For example, the exact layout of the client window as well as things like colours and stylings are set in here. Everything in this folder is moddable using themes. src/ - contains all the python code that FAF needs to run.


res/ and src/ are the two main areas of interest, each of these contain subfolders that contain files whose purpose matches the folder name. For example, the chat folder contains stuff relevant to the "Chat Lobby" tab.

More detail on the code to be added soon!

The Hard Way

The hard way to run the client code is inside a separate VM managed by Vagrant, a tool for standardising the dev environments of different developers. In theory this should be the easy way; it should be pretty plug and play, and with everyone using it you all have the same problems and can help each other to solutions.

In practice, nobody seems to run the client code this way and there are some unresolved issues with the Vagrant setup (that can be worked around).

Here's a lesson I wrote in November 2015 for setting up the Vagrant environment:


Step 1: Getting a Dev Environment

This is all about using Vagrant to set up your dev environment inside a virtual machine. If you don't want to do dev on a virtual machine then you'll have to install the libraries on your main computer.

So first off we want to set up our dev environment, so we can run the code and make changes. Theres a few things we'll need:

   1) Github Account - https://github.com/
   2) Our own fork of the repository - https://github.com/FAForever/client
   3) Vagrant - https://www.vagrantup.com/
   4) VirtualBox - https://www.virtualbox.org/


I also recommend getting the GitHub client, its a super handy tool for managing your changes to the code with a pretty UI :) - https://desktop.github.com/

Once you've forked the code online, you can download it locally from the GitHub desktop client. In the top left there is a + symbol, select it and then click clone. From there select the client repository to download it.

Next we open up a git shell (to do this from desktop client, right click the client repository, it should appear on the left, and select open in git shell), and type the command: vagrant up This runs a virtual machine where we can run the code in the same environment as everyone else. That should mean we don't have any problems :)

If you have a problem running this command, make sure you're in the right directory, you should be in the "client" folder.

Once the virtual machine is up and running, we just need to do 2 things:

   1) Install sip
   2) Run the code

For some reason sip doesn't come as standard in the VM, but we can easily fix that ourselves. From the VM download https://riverbankcomputing.com/software/sip/download and unzip it. Then double click on the configure.py inside it to set it up (you may have to double click twice).


To run the code, open up a powershell; you should see the icon for this on the taskbar. Then run these two commands:

   cd C:\vagrant
   C:\Python27\python.exe src

The code should run and we're away :)


PS if its not working (and it probably won't be for weird reasons):

To fix run the commands:

   cd C:\vagrant
   C:\Python27\python.exe C:\Python27\lib\site-packages\pip uninstall enum
   C:\Python27\python.exe C:\Python27\lib\site-packages\pip install requirements.txt


Install: http://www.microsoft.com/en-gb/download/details.aspx?id=5555

Edit the return line (line 100 at last check) of the get_git_version() in src/config/version.py to: return "0.11.3" instead of: return version

Comment out lines 1 and 15 to 20 in file src/fa/init_file.py

Try running again with the command: C:\Python27\python.exe src