How to Install
Clone this wiki locally
In order to play the game, you do not actually need to install anything. You can play directly on our server at www.schemaverse.com. This tutorial is more for those who would like to help in developing Schemaverse further and need their own environment for testing. If you are here to figure out how to get started, then follow this link to How to Play.
**Do NOT install this on something important. **
Make sure your postgres application is listening remotely unless you only plan on playing the game with local shell users.
Create a user to act as the game administrator. I highly suggest you name this user schemaverse to save yourself some hassle. I have also made the user a superuser because I'm a rebel like that.
CREATE ROLE schemaverse LOGIN NOINHERIT CREATEDB CREATEROLE VALID UNTIL 'infinity';
I, as a bad person, give this user the ability to connect with TRUST do the schemaverse database. Really if they have access localy to the system they can probably read any password you put in a config file anyways so this just skips the middle man. Feel free to argue this with me though, I'm open to suggestions.
Next, you need to create thee database. Make sure you make the owner of the database the same as the user you just created.
CREATE DATABASE schemaverse WITH ENCODING='LATIN1' OWNER=schemaverse;
Now you must deploy the sqitch project to setup the schema.
This will create roles, tables, views, triggers, functions and set permissions across everything to basically setup the game. Everything except the following which you should run as a superuser (simply using the schemaverse database owner will not work).
> git clone https://github.com/Abstrct/Schemaverse.git > cd Schemaverse/schema > sqitch --db-name deploy
Now, run the tic.pl, stat.pl and ref.pl game scripts. These will progress the game play each minute and monitor the database to make sure users are not running excessively long queries.
screen perl tic.pl screen perl ref.pl screen perl stat.pl
Right now tic.pl and ref.pl will sleep for 60 and 30 seconds respectively. If you would like to change this, simply change the sleep(); call at the end of each file. Keep in mind a ship can only do one action per tic so too long and the game may get a bit boring.
If you want to check and make sure the tic script is working, check the sequence tic_seq using any database user with access to the schemaverse database. This value should increase each time the script is run.
There may also be some changes to postgresql.conf that you will want to make but I am still working on finding a good balance here. I will just list any changes I make here but they are not necessary for the game to run:
statement_timeout = 120000 #Prevents players from running near-infinite statements
Finally, to assure players can connect, add the following line to your pg_hba.conf file
host schemaverse +players 0.0.0.0/0 md5
Reload postgres and your schemaverse setup should be good to go.
To create a player in your own database, simply add a new row to the player table as shown below. Since regular player accounts will not have insert privileges on this table, you will need a special user (or just the main schemaverse user) to perform this step. I will be committing a small web-app to do this but it is only one insert line so it should be easy to make your own method as well.
INSERT INTO player(username, password) VALUES('newuser','newpass');
This will then trigger the following piece of code to run:
execute 'CREATE ROLE ' || NEW.username || ' WITH LOGIN NOSUPERUSER NOCREATEDB NOCREATEROLE UNENCRYPTED PASSWORD '''|| NEW.password ||''' IN GROUP players';
After that, the new player will now has their own account in Postgres which they should be able to use to connect and play.
Making it interesting
Using the games administrator account you can pass out some necessities as you see fit.
Give all players some cash and fuel to explore with:
update player set balance=1000000 and fuel_reserve=1000000
Have fun and don't forget to support the game by submitting bugs, fixes, items and other new features.