Downloading and building the source: Difference between revisions

From FreeAllegiance Wiki
Jump to navigationJump to search
(fix svn doc link)
m (→‎Visual Studio 2010 SP1: fixed it one more time)
 
(115 intermediate revisions by 12 users not shown)
Line 1: Line 1:
==Downloading the source==
==Downloading the source==


This entry describes how the FAZ Dev team has organized the code in their central repository, how you can get a copy of it, and how you can submit code you wrote to be included in the next release of Allegiance.  
This entry describes how the FAZ Dev team has organized the code in their central repository, how you can get a copy of it, and how you can submit code you wrote to be included in the next release of Allegiance. A list of active tickets on bugs and enhancements is available on the [http://trac.alleg.net/report official bug tracker].


===Repository Setup===
===Repository setup===


Before this section explains how to do download the source code & artwork, here's a little bit of background on how we're set up.
Before this section explains how to download the source code & artwork, here's a little bit of background on how we're set up.


[[Individuals#Thalgor|Thalgor]] has graciously set up a [http://subversion.tigris.org/ Subversion] repository on one of his servers to allow all Allegiance developers to collaboratively develop additions and enhancements to Allegiance.
[[Individuals#Tigereye|Tigereye]] has graciously set up a [http://subversion.tigris.org/ Subversion] repository on one of his servers to allow all Allegiance developers to collaboratively develop additions and enhancements to Allegiance.
This repository is located at http://svn.alleg.net:8080/svn/Allegiance and can easily be browsed with your web browser.
This repository is located at http://svn.alleg.net/svn/Allegiance and can easily be browsed with your web browser.


The repository contains 3 top-level folders: trunk, tag, branch.
The repository contains 3 top-level folders: trunk, tag, branch.
The "[http://svn.alleg.net:8080/svn/Allegiance/trunk/ trunk]" will always point to the latest stable code that has been verified as being "Good." Every time the development team releases a new version, that code will be placed here for reference.
The "[http://svn.alleg.net/svn/Allegiance/trunk/ trunk]" represents the main development line.


Currently, the [http://svn.alleg.net:8080/svn/Allegiance/trunk/ trunk] contains the [[FAZ_R4]] code released on November 1st, 2007.
Currently, the [http://svn.alleg.net/svn/Allegiance/trunk/ trunk] contains the [[FAZ_R6]] code.


The "[http://svn.alleg.net:8080/svn/Allegiance/tag/ tag]" folder contains multiple sub-folders; each points to a particular revision of Allegiance's source code throughout it's development. The purpose of the tag folder is to keep a list of milestones throughout Allegiance's history.
The "[http://svn.alleg.net/svn/Allegiance/tag/ tag]" folder contains multiple sub-folders; each points to a particular revision of Allegiance's source code throughout it's development. The purpose of the tag folder is to keep a list of milestones throughout Allegiance's history.
Currently there are 5 tags within this folder:
Currently there are 5 tags within this folder:


:* "[http://svn.alleg.net:8080/svn/Allegiance/tag/msoriginal/ msoriginal]" which will always point to the original source code provided by Microsoft in 2002.
:* "[http://svn.alleg.net/svn/Allegiance/tag/msoriginal/ msoriginal]" which will always point to the original source code provided by Microsoft on February 5th, 2004.
:* "[http://svn.alleg.net:8080/svn/Allegiance/tag/FAZ_R1/ FAZ_R1]" community release on March 1st, 2006.
:* "[http://svn.alleg.net/svn/Allegiance/tag/FAZ_R1/ FAZ_R1]" community release on March 1st, 2006.
:* "[http://svn.alleg.net:8080/svn/Allegiance/tag/FAZ_R2/ FAZ_R2]" community release on August 1st, 2006.
:* "[http://svn.alleg.net/svn/Allegiance/tag/FAZ_R2/ FAZ_R2]" community release on August 1st, 2006.
:* "[http://svn.alleg.net:8080/svn/Allegiance/tag/FAZ_R3/ FAZ_R3]" community release on December 14th, 2006.
:* "[http://svn.alleg.net/svn/Allegiance/tag/FAZ_R3/ FAZ_R3]" community release on December 14th, 2006.
:* "[http://svn.alleg.net:8080/svn/Allegiance/tag/FAZ_R4/ FAZ_R4]" community release on November 1st, 2007.
:* "[http://svn.alleg.net/svn/Allegiance/tag/FAZ_R4/ FAZ_R4]" community release on November 1st, 2007.
:* "[http://svn.alleg.net/svn/Allegiance/tag/FAZ_R5/ FAZ_R5]" community release on November 16th, 2009.


The "[http://svn.alleg.net:8080/svn/Allegiance/branch/ branch]" folder contains multiple folders as well; each will point to a particular version of code that is in development by the development team. Currently there are two active branches:
The "[http://svn.alleg.net/svn/Allegiance/branch/ branch]" folder contains multiple folders as well; each points to a particular version of code that is currently in development by the FAZ Dev team. There is currently one active branch:


:* [http://svn.alleg.net:8080/svn/Allegiance/branch/FAZR5Dev/ FAZR5Dev] - This branch is being used to test the official changes being made for the 5th release of FAZ.
:* [http://svn.alleg.net/svn/Allegiance/branch/FAZR6/ FAZR6] - This branch contained the latest changes and '''was used for development'''. It was used as a "sandbox" for development & contributions (community patches). Trunk was merged with this branch and some features were dropped.
:* [http://svn.alleg.net:8080/svn/Allegiance/branch/FAZR5Contrib/ FAZR5Contrib] - This branch contains the latest commits, used for "sandbox" development & contributions (community patches).  


As the development team and the community works on the source code, we will copy the source code to our machines, and change it locally. When we've verified our personal changes are "good" we will create a patch file containing all changes made by us from the original, send it to [[Dogbones]] or [[Tigereye]]. They will merge it with the appropriate branch of code. Once the team agrees that we are ready for a release, we'll update the trunk to point to the "latest good" and tag the update in the tag folder.
As the development team and the community works on the source code, we will copy the source code to our machines, and change it locally. When we've verified our personal changes are "good" we will create a patch file containing all changes made by us from the original, send it to [[Zone_Leader#Current_Zone_Leads|Development Zoneleader]]. He will merge it with the appropriate branch of code. Once the team agrees that we are ready for a release, we'll update the trunk to point to the "latest good" and tag the update in the tag folder.


===Checking out the source===
===Checking out the source===


Before you can check out the source code, you will need to install an application to work with the [http://en.wikipedia.org/wiki/Subversion_(software) Subversion] server, allowing you to copy the code onto your machine and send your changes back to the repository:  
Before you can check out the source code, you will need to install an application to work with the [http://en.wikipedia.org/wiki/Subversion_(software) Subversion] server, allowing you to copy the code onto your machine and send your changes back to the repository:  
[http://tortoisesvn.tigris.org/ TortoiseSVN] is a windows GUI for interfacing with Subversion. It makes it easy for you to keep your downloaded source up-to-date with the changes made by the rest of the team and allows you to commit your changes for submission.
[http://tortoisesvn.tigris.org/ TortoiseSVN] is a windows GUI for interfacing with Subversion. It makes it easy for you to keep your downloaded source up-to-date with the changes made by the rest of the team and allows you to create patches / commit changes for submission.


[[Image:SVNCheckout.png|thumb|Tortoise SVN's checkout screen.]] Once you've downloaded and installed the necessary programs, you can check out the latest code by creating a blank folder where you want the source code to be on your machine.
[[Image:SVNCheckout.png|thumb|Tortoise SVN's checkout screen.]] Once you've downloaded and installed the necessary programs, you can check out the latest code by creating a blank folder where you want the source code to be on your machine.


{{Warn|'''Make sure there are no spaces in the path you are checking out to.'''}}
Open that new folder, right click within it, and click {{Verbatim|SVN Checkout}}. In the dialog that pops up, use one of the following repository URLs:


Open that new folder, right click within it, and click {{Verbatim|SVN Checkout}}. In the dialog that pops up, use the following repository URL:
http://svn.alleg.net/svn/Allegiance/trunk/


http://svn.alleg.net:8080/svn/Allegiance/branch/FAZR5Contrib/
Most of your development will be performed from this branch. When you click "OK" the latest code will be copied to your computer into the folder you created.


Most of your development will be performed from the FAZContrib branch. When you click "OK" the latest code will be copied to your computer into the folder you created.
Additional information on checking out code can be found [http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-dug-checkout.html here].
 
{{Note|'''The SVN servers have recently changed address. Development, additionally, has recently changed directory.'''
 
If you had already checked out Allegiance from the R5 days (or before) you can get yourself up-to-date without checking out everything.
 
# First, perform a ''relocation'' from <tt>http://svn.alleg.net:8080/</tt> to <tt>http://svn.alleg.net/</tt>.
# Then, perform a ''switch'' to <tt>http://svn.alleg.net/svn/Allegiance/branch/FAZR6/</tt>.
 
If you are using the console version of Subversion, <tt>cd</tt> to the repository and perform the following:
 
svn switch --relocate http://svn.alleg.net:8080/ http://svn.alleg.net/
svn switch http://svn.alleg.net/svn/Allegiance/trunk
svn update


Additional information on checking out code can be found [http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-dug-checkout.html here].
If you are using other clients as suggested, check their documentation for instructions.}}


===Updating your source code with the team's changes===
===Updating your source code with the team's changes===
Line 56: Line 69:
To Update your code, right click the folder that has the Allegiance source and choose {{Verbatim|SVN Update}}.
To Update your code, right click the folder that has the Allegiance source and choose {{Verbatim|SVN Update}}.


{{Note|This will update files that have been changed locally since the latest update, but only if changes can be merged automatically (if lines changed locally and lines changed with the commit do not overlap, also referred to as a ''conflict''}}.
{{Note|This will update files that have been changed locally since the latest update, but only if changes can be merged automatically (if lines changed locally and lines changed with the update do not overlap, also referred to as a ''conflict''}}.


More information about updating can be found [http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-dug-update.html here].
More information about updating can be found [http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-dug-update.html here].
Line 73: Line 86:
Right-click the folder that contains your allegiance source, and choose {{Verbatim|Create Patch...}} You'll get a screen that asks you to choose all files that should be submitted with the patch.
Right-click the folder that contains your allegiance source, and choose {{Verbatim|Create Patch...}} You'll get a screen that asks you to choose all files that should be submitted with the patch.


Simply check the checkboxes beside all files that should be included, then click {{Verbatim|OK}}. You'll be prompted where to save the .patch file on your machine.
Simply check the check boxes beside all files that should be included, then click {{Verbatim|OK}}. You'll be prompted where to save the .patch file on your machine.
 
Once you have the patch file created, contact any member of the FAZ Dev team and get it to them. Either by email (Zip it up before emailing!!) or other file transfer. PM [http://www.freeallegiance.org/forums/index.php?act=Msg&CODE=4&MID=903 Dogbones] to get your code into the next release.
 
More information about creating patches can be found [http://tortoisesvn.sourceforge.net/docs/release/TortoiseSVN_en/ch05s19.html#tsvn-DUG-patch-1 here].
 
===Additional Information===
 
The few pictures I've used in this post came from the [http://tortoisesvn.sourceforge.net/docs/release/TortoiseSVN_en/index.html TortoiseSVN Documentation]. It's a very thorough set of documentation that explains every function available in Subversion, and how to use them with TortoiseSVN.
 
===Artwork Repository===
 
For those 3D artists out there, we have a separate repository just for you guys to keep your models up to date with other artists, and submit new ones.
 
You can browse all of the artwork available from MS's release of the code at http://svn.alleg.net:8080/svn/AllegArt/branch/FAZDev/
 
Should you have any questions, just post in the Misc. Development forum and someone will be happy to answer.
 
Happy coding!
 
==Building the Source==
 
===Microsoft Visual C++ 2005 Express and 2008 Express===
 
{{Step|1|Download and install the required software}}
 
You will need:
 
* [http://www.microsoft.com/express/2005/download/default.aspx '''Microsoft Visual C++ 2005 Express'''], the free edition of Microsoft’s Visual C++ development environment.. Make sure you tick the "Graphical IDE" during installation.
* [http://www.microsoft.com/downloads/details.aspx?FamilyId=A55B6B43-E24F-4EA3-A93E-40C0EC4F68E5&displaylang=en '''Platform SDK''']
* [http://www.microsoft.com/downloads/details.aspx?FamilyID=371f6ba4-2737-46ab-b275-0dcab31459b5&displaylang=en '''DirectX SDK''']. Note that versions after June 2007 will not work.
 
Check out the Allegiance source code if you haven't already done so.
 
{{Note|For the purposes of this explanation we will assume:
* You installed the Platform SDK in {{verbatim|C:\psdk\}}
* You installed the Direct X SDK in {{verbatim|C:\dxsdk\}}
* You installed Visual C++ in {{verbatim|C:\msvc2005\}}
* You checked out the source code in {{verbatim|C:\alleg\}}
Obviously you will need to replace these with the paths you really used.


----
Once you have the patch file created, upload the patch to the relevant ticket.  You can set the status of the ticket to "worksforme" and that will notify the dev team that it is ready for inclusion into the next build of the beta server/client and eventually into the release.


This KB entry was written for the most recent versions of both SDKs, which were R2 of the Platform SDK and the April 2006 version of the DirectX SDK.}}
More information about creating patches can be found [http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-dug-patch.html here].


{{Step|2|Configure your path}}
===Additional information===


Now open {{verbatim|C:\Alleg\Allegiance.sln}}. If Visual C++ installed correctly it should start, load the project and display and error about “Solution Folders”, which you can safely ignore.
The few pictures used in this post came from the [http://tortoisesvn.sourceforge.net/docs/release/TortoiseSVN_en/index.html TortoiseSVN Documentation]. It's a very thorough set of documentation that explains every function available in Subversion, and how to use them with TortoiseSVN.


We will need to add a few folders to the VC++ path. From the {{verbatim|Tools}} menu, pick {{verbatim|Options}}. Under {{verbatim|Projects and Solutions}} go to {{verbatim|VC++ Directories}}.
===Artwork repository===


For those 3D artists out there, we have a separate repository just for you!  Keep your models up to date with other artists and submit new ones.


{| class="wikitable"
You can browse all of the artwork available from Microsoft's release of the code at http://svn.alleg.net/svn/AllegArt/branch/FAZDev/
| From {{verbatim|Show Directories For}} pick:
! width = 20% | Executable files
! width = 20% | Include files
! width = 20% | Library files
|-
| valign = top | and add this, in order, to the top of the list:
| valign = top | <pre>c:\psdk\bin</pre>
| valign = top | <pre>c:\psdk\include
c:\psdk\include\gl
c:\psdk\include\mfc
c:\psdk\include\atl
c:\dxsdk\include</pre>
| valign = top | <pre>c:\dxsdk\lib\x86 (*)
c:\psdk\lib</pre>
|}


:'''(*)''' Skip this if you are building on a 64 bit platform.
Should you have any questions, just post in the [http://www.freeallegiance.org/forums/index.php?showforum=81 Art and ingame content forum] and someone will be happy to answer.


Confirm all changes and close all dialogs.
Happy coding!


{{Step|3|Change your build target}}
==Building the source==
If a development environment is already setup, please jump directly to the build instructions by clicking the appropriate link below:


Now find the dropdown box in the toolbar which currently says {{Verbatim|Debug}} and change this to {{Verbatim|FZDebug}}{{ref|1}}.


{{Step|4|Fix the dependencies}}
===Setup a development environment===
You need installed:
* Visual Studio 2008 or 2010
* [http://msdn.microsoft.com/en-us/directx DirectX SDK]
* [http://go.microsoft.com/fwlink/?LinkID=182502 Windows SDK]


{{Note|'''Skip this step''' if you are using VC++ 2008 Express.}}
===Visual Studio 2010 SP1===
{{Warn|Please follow the following installation order:
Visual Studio 2010, Windows SDK 7.1, Visual Studio 2010 SP1, Hotfix: ''Visual C++ 2010 SP1 Compiler Update for Windows SDK 7.1''}}
* Double click on the VS2010\Allegiance.sln in your checkout folder.
* Find the drop down box in the toolbar near the top menu bar, make sure it says {{Verbatim|FZDebug}}
** The FZRetail build flavor should only be used for releases.
* From the {{verbatim|Build}} menu click {{verbatim|Build Solution}} (or press F7).
* Your executables will use the Allegiance/1.1 [[#Registry keys|registry keys]], find them in the \objs10 folder, '''you're done!'''.


{|
===Visual Studio 2008 SP1===
| width="10%" | In this file:
* Double click on the VS2008\Allegiance.sln in your checkout folder.
| <tt>c:\msvc2005\VC\VCProjectDefaults\corewin_express.vsprops</tt>
* Just like in [[#Important notes regarding Express & Starter editions]], add your DirectX SDK lib\''ARCH'' and \include.
|-
** '''Important:''' ''ARCH'' is either x86 or x64, you can use the $(PlatformShortName) macro, for example <tt>G:\DX9\lib\$(PlatformShortName)</tt>
| replace this line:
* Find the drop down box in the toolbar near the top menu bar, make sure it says {{Verbatim|FZDebug}}
| <tt>AdditionalDependencies="kernel32.lib" /></tt>
** The FZRetail build flavor should only be used for releases.
|-
* From the {{verbatim|Build}} menu click {{verbatim|Build Solution}} (or press F7).
| with this line:
* Your executables will use the Allegiance/1.1 [[#Registry keys|registry keys]], find them in the \objs9 folder, '''you're done!'''.
| <tt>AdditionalDependencies="kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib" /></tt>
|}


{{Step|5|Build the source}}
====Express & Starter editions====
{{Warn|This probably needs update for R6 and 2010 Express.}}


From the {{verbatim|Build}} menu click {{verbatim|Build Solution}}.
* You must also download and install the Windows SDK and DirectX SDK
* In your Express/Starter edition of Visual studio, you have to add the SDK files to your VC++ Directories options manually:
** Tools->Options...
*** Expand (+) Projects and Solutions->VC++ Directories
**** Select ''Executable files'' then add your Windows & DirectX SDK \bin paths, Select ''Include files'', add your Win & DX SDK \include paths and lastly select ''Library files'' then add your SDK & DX's \lib paths.  For your DX SDK lib path be sure to append ''x86'' to the end. (i.e. G:\DX9\Lib\x86) Pay close attention to these directories, the DX SDK ones especially! {{ScaledDown|Visual_Studio_2008_Express_Solution_Setup.jpg}}
* ATL/MFC is no longer available in the current Windows SDK, [[#Fatal_error_C1083|expect errors]], '''you won't be able to build the AllSrv, AllSrvUI or AGC projects'''. They have become part of none-free editions of Visual Studio 2005/2008/2010 (Standard/Professional/Team System/Premium/Ultimate). [http://msdn.microsoft.com/en-us/library/hs24szh9.aspx]
** You can download an [http://www.microsoft.com/downloads/details.aspx?familyid=0baf2b35-c656-4969-ace8-e4c0c0716adb&displaylang=en old Windows SDK] and copy the include files from ...\include\Win64\mfc and ...\include\Win64\atl into your current Windows SDK include folder. (you can then build everything except AllServUI targeting x86)


{{Warn|
* Solution folders are not supported, expect errors immediately when you load, they are mostly harmless.
If you are using the R2 version of the Platform SDK (current as of September 2006), then when you build you will encounter a couple of bugs in the SDK.


When you try and build, you should see a large number of errors looking something like:
==Registry keys==
FAZ Development builds use the following registry key:  


    'i' : undeclared identifier
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft Games\Allegiance\'''1.1'''


Double-click on one of these errors, it should take you to a line in a header file which declares a loop:
The only entry needed to run the Allegiance client is the string '''ArtPath''', the value must point to the full path of your artwork folder and not have a trailing slash. i.e. <tt>C:\Program Files\Microsoft Games\Allegiance\Artwork</tt>.


    for (i {{=}} 0;
The AllSrv server requires its own sub-key named Server inside the 1.1 key. It requires three strings, ArtPath, CfgFile and EXE File (the space between EXE and File is intentional, this is used by AllSrvUI).  Perform a "clean" register /w the Component Object Model using the following commands:


Declare a type for the <tt>i</tt> variable. Add the word “int” before the i so that it reads:
<tt>regsvr32 /u AGC.dll</tt>


    for ('''int''' i {{=}} 0;
<tt>regsvr32 AGC.dll</tt>
}}


{{Step|6|Fix more dependencies}}
<tt>AllSrv -UnRegServer</tt>


{{Substep|6.1|Remove the <tt>atlthunk.lib</tt> dependency}}
<tt>AllSrv -RegServer</tt>


{|
[[Image:devreg.jpg|thumb|An example of the registry entries found using RegEdit]]
| In this file:
| <tt>c:\psdk\include\atl\atlbase.h</tt>
|-
| find this line:
| <tt>#pragma comment(lib, "atlthunk.lib")</tt>
|-
| and comment it out:
| <tt>// #pragma comment(lib, "atlthunk.lib")</tt>
|}


{{Substep|6.2|Remove <tt>atls.lib</tt> from the linker settings}}
==Troubleshooting==
Most issues can be resolved by updating to the latest versions of the Windows SDK and DirectX SDK.


In the Solution Explorer, right click on the Allegiance project and pick {{verbatim|Properties}}. Navigate to {{verbatim|Configuration Properties}}, {{verbatim|Linker}}, {{verbatim|Input}}. In {{verbatim|Additional Dependencies}} remove <tt>atls.lib</tt>.
If you have a problem that's not answered in this entry's [http://www.freeallegiance.org/forums/index.php?act=component&module=ipbwiki_discussion&topic=36474 discussion] please feel free to post. This section will be updated with any known resolutions to common problems.


{{Step| |Done!}}
Another helpful entry to read on the WIKI is [[Code Documentation]]


The build will still fail on the AllSrvUI project, complaining about a missing header file <tt>afxmsg_.h</tt>. However, all the other projects should build, including the client -- you should have a copy of Allegiance.exe in {{verbatim|c:\alleg\objs\FZDebug\WinTrek}}.
===Fatal error C1083===
If you get this error, make sure you haven't checked out the source to a path with a space in it!


{|height = "30px"
Lastly, if you get '''Cannot open include file: 'atlconv.h': No such file or directory''' or "d3dx9.h" or the like, Please read this: [[#Important_notes_regarding_Express_.26_Starter_editions|Express Editions]].
|}


===Microsoft Visual Studio 2008===
===MIDL errors===
MIDL error: 'annotation'


{{Step|1|Download and install the required software}}
1>C:\Program Files\Microsoft SDKs\Windows\v6.0\Include\unknwn.idl(108) : error MIDL2025 : syntax error : expecting ] or , near "annotation"
1>C:\Program Files\Microsoft SDKs\Windows\v6.0\Include\unknwn.idl(108) : error MIDL2026 : cannot recover from earlier syntax errors; aborting compilation
If you get this error, you are using a new version of the Windows headers with an older version of the MIDL compiler.
Fix:
1. Make sure you installed the MIDL compiler when you installed the latest Windows SDK. It should appear under "Program Files\Microsoft SDKs\Windows\v6.0\Bin".
Note: To install the MIDL compiler, you need to select Developer Tools / Windows Development Tools / Win32 Development Tools in the Windows SDK setup wizard. (At least, as of RC1.)
2. In Visual Studio, under Tools > Options > Projects and Solutions > VC++ Directories > Executable Files, add
    x:\Program Files\Microsoft SDKs\Windows\v6.0\bin
to the top of the list.


You will need the [http://www.microsoft.com/downloads/details.aspx?FamilyID=371f6ba4-2737-46ab-b275-0dcab31459b5&displaylang=en '''DirectX SDK''']. Note that versions after June 2007 will not work.
Thanks Mike Wasson!


Check out the Allegiance source code if you haven't already done so.
===Artwork===
When running your fresh new shiny build you may crash because you are missing new artwork files.  Check out the http://svn.alleg.net/svn/Allegiance/branch/FAZR5Dev/artwork/dev and http://svn.alleg.net/svn/Allegiance/branch/FAZR5Contrib/artwork/dev areas for any additional files you may need.


{{Note|For the purposes of this explanation we will assume:
===Debugging===
* You installed the SDK in {{verbatim|C:\dxsdk}}
====Debugging in Visual Studio====
* You checked out the Allegiance source in {{verbatim|C:\alleg}}
The allegiance solution contains many projects and many of those are not executable.  To debug the client or server you must right click the project in the Solution Explorer and select Debug->Start New Instance or Step Into New Instance.  The main menu debug option will debug the project set as the Startup project which is not necessarily executable unless you have correctly set it to your target project.
Obviously you will need to replace these with the paths you really used.
}}


{{Step|2|Configure your path}}
In order to debug your local server in LAN server mode you must first debug the AllSrvUI project by right clicking it and selecting debug->Start New instance.  Then from the main menu bar select Debug->Attach->AllSrv.exe


Now open the file {{Verbatim|C:\Alleg\VS2008\Allegiance.sln}}.
Another more reliable method of debug is [[Setting up local lobby and server]].


We will need to add a few folders to the VC++ path. From the {{verbatim|Tools}} menu, pick {{verbatim|Options}}. Under {{verbatim|Projects and Solutions}} go to {{verbatim|VC++ Directories}}.
==== Output ====
Where is the debug output?  If you're not seeing any of the debug output you expected, it's because [[Free_Allegiance_Zone_Dev_Team|Radar]] made a command line switch to control the amount of information you get. A listing of the command line switches you need to know are:


-debug  (enables output)


{| class="wikitable"
-mdllog (shows modeler debug)
| From {{verbatim|Show Directories For}} pick:
! width = 30% | Include files
! width = 30% | Library files
|-
| valign = top | and add this, in order, to the top of the list:
| valign = top | <pre>c:\dxsdk\include</pre>
| valign = top | <pre>c:\dxsdk\lib\x86 (*)</pre>
|}


:'''(*)''' Skip this if you are building for a 64-bit platform.
-windowlog (shows window debug)


Confirm the changes and close all dialogs.
-multi (allows multiple instances)


Now find the dropdown box in the toolbar which currently says {{Verbatim|Debug}} and change this to {{Verbatim|FZDebug}}{{ref|2}}.
-adapter <adapterid> (creates the directx device on specified video adapter)


{{Step|3|Build the source}}
-windowed (starts in windowed mode)


From the {{verbatim|Build}} menu click {{verbatim|Build Solution}}.
-quickstart <civid> (takes you directly to a game and if possible, sets your faction to specified civilization)


{{Step| |Done!}}
-training (takes you directly to the training menu)


All the projects should build, including the client -- you should have a copy of Allegiance.exe in {{verbatim|c:\alleg\objs\FZDebug\WinTrek}}.
==== Crashing ====
When debugging using the FZDebug build, it's important to note some differences from the FZRetail build.  Knowing these differences will save you some time. You could consider these "Known Issues":


=== Footnotes ===
* The FZDebug builds will generally not give error messages, it will simply break into an assert.
* Some artwork may have incorrect color keys or formatting, the FZDebug build will break into an assert or crash.
* Color codes in user strings (chat, team names) will cause the FZDebug build to break into an assert.
* Visual Studio 2010 Beta 1 may crash while you are debugging with the DirectX Debug runtimes enabled.  You may be unable to restart Visual Studio 2010 Beta 1 because it will keep crashing when it loads until you change back to the Retail DirectX runtimes.
* Some DirectShow filters (such as Nero) may prohibit you from debugging with the intro video, Allegiance will exit normally.


:{{footnote|1}}If you want to build optimized EXEs that cannot be debugged easily, choose {{Verbatim|FZRetail}} instead.
:{{footnote|2}}See previous note.


{{FAZ}}
[[Category:Guides]]
[[Category:Guides]]
[[Category:Development]]
[[Category:Development]]
[[Category:Current development]]
[[Category:FAZ]]

Latest revision as of 00:11, 17 January 2012

Downloading the source

This entry describes how the FAZ Dev team has organized the code in their central repository, how you can get a copy of it, and how you can submit code you wrote to be included in the next release of Allegiance. A list of active tickets on bugs and enhancements is available on the official bug tracker.

Repository setup

Before this section explains how to download the source code & artwork, here's a little bit of background on how we're set up.

Tigereye has graciously set up a Subversion repository on one of his servers to allow all Allegiance developers to collaboratively develop additions and enhancements to Allegiance. This repository is located at http://svn.alleg.net/svn/Allegiance and can easily be browsed with your web browser.

The repository contains 3 top-level folders: trunk, tag, branch. The "trunk" represents the main development line.

Currently, the trunk contains the FAZ_R6 code.

The "tag" folder contains multiple sub-folders; each points to a particular revision of Allegiance's source code throughout it's development. The purpose of the tag folder is to keep a list of milestones throughout Allegiance's history. Currently there are 5 tags within this folder:

  • "msoriginal" which will always point to the original source code provided by Microsoft on February 5th, 2004.
  • "FAZ_R1" community release on March 1st, 2006.
  • "FAZ_R2" community release on August 1st, 2006.
  • "FAZ_R3" community release on December 14th, 2006.
  • "FAZ_R4" community release on November 1st, 2007.
  • "FAZ_R5" community release on November 16th, 2009.

The "branch" folder contains multiple folders as well; each points to a particular version of code that is currently in development by the FAZ Dev team. There is currently one active branch:

  • FAZR6 - This branch contained the latest changes and was used for development. It was used as a "sandbox" for development & contributions (community patches). Trunk was merged with this branch and some features were dropped.

As the development team and the community works on the source code, we will copy the source code to our machines, and change it locally. When we've verified our personal changes are "good" we will create a patch file containing all changes made by us from the original, send it to Development Zoneleader. He will merge it with the appropriate branch of code. Once the team agrees that we are ready for a release, we'll update the trunk to point to the "latest good" and tag the update in the tag folder.

Checking out the source

Before you can check out the source code, you will need to install an application to work with the Subversion server, allowing you to copy the code onto your machine and send your changes back to the repository: TortoiseSVN is a windows GUI for interfacing with Subversion. It makes it easy for you to keep your downloaded source up-to-date with the changes made by the rest of the team and allows you to create patches / commit changes for submission.

Tortoise SVN's checkout screen.

Once you've downloaded and installed the necessary programs, you can check out the latest code by creating a blank folder where you want the source code to be on your machine.

Open that new folder, right click within it, and click SVN Checkout. In the dialog that pops up, use one of the following repository URLs:

http://svn.alleg.net/svn/Allegiance/trunk/

Most of your development will be performed from this branch. When you click "OK" the latest code will be copied to your computer into the folder you created.

Additional information on checking out code can be found here.


Info.png
Note The SVN servers have recently changed address. Development, additionally, has recently changed directory.

If you had already checked out Allegiance from the R5 days (or before) you can get yourself up-to-date without checking out everything.

  1. First, perform a relocation from http://svn.alleg.net:8080/ to http://svn.alleg.net/.
  2. Then, perform a switch to http://svn.alleg.net/svn/Allegiance/branch/FAZR6/.

If you are using the console version of Subversion, cd to the repository and perform the following:

svn switch --relocate http://svn.alleg.net:8080/ http://svn.alleg.net/ 
svn switch http://svn.alleg.net/svn/Allegiance/trunk
svn update

If you are using other clients as suggested, check their documentation for instructions.

Updating your source code with the team's changes

Sample output for the SVN Update command

Whenever someone submits a patch and it is applied to the repository, your code on your machine is not updated. You will need to tell Subversion to take the changes made to the collective code and apply them to your own. This is called "Updating"

To Update your code, right click the folder that has the Allegiance source and choose SVN Update.


Info.png
Note This will update files that have been changed locally since the latest update, but only if changes can be merged automatically (if lines changed locally and lines changed with the update do not overlap, also referred to as a conflict
.

More information about updating can be found here.

Fixing mistakes you've made

While changing the code, you may accidentally make mistakes and save over the "good" originals when you didn't mean to. It's okay! You don't need to re-download the whole thing to get back to the original.

Simply right-click the top-most folder that contains your checkout, and choose TortoiseSVN-->Revert... Tortoise will prompt you by warning that you will lose all changes made to the originals. When you click OK, all of your files are reverted right back to the way they were when you first checked them out.

Submitting your changes to the repository

The Create Patch screen.

When you have completed changing the checked-out code on your machine and after having tested your changes it's time to give them to the rest of the team.

Right-click the folder that contains your allegiance source, and choose Create Patch... You'll get a screen that asks you to choose all files that should be submitted with the patch.

Simply check the check boxes beside all files that should be included, then click OK. You'll be prompted where to save the .patch file on your machine.

Once you have the patch file created, upload the patch to the relevant ticket. You can set the status of the ticket to "worksforme" and that will notify the dev team that it is ready for inclusion into the next build of the beta server/client and eventually into the release.

More information about creating patches can be found here.

Additional information

The few pictures used in this post came from the TortoiseSVN Documentation. It's a very thorough set of documentation that explains every function available in Subversion, and how to use them with TortoiseSVN.

Artwork repository

For those 3D artists out there, we have a separate repository just for you! Keep your models up to date with other artists and submit new ones.

You can browse all of the artwork available from Microsoft's release of the code at http://svn.alleg.net/svn/AllegArt/branch/FAZDev/

Should you have any questions, just post in the Art and ingame content forum and someone will be happy to answer.

Happy coding!

Building the source

If a development environment is already setup, please jump directly to the build instructions by clicking the appropriate link below:


Setup a development environment

You need installed:

Visual Studio 2010 SP1

Warn.png
Warning! Please follow the following installation order:

Visual Studio 2010, Windows SDK 7.1, Visual Studio 2010 SP1, Hotfix: Visual C++ 2010 SP1 Compiler Update for Windows SDK 7.1

  • Double click on the VS2010\Allegiance.sln in your checkout folder.
  • Find the drop down box in the toolbar near the top menu bar, make sure it says FZDebug
    • The FZRetail build flavor should only be used for releases.
  • From the Build menu click Build Solution (or press F7).
  • Your executables will use the Allegiance/1.1 registry keys, find them in the \objs10 folder, you're done!.

Visual Studio 2008 SP1

  • Double click on the VS2008\Allegiance.sln in your checkout folder.
  • Just like in #Important notes regarding Express & Starter editions, add your DirectX SDK lib\ARCH and \include.
    • Important: ARCH is either x86 or x64, you can use the $(PlatformShortName) macro, for example G:\DX9\lib\$(PlatformShortName)
  • Find the drop down box in the toolbar near the top menu bar, make sure it says FZDebug
    • The FZRetail build flavor should only be used for releases.
  • From the Build menu click Build Solution (or press F7).
  • Your executables will use the Allegiance/1.1 registry keys, find them in the \objs9 folder, you're done!.

Express & Starter editions

Warn.png
Warning! This probably needs update for R6 and 2010 Express.
  • You must also download and install the Windows SDK and DirectX SDK
  • In your Express/Starter edition of Visual studio, you have to add the SDK files to your VC++ Directories options manually:
    • Tools->Options...
      • Expand (+) Projects and Solutions->VC++ Directories
        • Select Executable files then add your Windows & DirectX SDK \bin paths, Select Include files, add your Win & DX SDK \include paths and lastly select Library files then add your SDK & DX's \lib paths. For your DX SDK lib path be sure to append x86 to the end. (i.e. G:\DX9\Lib\x86) Pay close attention to these directories, the DX SDK ones especially!
Click here to see a larger version
 
Click on the image to view a larger version. Popup.png
  • ATL/MFC is no longer available in the current Windows SDK, expect errors, you won't be able to build the AllSrv, AllSrvUI or AGC projects. They have become part of none-free editions of Visual Studio 2005/2008/2010 (Standard/Professional/Team System/Premium/Ultimate). [1]
    • You can download an old Windows SDK and copy the include files from ...\include\Win64\mfc and ...\include\Win64\atl into your current Windows SDK include folder. (you can then build everything except AllServUI targeting x86)
  • Solution folders are not supported, expect errors immediately when you load, they are mostly harmless.

Registry keys

FAZ Development builds use the following registry key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft Games\Allegiance\1.1

The only entry needed to run the Allegiance client is the string ArtPath, the value must point to the full path of your artwork folder and not have a trailing slash. i.e. C:\Program Files\Microsoft Games\Allegiance\Artwork.

The AllSrv server requires its own sub-key named Server inside the 1.1 key. It requires three strings, ArtPath, CfgFile and EXE File (the space between EXE and File is intentional, this is used by AllSrvUI). Perform a "clean" register /w the Component Object Model using the following commands:

regsvr32 /u AGC.dll

regsvr32 AGC.dll

AllSrv -UnRegServer

AllSrv -RegServer

An example of the registry entries found using RegEdit

Troubleshooting

Most issues can be resolved by updating to the latest versions of the Windows SDK and DirectX SDK.

If you have a problem that's not answered in this entry's discussion please feel free to post. This section will be updated with any known resolutions to common problems.

Another helpful entry to read on the WIKI is Code Documentation

Fatal error C1083

If you get this error, make sure you haven't checked out the source to a path with a space in it!

Lastly, if you get Cannot open include file: 'atlconv.h': No such file or directory or "d3dx9.h" or the like, Please read this: Express Editions.

MIDL errors

MIDL error: 'annotation'

1>C:\Program Files\Microsoft SDKs\Windows\v6.0\Include\unknwn.idl(108) : error MIDL2025 : syntax error : expecting ] or , near "annotation" 1>C:\Program Files\Microsoft SDKs\Windows\v6.0\Include\unknwn.idl(108) : error MIDL2026 : cannot recover from earlier syntax errors; aborting compilation

If you get this error, you are using a new version of the Windows headers with an older version of the MIDL compiler.

Fix:

1. Make sure you installed the MIDL compiler when you installed the latest Windows SDK. It should appear under "Program Files\Microsoft SDKs\Windows\v6.0\Bin".

Note: To install the MIDL compiler, you need to select Developer Tools / Windows Development Tools / Win32 Development Tools in the Windows SDK setup wizard. (At least, as of RC1.)

2. In Visual Studio, under Tools > Options > Projects and Solutions > VC++ Directories > Executable Files, add

   x:\Program Files\Microsoft SDKs\Windows\v6.0\bin

to the top of the list.

Thanks Mike Wasson!

Artwork

When running your fresh new shiny build you may crash because you are missing new artwork files. Check out the http://svn.alleg.net/svn/Allegiance/branch/FAZR5Dev/artwork/dev and http://svn.alleg.net/svn/Allegiance/branch/FAZR5Contrib/artwork/dev areas for any additional files you may need.

Debugging

Debugging in Visual Studio

The allegiance solution contains many projects and many of those are not executable. To debug the client or server you must right click the project in the Solution Explorer and select Debug->Start New Instance or Step Into New Instance. The main menu debug option will debug the project set as the Startup project which is not necessarily executable unless you have correctly set it to your target project.

In order to debug your local server in LAN server mode you must first debug the AllSrvUI project by right clicking it and selecting debug->Start New instance. Then from the main menu bar select Debug->Attach->AllSrv.exe

Another more reliable method of debug is Setting up local lobby and server.

Output

Where is the debug output? If you're not seeing any of the debug output you expected, it's because Radar made a command line switch to control the amount of information you get. A listing of the command line switches you need to know are:

-debug (enables output)

-mdllog (shows modeler debug)

-windowlog (shows window debug)

-multi (allows multiple instances)

-adapter <adapterid> (creates the directx device on specified video adapter)

-windowed (starts in windowed mode)

-quickstart <civid> (takes you directly to a game and if possible, sets your faction to specified civilization)

-training (takes you directly to the training menu)

Crashing

When debugging using the FZDebug build, it's important to note some differences from the FZRetail build. Knowing these differences will save you some time. You could consider these "Known Issues":

  • The FZDebug builds will generally not give error messages, it will simply break into an assert.
  • Some artwork may have incorrect color keys or formatting, the FZDebug build will break into an assert or crash.
  • Color codes in user strings (chat, team names) will cause the FZDebug build to break into an assert.
  • Visual Studio 2010 Beta 1 may crash while you are debugging with the DirectX Debug runtimes enabled. You may be unable to restart Visual Studio 2010 Beta 1 because it will keep crashing when it loads until you change back to the Retail DirectX runtimes.
  • Some DirectShow filters (such as Nero) may prohibit you from debugging with the intro video, Allegiance will exit normally.


FAZ Development
About Free Allegiance Zone
Releases: R1 · R2 · R3 · R4 · R5 · R6  · (current)R7
Allegiance R8: What's new? · Build it!
Testing Beta: Overview · Testing procedure