Compiling MTASA: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
m (Reverted edits by Marcin778 (talk) to last revision by Necktrox)
Line 1: Line 1:
Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi
In order to successfully build Multi Theft Auto from source, it is necessary to perform a number of steps, which we will explain below.
Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi
 
Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi
Please read the instructions carefully and do not skip parts of it, if you have no experience.
Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi
 
Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi
== Prerequisites ==
Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi
 
Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi
You should be using Windows 7 or above, before you can compile the Multi Theft Auto client.
Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi
 
Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi
Make sure you have the following software and SDKs installed:
Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi
 
Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi
=== Visual Studio 2015 ===
Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi
[[File:Visual_Studio_Community.PNG|left|150px|link=https://www.visualstudio.com/vs/]]
Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi
'''Download'''<br>
Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi
[https://www.visualstudio.com/vs/ Microsoft Visual Studio 2015] (Community Edition is free).<br>
Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi
 
Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi
'''Addon: EditorConfig''' (optional)<br>
Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi
Download: [https://visualstudiogallery.msdn.microsoft.com/c8bccfe2-650c-4b42-bc5c-845e21f96328 EditorConfig]<br>
Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi
(Install this addon to automatically set up your IDE for the correct code formatting)
Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi
 
Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi
'''Addon: ReAttach''' (optional)<br>
Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi
Download: [https://visualstudiogallery.msdn.microsoft.com/8cccc206-b9de-42ef-8f5a-160ad0f017ae ReAttach]<br>
Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi
(ReAttach gives you an easy way to re-attach your prior debug targets)
Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi
 
Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi
'''Missing #include "afxres.h"'''<br>
Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi
[[Media:Vs2015_foundationClasses.png|Make sure you have ''Microsoft Foundation Classes for C++'' installed.]]<br>
Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi
(You can re-run the installer to modify your current installation, no need to uninstall and reinstall)<br style="clear:both">
Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi
 
Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi
=== Microsoft DirectX SDK ===
Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi
[[File:DirectX_SDK.jpg|left|150px|link=https://www.microsoft.com/en-us/download/details.aspx?id=23549]]
Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi
'''Download'''<br>
Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi
[https://www.microsoft.com/en-us/download/details.aspx?id=23549 Microsoft DirectX SDK (August 2009)]<br>
Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi
 
Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi
'''S1023 Error'''<br>
Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi
[https://support.microsoft.com/en-us/kb/2728613 "S1023" error when you install the DirectX SDK (June 2010)]<br style="clear:both">
Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi
 
Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi
=== Git Client ===
Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi
[[File:Git_logo.png|left|32px|link=https://git-scm.com/]]
Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi
You have three options here available. You can install '''ONE''' of the clients below (for collaboration) or download the entire codebase in a [https://github.com/multitheftauto/mtasa-blue/archive/master.zip .ZIP] file (if you only want to compile the code). You can also use Git on the command line to checkout the respository.<br style="clear:both">
Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi
 
==== GitHub Desktop ====
[[File:GitHub_Desktop.png|left|150px]]
'''Download:'''<br>
[https://windows.github.com/ GitHub for Windows]<br style="clear:both">
 
==== SourceTree ====
[[File:Atlassian_SourceTree.png|left|150px]]
'''Download:'''<br>
[https://www.sourcetreeapp.com/ SourceTree]<br style="clear:both">
 
==== GitKraken ====
[[File:GitKraken_Logo.png|left|150px]]
'''Download:'''<br>
[https://www.gitkraken.com/ GitKraken]<br style="clear:both">
 
== Getting the latest source code ==
 
To get the latest code, you will have to download the latest copy of our Git repository.<br>
We recommend cloning the repository in your Git client, because you can pull any updates from there easily.
 
* '''Repository:''' [https://github.com/multitheftauto/mtasa-blue multitheftauto/mtasa-blue]
* '''.zip:''' [https://github.com/multitheftauto/mtasa-blue/archive/master.zip master.zip]
* '''.tar.gz:''' [https://github.com/multitheftauto/mtasa-blue/archive/master.tar.gz master.tar.gz]
 
== Compiling the code ==
# Execute the script '''create-projects.bat'''
# Open the solution file '''MTASA.sln''' in the '''Build''' directory
# Compile in Visual Studio with '''Debug''' configuration (may take some minutes)
# Install data files: '''utils\premake5.exe install_data''' (''Shift + Right-Click'' in the ''top-level'' directory and click on [http://michaelcrump.net/files/image_635243330608233338.png ''Open command window here''])
# Install resources: '''utils\premake5.exe install_resources''' (optional step)
 
= Running the software =
 
== Running the client ==
 
You can start your client in the '''Bin''' directory. You might find there a ''Multi Theft Auto.exe'' and/or ''Multi Theft Auto_d.exe'' executable. The ''_d'' suffix indicates a debug build of the software.<br>
Furthermore, you can also run your client inside the debugger from Visual Studio if you want to investigate a stack trace or set breakpoints in interesting code regions (read more in the section Debugging below).
 
== Running the dedicated server ==
 
If you already have run the step 5 (''Install resources'') in ''Compiling the code'' to install resources then you can goto ''Starting the server''.
 
=== Installing the latest resources ===
If you want to run the Multi Theft Auto dedicated server, you will have to install the required resources. These are required because they implement the most basic functionality (e.g. spawning players) in order to play.
 
Our official resources repository is [https://github.com/multitheftauto/mtasa-resources hosted on GitHub]. You can download the latest resources from there or [http://mirror.mtasa.com/mtasa/resources/ download a zipped version]. Make sure that you have the latest resources package.
 
=== Starting the server ===
To run the server, open the ''MTA Server.exe'' executable in the '''Bin/server''' directory. The ''_d'' suffix indicates a debug build of the software.<br>
You can also run the debug build ''MTA Server_d.exe'' with the Visual Studio Debugger (as of writing, you can do that by right-clicking on the Server's Launcher project and selecting ''Start a local instance'' in the ''Debugger'' menu), but you can also attach to a running debug build MTA server (see more in the section Debugging below).
 
== Debugging ==
 
If you already compiled the code in the '''Debug''' configuration then continue reading, if not, then go up to ''Compilling the code'' and follow the steps for a ''Debug'' build.<br>
You can either launch MTA yourself and attach any debugger you want to use (also applies to the Visual Studio debugger) or you start a local debugging session in Visual Studio.<br>
If you choose to run MTA with Visual Studio then you should also attach the debugger to the executable '''gta_sa.exe''' (press ''CTRL + ALT + P'' in Visual Studio) - otherwise your
breakpoints will not work for anything beside the MTA Launcher project.<br>
Furthermore, it is advisable to create an empty "timeout.longtime" file in your ''Bin/server/'' directory<br>
This will extend the time before players are kicked from your server for unresponsiveness to 120 seconds. This is useful when in Debug mode on the client and the process is halted.
 
[[File:Local_Windows_Debugger.PNG]]
 
[[File:Attach_to_Process.png|600px]]
 
[[File:ReAttach_to_GTASA.PNG]]
 
You can use [https://visualstudiogallery.msdn.microsoft.com/8cccc206-b9de-42ef-8f5a-160ad0f017ae ReAttach] to re-attach the debugger to the '''gta_sa.exe''' executable whenever you start your local debugger in Visual Studio.
 
= Getting involved =
Please see our [[Coding guidelines]] for information on coding practice.
 
= Additional information =
If you need more information, try our [http://bugs.mtasa.com/ bug tracker] or [irc://irc.multitheftauto.com IRC channel].
 
[[pt-br:Compilando o MTASA]]
[[ru:Compiling MTASA]]
[[Category: Development]]

Revision as of 18:38, 1 January 2017

In order to successfully build Multi Theft Auto from source, it is necessary to perform a number of steps, which we will explain below.

Please read the instructions carefully and do not skip parts of it, if you have no experience.

Prerequisites

You should be using Windows 7 or above, before you can compile the Multi Theft Auto client.

Make sure you have the following software and SDKs installed:

Visual Studio 2015

Visual Studio Community.PNG

Download
Microsoft Visual Studio 2015 (Community Edition is free).

Addon: EditorConfig (optional)
Download: EditorConfig
(Install this addon to automatically set up your IDE for the correct code formatting)

Addon: ReAttach (optional)
Download: ReAttach
(ReAttach gives you an easy way to re-attach your prior debug targets)

Missing #include "afxres.h"
Make sure you have Microsoft Foundation Classes for C++ installed.
(You can re-run the installer to modify your current installation, no need to uninstall and reinstall)

Microsoft DirectX SDK

DirectX SDK.jpg

Download
Microsoft DirectX SDK (August 2009)

S1023 Error
"S1023" error when you install the DirectX SDK (June 2010)

Git Client

Git logo.png

You have three options here available. You can install ONE of the clients below (for collaboration) or download the entire codebase in a .ZIP file (if you only want to compile the code). You can also use Git on the command line to checkout the respository.

GitHub Desktop

GitHub Desktop.png

Download:
GitHub for Windows

SourceTree

Atlassian SourceTree.png

Download:
SourceTree

GitKraken

GitKraken Logo.png

Download:
GitKraken

Getting the latest source code

To get the latest code, you will have to download the latest copy of our Git repository.
We recommend cloning the repository in your Git client, because you can pull any updates from there easily.

Compiling the code

  1. Execute the script create-projects.bat
  2. Open the solution file MTASA.sln in the Build directory
  3. Compile in Visual Studio with Debug configuration (may take some minutes)
  4. Install data files: utils\premake5.exe install_data (Shift + Right-Click in the top-level directory and click on Open command window here)
  5. Install resources: utils\premake5.exe install_resources (optional step)

Running the software

Running the client

You can start your client in the Bin directory. You might find there a Multi Theft Auto.exe and/or Multi Theft Auto_d.exe executable. The _d suffix indicates a debug build of the software.
Furthermore, you can also run your client inside the debugger from Visual Studio if you want to investigate a stack trace or set breakpoints in interesting code regions (read more in the section Debugging below).

Running the dedicated server

If you already have run the step 5 (Install resources) in Compiling the code to install resources then you can goto Starting the server.

Installing the latest resources

If you want to run the Multi Theft Auto dedicated server, you will have to install the required resources. These are required because they implement the most basic functionality (e.g. spawning players) in order to play.

Our official resources repository is hosted on GitHub. You can download the latest resources from there or download a zipped version. Make sure that you have the latest resources package.

Starting the server

To run the server, open the MTA Server.exe executable in the Bin/server directory. The _d suffix indicates a debug build of the software.
You can also run the debug build MTA Server_d.exe with the Visual Studio Debugger (as of writing, you can do that by right-clicking on the Server's Launcher project and selecting Start a local instance in the Debugger menu), but you can also attach to a running debug build MTA server (see more in the section Debugging below).

Debugging

If you already compiled the code in the Debug configuration then continue reading, if not, then go up to Compilling the code and follow the steps for a Debug build.
You can either launch MTA yourself and attach any debugger you want to use (also applies to the Visual Studio debugger) or you start a local debugging session in Visual Studio.
If you choose to run MTA with Visual Studio then you should also attach the debugger to the executable gta_sa.exe (press CTRL + ALT + P in Visual Studio) - otherwise your breakpoints will not work for anything beside the MTA Launcher project.
Furthermore, it is advisable to create an empty "timeout.longtime" file in your Bin/server/ directory
This will extend the time before players are kicked from your server for unresponsiveness to 120 seconds. This is useful when in Debug mode on the client and the process is halted.

Local Windows Debugger.PNG

Attach to Process.png

ReAttach to GTASA.PNG

You can use ReAttach to re-attach the debugger to the gta_sa.exe executable whenever you start your local debugger in Visual Studio.

Getting involved

Please see our Coding guidelines for information on coding practice.

Additional information

If you need more information, try our bug tracker or IRC channel.