-
Notifications
You must be signed in to change notification settings - Fork 9
Installation
Might & Fealty was designed to run on a Debian Server using Apache2, PHP5, Python, Tilecache, and PostgreSQL, with additional installations of a QGIS Server, Graphviz, and the libraries required to connect them all to each other. Installation on other OS's may be doable (Ubuntu, for instance), but are not officially supported. This installation guide will assume you're loading everything on to a freshly installed copy of Debian 8, and logged in as a user with sudo privileges.
- Debian 10 OR Ubuntu 20.04 (Not known functional on new versions)
- A CPU -- This mostly determines how fast the game turns will process. Faster is better. More cores will only assist the users (as their sessions can be on other cores, but the game turns will not.)
- 4 GB RAM -- This is a guess mostly, but apache will load the entire game and database to memory. The game is a few dozen megabytes, but the database is several hundred.
- HDD with atleast 1GB of free space. -- This is mostly to allow space for the statistics logging, which will in time take upt he bulk of your database--stats and messages anyways.
Bare essentials to get this running.
-
sudo apt-get install php7-- Versions 7.0, 7.1, and 7.2 are supported. Anything higher breaks Symfony. ReMaF supports PHP8+. sudo apt-get install php-domsudo apt-get install php-xml-
sudo apt-get install postgresql-9.6-- Yes, this is old, we know. I'd love to update it, but the game is kind of a house of cards. sudo apt-get install postgissudo apt-get install php-pgsql
If you just want to code, the game will automatically point itself at the live game's QGIS server, so you won't need these. If you're feeling adventurous though, you can setup your own.
sudo apt-get install python-flupsudo apt-get install python-pastesudo apt-get install qgis-server
You will also need apache, and to talk to Andrew about what needs to be in the site file for M&F. We're not going to include that here.
sudo apt-get install Apache2
M&F is setup to run in basically any operating environment, but it works best if PHP is given access to sufficient quantities of RAM and allowed atleast a thousand variables for apache users (this allows users to manage sufficient numbers of soldiers--we're working on making soldiers more user friendly, so this may change).
More RAM lets the turn processing happen faster and in fewer database actions, while more variables allows users to field more soldiers.
If you're using a local database, you'll also want to setup PostgreSQL to have a user and database for M&F. We recommend calling them both "maf", as it keeps things simpler. You could skip on giving This can be done pretty simply just by using the following commands:
-
sudo su postgres-- Login as psql super user -
psql-- Launch PSQL -
CREATE ROLE maf LOGIN CREATEDB PASSWORD 'yourpasswordhere';-- Create custom user role. -
\q-- Quit PSQL -
createdb -O maf maf-- Create "maf" database with ownership give to "maf" user. -
exit-- Exit psql super user
And yes, you should change that to a password you'll remember--you'll need it later.
Thankfully, we store the developer database code in the exact same format we use for backups, so once you have a copy of the map database, which we'll assume is maf-dev-db.sql.gz, you can follow the below instructions:
-
gzip -d maf-dev-db.sql.gz-- Decompress the SQL file. -
psql -d maf -va -f maf-dev-db.sql-- Run the SQL file against the "maf" database. This will generate a couple errors as certain users may be missing from our database--it shouldn't cause any issues.
First, you need to download the master repository to a directory and unpack it. Other branches or forks may not be functional or at all working. We're going to assume /var/www/maf/ as the directory for the purposes of this install.
Second, download PHP Composer to /var/www/maf/.
Now, we tell composer to install the game!
php composer.phar install
This may error out, but this is expected, as the game is missing vital information needed to do things. If all goes well, it'll be prompting you for some information, which we'll explain below what your options are for each:
-
database_driver: pdo_pgsql -- The database driver used to access the database. If you're using PostgreSQL, then it's pdo_pgsql.
-
database_host: 127.0.0.1 -- Host IP of the database. Yes, you could host your SQL server elsewhere. If it's on the same machine, which we recommend, then either LOCALHOST or 127.0.0.1 is fine for this. If it's elsewhere, enter the IP of that machine.
-
database_port: 5432 - Port used to access the database. If it's local, this is 5432, unless you've messed with configs somewhere in your postgres install. If it's remote, probably 5433.
-
database_name: maf - Name of the database to access that will store your game data.
-
database_user: root - Name of the database user to use to access above database. This should not be root. We recommend 'maf'.
-
database_password: something - The password for the above user. You should've set this up when you created the database and user earlier.
-
mailer_transport: none - Options are: none, smtp, or sendmail. M&F itself uses smtp, which means that things are sent immediately by the local machine via a remote SMTP server. You can use whatever you like though. Even google, for this, if you like.
-
mailer_host: ~ - hostname or IP of your mailer host.
-
mailer_port: 25 - Depends on your host. If "sendmail" above, leave this empty.
-
mailer_authmode: login - Depends on your host. If "sendmail" above, leave this empty.
-
mailer_encryption: null - Depends on your host. If "sendmail" above, set to null.
-
mailer_user: ~ - Depends on your host.
-
mailer_password: ~ - Depends on your host. If "sendmail" above, set to null.
-
mailer_disable: true - Master switch for sending mails or not. If set to true, game will not generate emails to be sent. Set to true for development environments where you aren't testing the mailer settings.
-
locale: en - language locale.
-
secret: ThisTokenIsNotSoSecretChangeIt - Make it random, long, and something you'll never remember. And yes, you should totally change it from the default.
While M&F is fairly tolerant towards having no in-game data, there are certain tables it requires exists in order to semi-function, a few of which must have atleast one entry.
So, lets build that database, and by that we mean lets tell Doctrine to do it for us. First, lets make sure it can talk to the database right:
php app/console doctrine:schema:update --dump-sql
If that dumps out hundreds and hundreds of lines of create and alter table commands, excellent! There should be over 1000 of them, and that's what we want. It means Doctrine can not only talk to the database, but knows what it needs to do to bring it up to what the game expects!
php app/console doctrine:schema:update --force
The Development database doesn't include the basic type data, so next we can load those in:
php app/console doctrine:fixtures:load --append
This should generate less than 20 lines of console output, telling you it's loading in different DataFixture files. If you drop --append and do the confirmation, you'll need to drop the database and rebuild it, because you've dumped your map data. Sorry.
Next, you need to run a single simple command inside the SQL database you made earlier. For simplicity, we'll do this as the PSQL super user.
-
sudo su postgres-- Login as psql super user -
psql -d maf-- Connect to the maf database -
update geofeature set type_id = (select id from types.featuretype where name = 'settlement');-- Set the feature type IDs for the existing settlement features to the correct feature type ID, now that relations exist again. -
\q-- Logout of the database -
exit-- Logout of psql super user
You will need some credentials to log into your own instance, so run the following command and provide the requested data.
php app/console fos:user:create
If you want to test GM or Admin sides, you'll also need to run:
php app/console fos:user:promote
And assign the appropriate role you wish to test.
At this point, its best to test your configuration. The easiest way to do this, if you're installing it locally, is to navigate to the maf directory and have PHP start a server up, then navigate to 127.0.0.1:8000/en/ in the machine's browser and see if the homepage will load.
cd /var/www/maf/php app/console server:start
If you get no CSS (no style information), run the following command from that directory:
php app/console assets:install
Assuming you now have style, you can run the following commands to build the entity data.
php app/console doctrine:generate:entities BM2 --no-backup
At this point, you should have a user account to log in with. Go ahead and click login on the M&F landing page, fill out the boxes, and press submit. If you get a blank page going nowhere, restart your machine. This means PHP isn't loading the PDO drivers correctly.
You will probably get an offset error at this point, because the game expects some UpdateNote to already exist. So lets make one:
sudo su postgrespsql -d mafinsert into updatenote (id, ts, version, title, text) values (1, 'now', '1.0.0.0', 'Dev Instance', 'Filler Text');
Stay logged in for now, but refresh that page that errored earlier. You should be able to create a character now. There are no places, but once we get to the point of choosing an arrival location, simple go back to the terminal you have open for the SQL and run the following:
update playercharacter set location = (select location from geofeature where id = 855), alive = true, retired = false where id = 1;\qexit
This will put your character outside, but in the same spot as the, at the time of writing this, settlement of Bonrick. From here you can do whatever it is you wish.