Jump to content


Compilation Instructions

  • This topic is locked This topic is locked
1 reply to this topic

#1 Serge


    Project Leader: UFO 2000

  • Xenocide Programming Department
  • 785 posts

Posted 07 March 2004 - 02:22 AM

Part 1. Getting the latest sources and compiling the game

Here are some simple instructions how to build win32 binaries of the game and make installer.

First you need a set of tools.

Subversion console client (needed to download the latest sources of the game):

Mingw GCC compiler (the game is compiled using it):

MSYS (minimal set of unix tools, it is required when compiling the game):

NSIS installer (optional, for making installer of the game)

Important: make sure that you have all these tools registered in your PATH, so that you can run 'svn --version', 'gcc --version', 'make --version' from console. If you are getting 'bad command or file name', something is wrong and needs to be fixed. Also make sure that 'make --version' displays something like GNU Make version 3.79.1, by Richard Stallman and Roland McGrath., some people had issues with Borland make utility, unfortunately it has the same name but you can't use it for compiling ufo2000.

After you get all these tools installed, you can get the latest sources of the game.
Create some directory "C:\Projects" for example. Then run from a command line:
'svn checkout https://ufo2000.svn....t/ufo2000/trunk c:\projects\ufo2000'
You will have the latest sources installed into c:\projects\ufo2000

To successfully compile the game you will also need a set of additional libraries (Allegro, Expat, ...). A good news is that we already have them compiled and packaged. Download http://ufo2000.sourc...bs-20111202.zip and extract it to ufo2000 sources directory. You will get mingw-libs subdirectory with all the needed libraries ready for use.

The directory structure should look like this:

	   |->lots of files and folders
			 |->*.cpp and *.h files

After that everything is simple. Just run 'make' from ufo2000 sources directory and it will compile ufo2000.exe, run 'make server' to compile ufo2000 game server (ufo2000-srv.exe). Running 'make win32-installer' will build win32 installer of the game (ufo2000-xx.yy.zz.exe, where xx.yy.zz is the version of the game). You need extra package http://ufo2000.sourc...sis-plugins.zip to make installer. Extract it to the ufo2000 sources directory just like mingw-libs.zip

As people are working on the game, new changes get committed to the repository. Getting these changes to your local copy is simple. Just run 'svn update' in the ufo2000 sources directory to update them to the latest version. Updating the sources is a safe operation, if you made some changes to the sources as well, they will not be lost, in the worst case subversion will detect a conflict and show which of your changes are not compatible with the changes received from the server.

If you have any problems following these instructions, don't hesitate to ask questions here, these instructions will be updated when needed.

Edited by Serge, 01 December 2011 - 06:00 PM.

ufo2000 development team

#2 Serge


    Project Leader: UFO 2000

  • Xenocide Programming Department
  • 785 posts

Posted 19 March 2004 - 02:26 PM

Part 2. Taking part in development of UFO2000

The sources of the game are stored in Subversion repository. Subversion (http://subversion.tigris.org) is a version control system like CVS. In fact, it was developed to be a replacement for CVS and in general it works very similar to CVS but has some important improvements. Using Subversion is very easy for people familiar with CVS as it has the same concept and a similar command line syntax.

Repository is located here: http://ufo2000.svn.s.../ufo2000/trunk/
You can view the sources online using any web browser. But if you want to do something more serious, you need to install subversion client.

Console subversion client can be downloaded from http://subversion.tigris.org
Alternatively you can use GUI Win32 client downloadable from http://tortoisesvn.tigris.org
But it is better to have both console and GUI subversion client installed.

Before making anything, you need to checkout the sources of the game. It is better to use the latest version from SVN repository for making changes to the game, it can already contain some changes and fixes that were added after releasing a stable version.

Checking out the sources using console client is performed using the following command:
'svn co https://ufo2000.svn..../ufo2000/trunk/ ufo2000'

After this step, you will have a working copy of the latest sources of the game on your computer. You can keep it up to date using update command. Just run 'svn up' from the directory with your working copy.

You can always get a log of all the changes made to the sources using log command. Run 'svn log --verbose https://ufo2000.svn..../ufo2000/trunk/ to get the list of changes. Also, every change in ufo2000 sources repository generates e-mail notification which is sent to the ufo2000 svn commit notifications mailing list.

Well, I have already explained how to get the latest sources of the game and keep them up to date. Now it is time to explain how to help in the development of the game.

After you make some changes to your working copy, test it and ensure that it compiles and works as expected, you may want to share your changes with the others and add them to the repository. Developers with write access to the repository can execute commit command to do this. All the others can make patch and send it to someone who has write access (or to the mailing list). To make a patch, you can run 'svn diff > mycoolpatch.diff' from the command line in your working copy. This will create mycoolpatch.diff file which will contain all the changes you made to the sources in text format. This patch can be applied to the sources to get your changes in.

Here is an example of a patch file (for those who do not know how it looks):

Index: src/main.cpp
--- src/main.cpp	(revision 1092)
+++ src/main.cpp	(working copy)
@@ -526,6 +526,25 @@
	 *allegro_errno = 0; 
+static int find_files_callback(const char *filename, int attrib, void *param)
+	std::set<std::string> *files = (std::set<std::string> *)param;
+	files->insert(filename);
+	// $$$ Fixme: lua_dofile sets errno variable in some mysterious way,
+	// so allegro for_each_file function stops searching files if we do not 
+	// reset this back to 0
+	*allegro_errno = 0; 
+	return 0;
+static int find_files(const char *dir, const char *searchmask, std::set<std::string> &files)
+	char tmp[1024];
+	append_filename(tmp, dir, searchmask, sizeof(tmp));
+	for_each_file_ex(tmp, 0, 0, find_files_callback, &files);
+	return 1;
 static std::map<std::string, double> g_extensions_loading_time;
 void find_dir_callback(const char *filename, int attrib, int param)
@@ -539,9 +558,14 @@
		 lua_pushstring(L, filename);
		 lua_settable(L, LUA_GLOBALSINDEX);
-		char tmp[1024];
-		sprintf(tmp, "%s/*.lua", filename);
-		for_each_file(tmp, FA_RDONLY | FA_ARCH, find_lua_files_callback, 0);
+		std::set<std::string> files;
+		std::set<std::string>::iterator it;
+		find_files(filename, "*.lua", files);
+		for (it = files.begin(); it != files.end(); ++it) {
+			lua_safe_dofile(L, it->c_str(), "plugins_sandbox");
+		}
		 clock_t after = clock();
		 g_extensions_loading_time[filename] = (double)(after - before) / (double)CLOCKS_PER_SEC;

Restricting write access to the repository is only done for safety reasons. After you send a few patches and they prove to be usable, you will get write access to the repository, that's not a problem :)

One more note: the best way to review the changes you made to the sources is to use GUI subversion client configured to use external visual diff utility. I would recommend to use WinMerge: http://winmerge.sourceforge.net

If you have any problems following these instructions, don't hesitate to ask questions here, these instructions will be updated when needed.

Edited by Serge, 28 February 2009 - 09:02 AM.

ufo2000 development team