Skip to content
Steffen edited this page Sep 14, 2017 · 10 revisions

These instructions are for an Ubuntu Linux system.

Prerequisites

sudo apt-get install git cmake gcc make libxml2-dev liblua5.2-dev libtolua-dev libncurses5-dev libsqlite3-dev

Clone all the repositories

If you have not cloned the repositories to your own github account, you can just clone the official repositories to get you started. The game will be located in an eressea folder inside your Home.

export ERESSEA=$HOME/eressea
mkdir $ERESSEA && cd $ERESSEA
git clone --recursive git://github.com/eressea/rules.git
git clone --recursive git://github.com/eressea/echeck.git
git clone --recursive git://github.com/eressea/server.git git
cd git
./configure

You may want to add the setting of the ERESSEA environment variable to your ~/.bash_aliases file, as it gets referenced by a lot of scripts later in the process. All future steps in this tutorial assume that this environment variable is set.

Compile Code

  1. compile, test and install the code:

Eressea uses cmake to build the server executable, and there are some scripts to help with the commands. The configure script you ran earlier has already created the necessary Makefiles, so just build the code and test it. These scripts are executed from inside the ~/eressea/git/ directory.

cd $ERESSEA/git
s/build && s/runtests && s/install
  1. install the code and set up your game:

This guide supports several running games installed side-by-side, running off of the same code. Games are numbered, and the game data will be in folders named game-1, game-2, ... under the eressea/ folder, alongside the server/ directory containing the compiled code. The latter is created by running the install script.

cd $ERESSEA/git
s/install
s/setup -g 1 -n -r e4

The arguments for the setup scripts are somewhat important: -g game identifier, creating game-1 in this example -n create a new eressea.ini configuration file (overwrite existing) -r rule set name. Sets supported by default, are e2, e3, e4.

  1. Navigate to eressea/server/bin
  2. cd eressea/server/bin
  3. Create a shortcut for “eressea” file and place it in eressea/game-5 folder
  4. Make sure to rename it to “eressea” after moving it
  5. Code is completely compiled, but still not ready for operation

Data (world) Creation

  1. You can view scripts for world creation in eressea/server/scripts/tools/build-e{3,4}.lua

    • These scripts are not ready to use, but for reference on how to create your own.
  2. Alternatively the long hand example below will allow you to manually create a data file

  3. Create “boilerplate.lua” with the following code:

    local path = "scripts"

    if config.install then

     path = config.install .. "/" .. path
    

    end

    package.path = package.path .. ";" .. path .. "/?.lua;" .. path .. "/?/init.lua"

    require "eressea"

    require "eressea.xmlconf"

  4. Place “boilerplate.lua” in eressea/server/game-5/ folder where game-? matches s/setup #

  5. cd eressea/game-5

  6. Open eressea command line

    ./eressea

  7. You will be at an eressea command line E>

  8. Run the following commands to create a quick test world

    dofile('boilerplate.lua') -- clear the game data: eressea.free_game() -- make the world 11*11 hexes, and wrap at the edges -- with coordinates in [-5..5],[-5..5] pl = plane.create(0, -5, -5, 11, 11) -- create a new region: r = region.create(0, 0, "plain") -- ... ditto for "ocean", "mountain", "highland", etc. -- create a new player faction (humans, german language): f = faction.create("enno@eressea.de", "human", "de") -- create a 1-person unit for this faction, in that region: u = unit.create(f, r, 1) -- give it some stuff: u:add_item("silver", 1000) u:add_item("horse", 1) u:add_item("log", 5) -- write the game to disk: eressea.write_game("0.dat") -- export the world to JSON (map only): eressea.export("map.json", 1) -- export the world to JSON (with factions and units): eressea.export("world.json", 7)

  9. That export function at the end of the example script hints at another way to create the world. If you have another mapping tool, and you can convert its output to the same JSON format, then you could create a world by simply importing it from that interchange format.

  10. If you created “world.json” outside of e> then need to import and write the the game file

    eressea.import("world.json")

  11. Whichever process you created “world.json” in you now need to write the data to eressea

    eressea.write_game("0.dat")

  12. The game does have a map editor which can now be used instead of scripting

  13. You must still be at an eressea command line E> or run ./eressea again from eressea/game-5

    E> dofile('boilerplate.lua') E> eressea.read_game("0.dat") E> gmtool.editor()

  14. This reads the configuration data, again, then reads the tiny world we created earlier, then starts the editor. It will look as if there is more than one plain on the screen, don't let that fool you - because the world wraps at the edges, this is all the same region. You can navigate the world with the arrow keys, and there are a lot of other keyboard combinations that are poorly documented. Try Ctrl-T for terraforming, Space to select/deselect a region, and semicolon followed by t to terraform the current selection. It's a little clunky, but it allows interactive map editing. Shift-S saves the game.

  15. Each game has slightly different rules, and needs to know where the configuration data lives, so the game directory contains an eressea.ini file. The file looks like this:

    [eressea] report = reports locales = de,en [lua] install = /home/eressea/eressea/server paths = /home/eressea/eressea/server/scripts:/home/eressea/eressea/server/lunit rules = e4 kill_after = 3 maxnmrs = 5

  16. Now create a file called reports.lua with the following code:

    dofile('boilerplate.lua') eressea.read_game('0.dat') init_reports() write_reports()

  17. Place “reports.lua” in eressea/server/game-5/ folder where game-? matches s/setup #

  18. You now need to get everyones first reports

  19. Run the following to generate turn 0 reports

    cd eressea/game-5 ./eressea reports.lua

  20. You now have (hopefully) a fully functional game

  21. The command line for running a turn is:

    cd eressea/game-5 ./eressea -t $turn run-turn.lua – where $turn equals the turn number you wish to run-turn

  22. Orders need to be compiled in eressea/game-5/orders.$turn to be executed

  23. After getting your first reports the orders would go into eressea/game-5/orders.0/

  24. The next orders will go into eressea/game-5/orders.2 and then orders.3, orders.4, etc.

  25. The order.$turn folders need to be manually created after each turn.

abc

local path = "scripts"
if config.install then
    path = config.install .. "/" .. path
end
package.path = package.path .. ";" .. path .. "/?.lua;" .. path .. "/?/init.lua"
require "eressea"
require "eressea.xmlconf"
Clone this wiki locally