Development for Stratagus


This file should give you some information to help with development of Stratagus.

IRC - Internet Relay Chat

You can try to meet other Stratagus developers and users on the FreeNode IRC Network, in the #stratagus channel.

Mailing list

If you want to help with development for Stratagus you should join the stratagus-devel mailing list.
You may also want to look at the archives.

Bugs and tasks

You can find known bugs and planned tasks on the Sourceforge pages for Stratagus.

Before starting on a bug or task, please ask on the mailing list or in the IRC channel whether anybody else is already working on it.

Building Stratagus

Installing the Subversion client

If you want to help develop, you should use Subversion. The online book Version Control with Subversion will help you master Subversion.

Getting Stratagus from Subversion

The subversion repository of stratagus has two main directories:

The stratagus directory is itself divided into 3 subdirectories:

How do I get the latest source code of Stratagus?

The instructions for accessing the source code are on the project subversion page.

For example:

svn co https://svn.sourceforge.net/svnroot/stratagus/stratagus/trunk stratagus

This is done only once. To update your working copy, go into the directory and type 'svn up'.

Getting Stratagus without Subversion

Only releases are made outside of Subversion. If you wish to be involved with development, you should obtain the sources via Subversion. Subversion usually remains quite stable and is easier for you to keep up to date. Release versions of stratagus are available here. Many of the games that use the stratagus engine will, and should bundle these files with their release, to ensure compatibility.

Compiling Stratagus

You can find instructions for compiling Stratagus at install.html.
Since you already have a copy of the source, you may skip ahead to step 2.

Source code documentation

Valery Shchedrin has introduced tagged source documentation for Stratagus.

You need either DoxyGen or DOC++ to generate source code documentation. You may then use the following commands to produce the documentation:

Tags used in source code

We use the doc++ tags:

Multi line source code documentation:

/** ... */

Single line source code documentation:

/// ...

Start grouping:

//@{ or /*@{*/

End grouping:

//@} or /*@}*/

Please read the doxygen/doc++ documentation.

Empty C prototype file

//       _________ __                 __                               
//      /   _____//  |_____________ _/  |______     ____  __ __  ______
//      \_____  \\   __\_  __ \__  \\   __\__  \   / ___\|  |  \/  ___/
//      /        \|  |  |  | \// __ \|  |  / __ \_/ /_/  >  |  /\___ \ 
//     /_______  /|__|  |__|  (____  /__| (____  /\___  /|____//____  >
//             \/                  \/          \//_____/            \/ 
//  ______________________                           ______________________
//                        T H E   W A R   B E G I N S
//  Stratagus - A free fantasy real time strategy game engine
//
/**@name {filename}.c	-	{One line description of this file} */
//
//  (c) Copyright 2006 by {insert your name here}
//
//  This program is free software; you can redistribute it and/or modify
//  it under the terms of the GNU General Public License as published by
//  the Free Software Foundation; only version 2 of the License.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 51 Franklin St, Fifth Floor, 
//  Boston, MA  02110-1301  USA
//
//  $Id: development.html 7899 2007-03-01 05:29:54Z jsalmon3 $

//@{

#include <stdio.h>

#include "stratagus.h"
// More game includes.

// Global and local variables of this module.

// Local and global functions of this module.

//@}

Coding style

You can use your own coding style in your own modules. If you fix in other modules, please imitate the coding style of the original coder.

We suggest the Linux kernel coding style (also found online here).

Coding Examples:
    // Example for statement with i incremented
    for (i = 0; i < sample->Length >> 1; ++i) {
        ...
    }

    // if statement with brackets and functions.
    if ((i = CLread(f, &chunk, sizeof(chunk))) != sizeof(chunk)) {
        ...
    }

    // function with variables defined.
    int function(int a, int b)
    {
        int x;
        int y;

        x = a;
        y = b;

        return 0;
    }
	
    // Example of a function
    static int CclLoadPud(lua_State* l)
    {
        const char* name;

        if (SaveGameLoading) {
            return 0;
        }

        if (lua_gettop(l) != 1) {
            LuaError(l, "incorrect argument");
        }
        name = LuaToString(l, 1);
        LoadPud(name, &TheMap);

        // FIXME: LoadPud should return an error
        return 0;
    }
NOTE: If you make big changes please always extend the copyright with your name, and always update the copyright year if required.

Sending a patch

Once you have completed some work, you will probably want it to be included in the main Stratagus source.

Follow these steps:


(C) Copyright 1998-2007 by The Stratagus Project under the GNU General Public License.
All trademarks and copyrights on this page are owned by their respective owners.