These notes describe the steps needed to compile and run your own server or
editor for One Hour One Life.


NOTE:  Neither of these aspects of the game are quite ready for public 
       consumption.  That's why I'm not currently shipping binary versions
       of these for Windows, Linux, or Mac.
       I likely will release binary versions that "everyone" can easily
       use someday, but right now, this is not a high priority.
       So, if you're reading this and ready to proceed, I'm assuming that
       you're ready to work with unreleased software.
       (It's not THAT bad.  I use this software every day.  It's just not
        that easy to get it set up and running.)


ALSO:  This document doesn't currently explain how to USE the editor.
       It's pretty complicated.  Play around with it, and see what you can 
       figure out.  Probably the best way to understand how it works is
       to watch me use the editor here:

	   Summary:
	   https://www.youtube.com/watch?v=27cztry-gJQ
       
	   Full stream:
	   https://www.youtube.com/watch?v=WbQsZ5rQ2gg



The editor requires the dev package of libpng installed.  On Ubuntu, this is:

sudo apt-get install libpng12-dev


Assuming that you have OneLife_Live_UnixSource installed and updated:



==========================
= Editor                 =
==========================

Build the editor thus:

cd OneLife/gameSource
./makeEditor.sh
cp EditOneLife ../..
cd ../..


Edit settings/editorImportPath.ini to specify where your scanner saves PNG 
files.  These are used to import sprites.  Even if you're not using a scanner
or hand-drawn art, you can save your art files into this location to import
them.  The editor auto-trims/feathers anything with a white background.

Note that the editor can merge multiple layers into each sprite.  A color 
layer, which will be opaque and must have black outlines, and a line layer,
which is monochrome and transparent over the color layer.  The color layer
is imported with the Sprite Import button, while line layers are imported
with the Line Import button.  Both import from the same PNG file location.

Also, there can be multiple Line layers which get overlayed, but only one
opaque color layer.


Run the editor with:

./EditOneLife


Note that the editor looks for data folders (sprites, objects, etc.) in its
current working directory.  The steps listed above install the editor
so that it will edit the game's actual data.  If you want to edit your own
data, starting from scratch, give it empty folders (sprites, objects, etc.)
instead of those symlinks to the OneLifeData7 data.




==========================
= Server                 =
==========================

Note that the live servers sometimes run even more recent code than the latest
tagged client version, which is what is checked out by OneLife_Live_UnixSource.

To update to the latest live server code on your server, which is optional,
do this:

cd OneLife
git pull --tags
git checkout OneLife_liveServer
cd ..




Build the server thus:

cd OneLife/server
./configure
make
ln -s ../../OneLifeData7/objects .
ln -s ../../OneLifeData7/transitions .
ln -s ../../OneLifeData7/categories .
ln -s ../../OneLifeData7/tutorialMaps .
ln -s ../../OneLifeData7/contentSettings .
ln -s ../../OneLifeData7/isAHAP.txt .
ln -s ../../OneLifeData7/dataVersionNumber.txt .




Run this to find the latest version:

git tag

The version names are in the form OneLife_vN, where N is the number.  Suppose
you see OneLife_v69 as the latest.  Do this:

echo "69" > serverCodeVersionNumber.txt



If you want to write a bash script to do this for you, try this:

git for-each-ref --sort=-creatordate --format '%(refname:short)' --count=2 refs/tags | grep "OneLife_v" | sed -e 's/OneLife_v//' > serverCodeVersionNumber.txt



Note that this makes links to the game's real data.  If you want to use your own
custom data, make links to your own folder instead (see above instructions 
for the editor.)

The server doesn't need sprites or animations or several of the other data
folders.



Also note that if you are making your own custom data, you probably want to 
pick your own dataVersionNumber.txt that is NOT in the same numerical space as
the main game's numbers.

These still must be integer numbers, as the server is handling them as numbers.
If the number on the server does not match the number on the client, a version
mismatch error will be displayed on the client.

For example, if the current main game data is 67, and the latest main game
code number is 70, then the server will report 70 as the version number to
the client (it reports which ever number is bigger).

If you want to use your own custom data, picking a high version number for
it should work, such as 90664.  I will likely never ship 90,000 revisions of
the main game, and by picking a unique number suffix like 664, you will avoid
collisions with other data mods.

Thus, the server will still be using code version 70, but data version 90664,
so it will report 90664 to the client.  The client will fail to connect unless
it has your mod installed with that dataVersionNumber.






In terms of settings, there are a bunch in the settings folder.

You probably at least want to disable requireTicketServerCheck and maybe
enable the client password instead.  Your client can then set the password
in its settings folder.

Or you can run your own ticketServer to have full-blown per-user accounts, 
which is beyond the scope of this document.  Details can be found in this
guide for running Castle Doctrine servers:

http://sf.net/p/hcsoftware/CastleDoctrine/ci/default/tree/server/HowToInstall.txt


Run your server thus:

./OneLifeServer


To connect, in your client settings folder, set useCustomServer and 
customServerAddress


By using a client password and a custom server address, it's possible to run
a private server for your friends.
