Loading...
  OR  Zero-K Name:    Password:   

Compile SpringRTS Engine on Windows for better performance

40 posts, 4752 views
Post comment
Filter:    Player:  
Page of 2 (39 records)
sort
Licho asked me to do a tutorial on how i did compile a optimized version of the engine for my Laptop, so if you use windows and want a optimized version for you CPU, you can do the same was i did:



Lets start on how its work, CPU have instruction set that make programs, code run faster, by default (in CMake) the engine is using i686 that "Pentium Pro" instruction set, is over 17 year old CPU that only support MMX, so to use the full power of your modern CPU (that have SSE, SSE2, SSE3, etc) you need to compile it your self.

It will use OMP (it will multithreaded a little, like ROAM terrain rendering, and does not desycn) to. (Optional)

First the thing you will need to download:
7z program:
http://www.7-zip.org/
http://portableapps.com/apps/utilities/7-zip_portable/ (i used this portable version)

The Tarballs:
http://sourceforge.net/projects/springrts/files/springrts/spring-91.0/spring_91.0_src.tar.gz/download
https://github.com/spring/mingwlibs/downloads (click in "Download as tar.gz")
https://github.com/spring/mingwlibs/tarball/master (direct link to above file)
So you will need to download the 2 files spring_91.0_src.tar.gz and spring-mingwlibs.tar.gz

CMake:
http://www.cmake.org/cmake/resources/software.html
http://www.cmake.org/files/v2.8/cmake-2.8.8-win32-x86.exe (i used this one)
http://www.cmake.org/files/v2.8/cmake-2.8.8-win32-x86.zip (this one look like a
portable version, but i did not use it, so use it at your own risk)

MinGW:
http://tdm-gcc.tdragon.net/download (you need the On-Demand Installer)
http://sourceforge.net/projects/tdm-gcc/files/TDM-GCC%20Installer/tdm-gcc-webdl.exe/download (direct link to above file)


!Start

Use the 7z to "unzip/uncompress" the spring_91.0_src.tar.gz and spring-mingwlibs(some random numbers and letters).tar.gz (in 7z select the file and press "Extract") files. You will end with a spring_91.0_src.tar and spring-mingwlibs(some random numbers and letters).tar files, uncompress them to.

Now you have a "spring_91.0" folder, inside that folder, create a folder named mingwlibs and paste inside it the files of mingwlibs. So you will have spring_91.0\mingwlibs\bin; spring_91.0\mingwlibs\dll; etc...


Install MinGW, select the 32bits version, 64bits is not supported (something to do with not all librarys[ddl i think] not begin 64bits and no one wanting to compile them in 64bits; in future when someone compile them in 64bits, Auswaschbar [AF from SpringRTS i think] expect 5-10% performance boost).

Select (make sure it is marked) at least the following components:
gcc (version: MinGW Stable!)
core
g++
openmp (optional)
binutils
mingw-runtime
w32api
mingw32-make (if you have no Make installed yet)
gdb (recommended for debugging)


DO NOT USE SPACES IN DIRECTORY(s) BELOW OR YOU WILL GET ERROR.

Now install/use CMake and use cmake gui.exe, select the "source (spring_91.0 folder)" and a "build directory", press Generate, make sure that "MinGW Makefiles" and "Use default native compilers" are selected, wait it finish.

Unmark:
BUILD_spring-dedicated
BUILD_spring-headless
BUILD_spring-multithreaded

Change:

CMAKE_BUILD_TYPE

RELWITHDEBINFO to CMAKE_BUILD_TYPE

RELEASE

MARCH_FLAG

i686 to MARCH_FLAG

native (look at http://gcc.gnu.org/onlinedocs/gcc/i386-and-x86_002d64-Options.html for more info or google "gcc march", that thing is your CPU optimization)

CMAKE_INSTALL_PREFIX

C:/Program Files (x86)/Spring to CMAKE_INSTALL_PREFIX

directory were you compile spring engine will be placed (hope no one literally place this text >.>, and do not use the same directory that was used in "build directory" above).

If you do not want OMP unmark OPENMP, it is marked by default and i let it marked cause it give performance boost too.

Press Configure and wait it finish, then press Generate and wait it finish.

Close CMake, if you did all correct you get no warning, if you did something wrong you will get a warning.



Now you will need admin right for compiling:

Run cmd.exe ( http://en.wikipedia.org/wiki/Command_Prompt ), using cd "folder name" and press enter to go inside the folder and "cd .." and press enter to go a folder "up" ( http://coweb.cc.gatech.edu/ice-gt/339 for more info).

Go to the "build directory" you chose in Cmake and digit "mingw32-make install-spring" and press enter, WAIT A LONG TIME, when it end you will have you optimized version in the CMAKE_INSTALL_PREFIX location you did choice.

jK told me you can use "mingw32-make install-spring -jx" too, were the x

to the numbers of your CPU cores +1, so dual core

"mingw32-make install-spring -j3" , so the compile time is faster, but i did not use it, so use it at your own risk.



Now if you use Zero-K Lobby you just need to go to Documents\My Games\Spring\engine change the 91.0 folder name to "91.0 backup", and paste you folder with the optimized version in Documents\My Games\Spring\engine with the name "91.0"

You may need to copy all dll from \mingwlibs\dll to your 91.0 folder, do not really remember if it was necessary, if you get no error, do not do it.

Done it!!!!!!!!!!!



If you build give a error or desycn to NOT ask me how, i have no idea, first time i did try i got error to, i think it was cause i compiled 2 times in same folder (do not do this). Do not use space(s) in directory/path/folder(s) or you will get a error of files not found.
Only thing i know is that it worked for me and [DDM]loveu2 and we do not desycn, and it is faster, how much faster i have no idea cause we do not have a deterministic benchmark system for springrts. My CPU is a AMD Turion II P560 2.5 GHz.

SSE5 and AVX are causing descyn for some ppl, if your CPU use it, better to use another march flag from the link above that do not use these sets, in v89 and future you can use native cause SSE5 and AVX will be blocked in code, so native is safe.

I wanted to post more pics to make it easier, but do not want to use
http://imageshack.us/ , cause i fear that all pics will end up was a frog in a ice cube thing....

For more help and the oficial tutorial see:
http://springrts.com/wiki/Building_Spring_on_Windows

Someone with a Youtube Acc, could make a video tutorail about it to, so its even easer.

Hope you like it Licho.

Dev can edit my post so it make more sense and/or look better, more structured.

updated for 91.0 - KingRaptor
+1 / -0
12 years ago
i will try this and report my findings!
thx
+0 / -0
thx for your effort. i will have a look at this this weekend.

can you estimate the performance gain compared with your old (default) spring copy?
+0 / -0
Btw, due to the recent engine hassle, i compiled myself an 88 series engine locally with OMP and such.

Now, linux package comes with OMP by default, but the hand-compiled one was SUPER EFFECTIVE - i get twice the fps than i used to in duels (it quickly becomes similar in team games tho; but in duels it equals +50 elo).

But, of course, nobody needs to explain how to compile to linux users :P it's three commands anyway. Bottom line, is that it's actually worth it.
+0 / -0
12 years ago
CMAKE Warnings:

warning: Java AI Interface will not be built!
warning: Java OO AI Wrapper will not be built!
warning: HughAI Skirmish AI will not be built!
warning: NullJavaAI Skirmish AI will not be built!
warning: NullOOJavaAI Skirmish AI will not be built!

Building Stopped at 57%:

[ 57%] Built target CppTestAI
Building CXX object AI/Skirmish/Shard/CMakeFiles/Shard.dir/__/__/Wrappers/CUtils
/SimpleProfiler.cpp.obj
[ 57%] Building CXX object AI/Skirmish/Shard/CMakeFiles/Shard.dir/__/__/Wrappers
/CUtils/SSkirmishAISpecifier.cpp.obj
[ 57%] Building C object AI/Skirmish/Shard/CMakeFiles/Shard.dir/__/__/Wrappers/C
Utils/Util.c.obj
Building CXX object AI/Skirmish/Shard/CMakeFiles/Shard.dir/__/__/Wrappers/CUtils
/TimeUtil.cpp.obj
Linking CXX shared module SkirmishAI.dll
[ 57%] Built target Shard
Linking CXX static library libassimp.a
[ 57%] Built target assimp
mingw32-make[1]: * [rts/builds/default/CMakeFiles/install-spring.dir/rule] Err
or 2
mingw32-make: * [install-spring] Error 2
+0 / -0
12 years ago
danil_kalina i am in the chat (zero-k and main chat in lobby) at the moment, can you go there its easy to talk/help that using the forum.
+0 / -0


12 years ago
For ZK none of those AI warnings are relevant.
+0 / -0
cmake gives me this warning:
WARNING: you are using the obsolete 'GLU' package, please use 'OpenGL' instead

what I do wrong?
+0 / -0


12 years ago
quote:
WARNING: you are using the obsolete 'GLU' package, please use 'OpenGL' instead

spring's cmakefile is old and silly, ignore that.
+0 / -0
Getting this near the bottom. It doesn't run.

-- Installing: E:/CMake/88compile/./unitsync.dll
CMake Error at tools/unitsync/python/cmake_install.cmake:31 (FILE):
file INSTALL cannot find "E:/CMake/88/pyunitsync.dll".
Call Stack (most recent call first):
tools/unitsync/cmake_install.cmake:53 (INCLUDE)


mingw32-make[3]: * [rts/builds/default/CMakeFiles/install-spring-default] Erro
r 1
mingw32-make[2]: * [rts/builds/default/CMakeFiles/install-spring-default.dir/a
ll] Error 2
mingw32-make[1]: * [rts/builds/default/CMakeFiles/install-spring.dir/rule] Err
or 2
mingw32-make: * [install-spring] Error 2


EDIT:
I'm taking out the python unit sync wrapper, since it seems to have died doing that.
+0 / -0
Ok now I have my selfmade springengine :)
I get only 10-15 fps+ in normal game, but may its my ATI^^.
Will test a bit more :)

Edit: Win7 64bit need for me admin right for compiling
so cmd with admin :)
+0 / -0

12 years ago
i did the compilation according to fortaleza's guide.

problems (first):
--mingW directory did not fit. PATH varible setting was invalid although set to the corresponding installation dir of this guide. previously installed mingw of another dev environment was chosen somehow, which lacked some dlls. solved by copying mingw from this guid to C:\mingw, which is ugly but works.

build for:
windows 7

build for cpu specs:
core2quad 6600
with MMX, SSE, SSE2, SSE3, SSSE3, for details see
http://en.wikipedia.org/wiki/List_of_Intel_Core_2_microprocessors#.22Kentsfield.22_.2865_nm.29

if someone wants to use it:
https://dl.dropbox.com/u/23979348/spring_static/88.0.7z
extract it into the following directory: (replace user with your windows username)
C:\Users\mo\Documents\My Games\Spring\engine\88.0


it is selected automatically when using zk lobby.

results:
test subject chicken easy, 200+ puppies pathing
i had the impression it was noticeable faster, had 120fps, which dropped to ~20fps with the puppies moving.



+0 / -0
12 years ago
Am getting a new error now. This one happens at a random percentage but always happens with gamedata.
Somehow, my CMake is refusing to build this.


Scanning dependencies of target gamedata
mingw32-make[3]: * [cont/CMakeFiles/gamedata] Error 128
mingw32-make[2]: * [cont/CMakeFiles/gamedata.dir/all] Error 2
mingw32-make[1]: * [rts/builds/default/CMakeFiles/install-spring.dir/rule] Err
or 2
mingw32-make: * [install-spring] Error 2
+0 / -0
edit: outdated
+0 / -0
edit: outdated
+0 / -0
hmm sorry, my installation above is not working. i was mistaken and did not work with the correct compiled version, instead the old, default installation.

my compiled version crashed to no reason...

i did exactly what fortaleza did to build (no copy of dlls)
logicfreak, do you have any hints what you did different from that?
+0 / -0
DErankAdminmojjj 88.0 or 89.0?

For 88.0 you should lunch you commandline with admin rights
---> Win 7 typ cmd into startmenu search bar and don`t press enter
rightclick on "cmd" an lunch it with admin right.
--->I suggest to make one folder for the soucre, one for the make files and one
for the compiled fiels ( when install put the files )

For 89.0 also notice that
http://springrts.com/phpbb/viewtopic.php?f=12&t=28505&p=526297&hilit=large+address+aware#p526297

P.S. @[DOOP]fortaleza mingw32-make install-spring -jx work good for me :)
+0 / -0
(0.88)
did before not use admin cmd, now redone with suggested settings. spring still crashes on starting with windows crash error :/
+0 / -0

12 years ago
Tested out the whole process, works fine on my win 7.
Also, for even more optimizations:
enable LTO-WHOPR flag in cmake interface
add CMAKE_CXX_FLAGS = -O3 flag. Here "O" is a letter, not a number.

WARNING - those are masively experimental, use only as last resort and do not complain if it does not work. Also LTO optimization will eat ALOT of ram, up to several GB depending on your luck, so be sure to have it.
+0 / -0

12 years ago
Also would be great to get this whole thing into mainline spring documentation at some point...
+0 / -0
Page of 2 (39 records)