Skip to content

Latest commit

 

History

History
205 lines (142 loc) · 6.6 KB

INSTALL.engine.md

File metadata and controls

205 lines (142 loc) · 6.6 KB

Building from Source

For easy building I recommend using cmake and make, as it has low overhead when it comes to changes in the code. Since this repository only contains the engine, it is highly recommended that you grab some game data packages (we call them mods). A good place to start would be the official flare-game mods. Mods may then be copied to the mods/ folder manually, if you do not wish to install Flare system-wide.

Clone, Build and Play

git clone https://github.com/clintbellanger/flare-engine.git # clone the latest source code
git clone https://github.com/clintbellanger/flare-game.git # and game data
# remember your dependancies(see below)
cd flare-engine
cmake .
make # build the executable
cd ../flare-game/mods
ln -s ../../flare-engine/mods/default # symlink the default mod
cd ../
ln -s ../flare-engine/flare # symlink the executable
./flare # flame on!

As a side note, I recommend enabling debugging symbols in order to provide more details if you run into a crash. This can be done by changing the cmake command in the block above to:

cmake . -DCMAKE_BUILD_TYPE=Debug

You can also build the engine with just one call to your compiler including all source files at once. This might be useful if you are trying to run a flare based game on an obscure platform, as you only need a c++ compiler and the ported SDL package.

Dependencies

To build Flare you need the 2.0 Development Libraries for SDL: SDL_image, SDL_mixer, and SDL_ttf, with the equivalent 2.0 Runtime Libraries to run the game; or follow the steps below for your Operating System of choice.

Arch Linux

Installing dependencies on Arch Linux:

pacman -S --asdeps sdl2 sdl2_image sdl2_mixer libogg libvorbis hicolor-icon-theme python sdl2_ttf

There are also AUR PKGBUILDs available for the latest (engine and game) versions.

Debian based systems

Installing dependencies on debian based systems (debian, Ubuntu, Kubuntu, etc):

sudo apt-get install libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev
# for development you'll also need:
sudo apt-get install cmake make g++ git

There is also a flare build in the Ubuntu (universe), which actually is flare-game.

Fedora

Installing dependencies on Fedora:

sudo dnf install git make cmake gcc-c++ SDL2-devel SDL2_image-devel SDL2_mixer-devel SDL2_ttf-devel

OpenSuse

Installing dependencies on openSUSE:

sudo zypper in make cmake gcc-c++ libSDL2-devel libSDL2_image-devel libSDL2_mixer-devel libSDL2_ttf-devel

There is also a flare build at the openSUSE games repo.

OS X

Installing dependencies using Homebrew:

brew install cmake libvorbis sdl2 sdl2_image sdl2_mixer sdl2_ttf

Windows

Microsoft Visual C++

If you want to build flare under Microsoft Visual C++, you should get dirent.h header file and copy it to $MICROSOFT_VISUAL_CPP_FOLDER\VC\include\.

Install Flare system-wide

The executable is called flare in this repository or in the flare-game repository, but it is subject to change if you're running another game based on the engine (such as polymorphable).

If you want the game installed system-wide, as root, install with:

make install

The game will be installed into /usr/local by default. You can set different paths in the cmake step, like:

cmake -DCMAKE_INSTALL_PREFIX:STRING="/usr" .

Building with g++

If you prefer building directly with C++, the command will be something like this:

GNU/Linux (depending on where your SDL includes are):

g++ -I /usr/include/SDL src/*.cpp -o flare -lSDL2 -lSDL2_image -lSDL2_mixer -lSDL2_ttf

Windows plus MinGW:

g++ -I C:\MinGW\include\SDL src\*.cpp -o flare.exe -lmingw32 -lSDLmain -lSDL2 -lSDL2_image -lSDL2_mixer -lSDL2_ttf

Optimizing your build

Flare is intended to be able to run on a wide range of hardware. Even on very low end hardware, such as handhelds or old computers. To run on low end hardware smooth, we need get the best compile output possible for this device. The following tips may help improving the the compile output with respect to speed. However these compiler switches are not supported on some platforms, hence we do not include it into the default compile settings.

  • Make sure the compiler optimizes for exactly your hardware. (g++, see -march, -mcpu)
  • Enable link time optimisation (g++: -flto) This option inlines small get and set functions accross object files reducing overhead in function calls.
  • More aggressive optimisation by telling the linker, it's just this program. (g++: -fwhole-program)
  • to be continued.

Troubleshooting

If the game fails to start, some of the following tips might help:

  • Open your settings.txt file. The location of this file is specified in README.md. In that file, set hwsurface=0 and vsync=0.

  • Older computers might have CPUs that don't support SSE. The default binaries for SDL 2 require SSE. To disable SSE instructions, it is necessary to download the SDL 2 source and build SDL 2 library from source.

    In case of Windows plus MinGW/MSYS run the following commands from SDL 2 source folder using MSYS terminal:

    ./configure --disable-sse
    mingw32-make
    

    Then use produced libraries to build flare. In case of Linux use:

    ./configure --disable-sse
    make
    make install
    

    Last command will install built libraries system-wide.

    If you want to build SDL2 from Visual C++ project, open SDL2 project in Visual Studio, go to

    Project Properties -> C/C++ -> Code Generation -> Enable Enhanced Instruction Set
    

    and select No Enhanced Instructions (/arch:IA32). You might really need to rebuild also SDL2_mixer, SDL2_image and SDL2_ttf when you want to use libraries, built with Visual Studio.

    If you want to build using cmake, use cmake-gui, and uncheck SSE checkbox after executing Configure command.