Get Unknown Horizons

From Unknown Horizons - Wiki
Jump to: navigation, search

Official Instructions

This page only provides additional pieces of information in which you might be interested eventually, for instance compiling pyenet on your own. The main installation and download instructions are found at our main page: Official Instructions

LinuxLogo.png LINUX

Integrating Unknown Horizons

Optionally Unknown Horizons can be integrated in you system to get started by typing unknown-horizons in command line, script or launcher only. Thereto the following commands have to be executed in terminal with root permission:

root@pc: ~
echo '#!/bin/bash' > /usr/local/bin/unknown-horizons
root@pc: ~
echo 'python ~/UnknownHorizons/unknown-horizons/run_uh.py' >> /usr/local/bin/unknown-horizons
root@pc: ~
chmod +x /usr/local/bin/unknown-horizons


MAC OS X

Get Dependencies

First you need to ensure that you are using Python 2.6. Do this by open the Terminal and type: defaults write com.apple.versioner.python Version 2.6

We will need the following dependencies:

 - scons (http://www.scons.org/)
 - libsdl (http://www.libsdl.org/release/SDL-1.2.14.tar.gz)
 - +image (http://www.libsdl.org/projects/SDL_image/release/SDL_image-1.2.10.tar.gz)
 - +mixer (http://www.libsdl.org/projects/SDL_mixer/release/SDL_mixer-1.2.11.tar.gz)
 - +ttf (http://www.libsdl.org/projects/SDL_ttf/release/SDL_ttf-2.0.10.tar.gz)
 - libpng (http://prdownloads.sourceforge.net/libpng/libpng-1.5.4.tar.gz?download)
 - libguichan (http://guichan.googlecode.com/files/guichan-0.8.2.tar.gz)
 - boost, boost-jam (http://sourceforge.net/projects/boost/files/boost/1.47.0/)
 - pyrex (http://www.cosc.canterbury.ac.nz/greg.ewing/python/Pyrex/Pyrex-0.9.9.tar.gz)
 - pyyaml (http://pyyaml.org/download/pyyaml/PyYAML-3.10.tar.gz)
 - git (http://code.google.com/p/git-osx-installer/downloads/list?can=3)

Download and compile pyenet

For multiplayer games we use the network library enet and their python bindings pyenet. We've precompiled and are shipping pyenet for most platforms, so you usually don't need to compile pyenet on your own. This is mainly for the sake of completeness.

Current enet version used: enet v1.3.0.

enet libraries are located inside Folder.png horizons/network/<platform>-<arch>

Unix

  • Download enet and checkout pyenet from svn
  • Extract pyenet
  • Extract enet INTO pyenet directory
  • Rename enet directory to Folder.png enet
  • Generate and compile the module:
user@pc: enet
python setup.py build
  • File.png enet.so should now be located inside Folder.png build/lib.<some-arch-string>/
  • If something goes wrong make sure you have pyrex (python module) installed

Windows

  • Download and install ActivePython
  • Identify and install the VC++ version which activepython has been compiled with. This can be done by opening python.exe with Dependency Walker and search for the version of the msvcr (C Runtime) dependency. Then check which version of vc++ uses/compiles with that runtime. For ActivePython 2.6.5.14 this is MSVCR90 respectively VC++ 2008.
  • Download enet and checkout pyenet from svn
  • Extract pyenet
  • Extract enet INTO pyenet directory
  • Rename enet directory to Folder.png enet
  • Open command prompt and change directory to your pyenet directory
  • Install pyrex using pypm:
user@pc: pyenet
pypm install Pyrex

Please note that on ActivePython x64 pypm is only available for Business Edition. So just use the Pyrex package from ActivePython x86 or download Pyrex from source.

  • Generate c-code:
user@pc: pyenet
python -c "from Pyrex.Compiler.Main import main; main(command_line = 1)" enet.pyx
  • Compile the module:
user@pc: pyenet
python setup.py build
  • File.png enet.pyd should now be located inside Folder.png build/lib.<some-arch-string>/

In order to compile for Windows x64 you need to install the x64 compiler:

  • Download and install Windows SDK (for MSVCR90 Windows SDK for Windows Server 2008 and .NET Framework 3.5)
  • Reinstall or repair VC++ 2008. This is due to the SDK reverting the runtime library version.
  • Modify the amd64 part of File.png vcvarsall.bat in VC-INSTALL-DIR\VC to call "%~dp0bin\vcvars64.bat" instead of "%~dp0bin\amd64\vcvarsamd64.bat". Note the file is listed twice (inside the if and as call parameter)
  • Proceed with the compiling step from above

OS X (darwin)

  • See Unix.

Darwin was a bit more complicated and I don't remember most stuff anymore. Most difficult was: There's no pyrexc binary, so you have to create one like that on your own:

#!/usr/bin/python
from Pyrex.Compiler.Main import main
main(command_line = 1)

or use the one-liner:

user@pc: pyenet
python -c "from Pyrex.Compiler.Main import main; main(command_line = 1)" enet.pyx

to generate the c-code

Another method is to download Pyrex into your homefolder and use that one:

  • First download and extract pyenet + enet (see above).
  • Then download and extract pyrex into your homefolder:
user@pc: ~
cd $HOME
user@pc: ~
tar xfz Pyrex-0.9.9.tar.gz
  • Back in pyenet directory use the extracted Pyrex:
user@pc: pyenet
PYTHONPATH=$HOME/Pyrex-0.9.9 python -c "from Pyrex.Compiler.Main import main; main(command_line = 1)" enet.pyx
user@pc: pyenet
python setup.py build
Personal tools