Downloading the source code: различия между версиями

 
imported>Dragomagol
(→‎Setting up the database: Added link to video showing setting up a database)
 
(не показано 48 промежуточных версий 17 участников)
Строка 1: Строка 1:
This page contains the information and steps needed to download the latest version of the code, compile it and host your own server.
This page contains the information and steps needed to download the latest version of the code, compile it and host your own server.
== Other guides ==
Back when this guide was first written, we were using Google Code, we've since moved to GitHub. This page has not yet been fully updated to reflect using TortoiseGit. To see how to use TortoiseGit properly, please go to the [[Setting up git]] page.


== Licensing ==
== Licensing ==


The TG Station 13 source code is open. The license allows you to do most things, but if you're really interested in more, see below.
The /tg/station 13 source code is under [http://www.gnu.org/licenses/agpl-3.0.html GNU AGPL v3 license] and the assets are [http://freedomdefined.org/Licenses/CC-BY-SA CC-BY-SA].
 
'''NOTE!''' The actual license is located on our [http://code.google.com/p/tgstation13/ Google SVN page].
 
The license that we use allows you:
 
*to '''Share''' — to copy, distribute and transmit the work
*to '''Remix''' — to adapt the work
*to '''make commercial use''' of the work
 
Under the following conditions:


*'''Attribution''' —  You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work).
In simple terms this means that if you host a server based on /tg/station, any of your players must be able to access your source code.
*'''Share Alike''' — If you alter, transform, or build upon this work, you may distribute the resulting work only under the same or similar license to this one.


== Downloading ==
== Downloading ==


We use GitHub to host our project.
We use GitHub to host our project. Our repository is online at https://github.com/tgstation/tgstation.
 
* Go to [https://github.com/tgstation/-tg-station]
* Download the source code as a ZIP file, it is about 32MB
 
 
If you don't want to download 30MB of data every time an update is made, you can use [http://code.google.com/p/tortoisegit/ TortoiseGit].
 
#After installing it, go to the [https://github.com/tgstation/-tg-station /tg/station GitHub page].
#Copy the HTTP link.
#In Windows Explorer, right-click the folder you wish to store the code in and click "Git Clone..."
#In the URL field, paste the HTTP link.
#Click OK. The code will begin downloading.
 
== Updating to the latest revision ==
 
If you have downloaded the source code using TortoiseGit, simply right-click the folder, go Git Sync..., and press the Pull button.


If you downloaded the code in a zip file, you need to download another zip file.
You can use any Git client to "clone" the repository, downloading a copy to your machine. You can also use Git to "pull", which updates your copy to match recent changes. See [[Setting up git]] for a tutorial.


== "I did not change anything, but the code does not work anymore!" ==
== "I did not change anything, but the code does not work anymore!" ==
Строка 49: Строка 18:
To fix this, you need to:
To fix this, you need to:


*Delete tgstation13.dme
*Re-download everything
*Update your code
*Copy over your config folder and the data folder
*Run a Clean-Compile
*Clean compile
 
If you're using git reset hard against the tgstation upstream master branch and then recompile


== Hosting a server ==
== Hosting a server ==


To get a simple server running first
To get a simple server running first
* Download the source code as explained above
* Download the source code as explained [[Downloading_the_source_code#Downloading|above]]
* Open tgstation13.dme in dream maker (double click it)
* (Optional: Open config/game_options.txt and change settings to what you prefer. Change RUN_DELAY from 1 to 1.5 for same slower movespeed as official servers. )
* Once it opens select Build > Compile
* Enter the folder with the source code and double click '''Build.bat'''
* Wait until it compiles. Once it does a new file "tgstation13.dmb" will be created in the same folder where "tgstation13.dme" is. The dmb file has an orange icon. Compile time usually takes between 1 and 10 minutes, depending on your computer. Dream maker will show as 'not responding' during this time, but it is compiling.
* Wait until it compiles. Once it does a new file "tgstation.dmb" will be created in the same folder where "tgstation.dme" is. The dmb file has an orange icon. Compile time usually takes between 1 and 10 minutes, depending on your computer. It is a two step process: first it compiles "tgui" (javascript code), then "dm" (dream maker code).
* Open dream daemon (Win7: start menu > all programs > BYOND > Dream Daemon; Win8: start > type Dream Daemon > Dream Daemon)
* Open dream daemon (Win7: start menu > all programs > BYOND > Dream Daemon; Win8: start > type Dream Daemon > Dream Daemon)
* Select the "..." in the lower right corner and select the file "tgstation13.dmb".
* Select the "..." in the lower right corner and select the file "tgstation.dmb".
* Click the "GO" button and wait until it changes to a red "stop" button. Starting the server usually takes between 1 and 5 minutes. It is fully started once you can normally interact with Dream Daemon and a byond://xxx.xxx.xxx.xxx:xxxxx link is present at the bottom.
* Click the "GO" button and wait until it changes to a red "stop" button. Starting the server usually takes between 1 and 5 minutes. It is fully started once you can normally interact with Dream Daemon and a byond://xxx.xxx.xxx.xxx:xxxxx link is present at the bottom.
* Click the yellow button (former "...") to auto-join
* Click the yellow button (former "...") to auto-join
* Left click the link (byond://xxx.xxx.xxx.xxx:xxxxx) to copy it to clipboard
* Left click the link (byond://xxx.xxx.xxx.xxx:xxxxx) to copy it to clipboard
* Paste the link (ctrl+v) to your friends so they can join.
* Paste the link (ctrl+v) to your friends so they can join.
*'''NOTE: You can double click the tgstation.dmb file in folder to run a local game for testing/solo purposes.'''


== Making your server visible on byond.com ==
== Making your server visible on byond.com ==
Строка 71: Строка 44:
You '''DO NOT NEED''' to pay for membership to make your server visible on byond.com!
You '''DO NOT NEED''' to pay for membership to make your server visible on byond.com!


Follow [http://forums.nanotrasen.com/viewtopic.php?f=3&t=7632 this guide] on the forums! Do your best to ignore the tasteless doodles.
To make your server show up, edit the hub config option https://github.com/tgstation/tgstation/blob/master/config/config.txt#L7


== Setting up the database ==
== Setting up the database ==


Also see [[Working with the database]].
* Download and install [https://mariadb.com/downloads/mariadb-tx MariaDB] for your operating system.
 
** (Defaults should work, you need tcp enabled and to set a root password. if it offers do not set it up to use windows authentication)
* Download and install XAMPP ([http://www.apachefriends.org/en/xampp-windows.html Windows], [http://www.apachefriends.org/en/xampp-linux.html Linux]). Make sure you have both apache and mysql selected when you install it.
* Open HeidiSQL (comes with mariadb) and connect it to the database
* Run XAMPP Control Panel (Open start menu, type 'xampp' in the search field and run it)
** Click on new to create a new session, check prompt for credentials and leave the rest as default.
* Click 'Start' next to Apache and MySQL in the control panel. (Apache often conflicts with skype, so make sure you have skype off: Right click it's icon in the tray and click quit. Hiding it is not enough.)
** Click save, then click open and enter in root for the username and the password you setup during the installation.
* Go to the following address in your browser: [http://localhost/phpmyadmin http://localhost/phpmyadmin] (will only work once you start up both Apache and MySQL in the XAMPP Control Panel)
* Right click on the server entry in the left side plane (the area with information_schema, mysql, etc) (the server entry will be the first one) and go to create new -> database
* Click on the button titled SQL in the row of buttons at the top.
** You can name it anything at this step, tg13, tgstation13, ss13.
* Open the file 'SQL/tgstation_schema.sql' in notepad and copy its content. You can also find it [https://github.com/tgstation/-tg-station/blob/master/SQL/tgstation_schema.sql here], but it may be newer than the version you are using.
*** (Don't name it 'test' unless you like security issues)
* Paste the file's content into the input field for sql in phpmyadmin and hit 'Execute' in the bottom right
* Select the database you just created and then go to file -> load sql file and Open the file tgstation_schema.sql file in the SQL directory of the game. You can also find it [https://raw.githubusercontent.com/tgstation/tgstation/master/SQL/tgstation_schema.sql here], but it may be newer than the version you are using.
* Once you execute this, a new database should be added to the list on the left, called 'feedback'. If not, refresh the page. If you click on the database, it should show you all the tables it includes. At this point, you have created the database 'infrastructure'. You now have to create a user for it.
* Press the blue play icon in the topic bar of icon hieroglyphs and pray. If the schema imported correctly you should have no errors in the message box on the bottom
* Click on 'SQL' in the top again, and execute the following statement: CREATE USER 'myuser'@'localhost' IDENTIFIED BY 'mypass'; GRANT ALL ON feedback.* TO 'myuser'@'%'; Replace both instances of myuser with some username and mypass with some password. Be careful to copy all the apostrophes. This will create a new user and grant him all privileges for the feedback database.
* Create a new user account for the server by going to tools -> user manager
* Please keep phpmyadmin open for a while longer.
** hostname should be 127.0.0.1, not localhost if hosted locally, other wise use the ip of the game server.
** For permissions, do not give it any global permissions, instead click add object, and then select the database you created for the server, hit ok, then give it select, update, insert, and delete permissions on that database.
** You can click the arrow on the password field to get a randomly generated password of certain lengths, copy the password before saving as it will be cleared the moment you hit save.
* Open the file: [https://github.com/tgstation/-tg-station/blob/master/config/dbconfig.txt config/dbconfig.txt] in notepad
* Open the file: [https://github.com/tgstation/-tg-station/blob/master/config/dbconfig.txt config/dbconfig.txt] in notepad
* Make sure to set it so that:
* Make sure to set it so that
** SQL_ENABLED does not have a # in front of it
** SQL_ENABLED does not have a # in front of it
** ADDRESS localhost
** ADDRESS 127.0.0.1 (Replace with the database server's ip if not hosted locally)
** PORT 3306
** PORT 3306
** FEEDBACK_DATABASE feedback
** FEEDBACK_DATABASE tgs3 (replace with the database you created)
** FEEDBACK_LOGIN myuser (where myuser is the username you set in the CREATE USER statement)
** FEEDBACK_TABLEPREFIX (set this to nothing, since you're (I assume) using the default schema file we linked earlier)
** FEEDBACK_PASSWORD mypass (where mypass is the password you set in the CREATE USER statement)
** FEEDBACK_LOGIN myuser (replace with the user you created)
** FEEDBACK_PASSWORD mypass (replace with the user you created)
* The database is now set up for death logging, population logging, polls ([[Working with the database#Adding a new poll|Tutorial]]), library, privacy poll, connection logging and player logging. There are two more features which you should consider. And it's best to do so now, since adopting them later can be a pain.
* The database is now set up for death logging, population logging, polls ([[Working with the database#Adding a new poll|Tutorial]]), library, privacy poll, connection logging and player logging. There are two more features which you should consider. And it's best to do so now, since adopting them later can be a pain.
Still need help? [https://www.youtube.com/watch?v=ZevgiTr59H8 Give this guide a try.]


=== Database based banning ===
=== Database based banning ===


Offers temporary jobbans, admin bans, cross-server bans, keeps bans logged even after they've expired or were unbanned, and allows for the use of the off-server [http://www.ss13.eu/tgdb/banoverview.php ban log] (Arrange with errorage/rageroro in [[Community|#coderbus]]).  
Offers temporary jobbans, admin bans, cross-server bans, keeps bans logged even after they've expired or were unbanned, and allows for the use of the off-server ban log.  


To enable database based banning:
To enable database based banning:
Строка 105: Строка 83:
* Open config/config.txt
* Open config/config.txt
* Add a # in front of BAN_LEGACY_SYSTEM, so the line looks like "#BAN_LEGACY_SYSTEM"
* Add a # in front of BAN_LEGACY_SYSTEM, so the line looks like "#BAN_LEGACY_SYSTEM"
* Done. Note that any legacy bans are no longer enforced once this is done! So it's a good idea to do it when you're starting up.  
* Done. Note that any legacy bans are no longer enforced once this is done! So it's a good idea to do it when you're starting up.


=== Database based administration ===
=== Database based administration ===
Строка 119: Строка 97:
* If your database ever dies, your server will revert to the old admin system, so it is a good idea to have admins.txt and admin_ranks.txt set up with some admins too, just so the loss of the database doesn't completely destroy everything.
* If your database ever dies, your server will revert to the old admin system, so it is a good idea to have admins.txt and admin_ranks.txt set up with some admins too, just so the loss of the database doesn't completely destroy everything.


If you need more help contact '''Errorage/Rageroro''' in [[Community|#coderbus]].
If you need more help contact [[Community|#coderbus]].


For additional database-related tutorials, see [[Working with the database]].
For additional database-related tutorials, see [[Working with the database]].
Строка 125: Строка 103:


{{Contribution guides}}
{{Contribution guides}}
[[Category:Guides]] [[Category:Game Resources]]
[[Category:Coding]]

Текущая версия от 04:29, 29 июня 2023

This page contains the information and steps needed to download the latest version of the code, compile it and host your own server.

Licensing

The /tg/station 13 source code is under GNU AGPL v3 license and the assets are CC-BY-SA.

In simple terms this means that if you host a server based on /tg/station, any of your players must be able to access your source code.

Downloading

We use GitHub to host our project. Our repository is online at https://github.com/tgstation/tgstation.

You can use any Git client to "clone" the repository, downloading a copy to your machine. You can also use Git to "pull", which updates your copy to match recent changes. See Setting up git for a tutorial.

"I did not change anything, but the code does not work anymore!"

This is likely due to corrupted files. To fix this, you need to:

  • Re-download everything
  • Copy over your config folder and the data folder
  • Clean compile

If you're using git reset hard against the tgstation upstream master branch and then recompile

Hosting a server

To get a simple server running first

  • Download the source code as explained above
  • (Optional: Open config/game_options.txt and change settings to what you prefer. Change RUN_DELAY from 1 to 1.5 for same slower movespeed as official servers. )
  • Enter the folder with the source code and double click Build.bat
  • Wait until it compiles. Once it does a new file "tgstation.dmb" will be created in the same folder where "tgstation.dme" is. The dmb file has an orange icon. Compile time usually takes between 1 and 10 minutes, depending on your computer. It is a two step process: first it compiles "tgui" (javascript code), then "dm" (dream maker code).
  • Open dream daemon (Win7: start menu > all programs > BYOND > Dream Daemon; Win8: start > type Dream Daemon > Dream Daemon)
  • Select the "..." in the lower right corner and select the file "tgstation.dmb".
  • Click the "GO" button and wait until it changes to a red "stop" button. Starting the server usually takes between 1 and 5 minutes. It is fully started once you can normally interact with Dream Daemon and a byond://xxx.xxx.xxx.xxx:xxxxx link is present at the bottom.
  • Click the yellow button (former "...") to auto-join
  • Left click the link (byond://xxx.xxx.xxx.xxx:xxxxx) to copy it to clipboard
  • Paste the link (ctrl+v) to your friends so they can join.
  • NOTE: You can double click the tgstation.dmb file in folder to run a local game for testing/solo purposes.

Making your server visible on byond.com

You DO NOT NEED to pay for membership to make your server visible on byond.com!

To make your server show up, edit the hub config option https://github.com/tgstation/tgstation/blob/master/config/config.txt#L7

Setting up the database

  • Download and install MariaDB for your operating system.
    • (Defaults should work, you need tcp enabled and to set a root password. if it offers do not set it up to use windows authentication)
  • Open HeidiSQL (comes with mariadb) and connect it to the database
    • Click on new to create a new session, check prompt for credentials and leave the rest as default.
    • Click save, then click open and enter in root for the username and the password you setup during the installation.
  • Right click on the server entry in the left side plane (the area with information_schema, mysql, etc) (the server entry will be the first one) and go to create new -> database
    • You can name it anything at this step, tg13, tgstation13, ss13.
      • (Don't name it 'test' unless you like security issues)
  • Select the database you just created and then go to file -> load sql file and Open the file tgstation_schema.sql file in the SQL directory of the game. You can also find it here, but it may be newer than the version you are using.
  • Press the blue play icon in the topic bar of icon hieroglyphs and pray. If the schema imported correctly you should have no errors in the message box on the bottom.
  • Create a new user account for the server by going to tools -> user manager
    • hostname should be 127.0.0.1, not localhost if hosted locally, other wise use the ip of the game server.
    • For permissions, do not give it any global permissions, instead click add object, and then select the database you created for the server, hit ok, then give it select, update, insert, and delete permissions on that database.
    • You can click the arrow on the password field to get a randomly generated password of certain lengths, copy the password before saving as it will be cleared the moment you hit save.
  • Open the file: config/dbconfig.txt in notepad
  • Make sure to set it so that
    • SQL_ENABLED does not have a # in front of it
    • ADDRESS 127.0.0.1 (Replace with the database server's ip if not hosted locally)
    • PORT 3306
    • FEEDBACK_DATABASE tgs3 (replace with the database you created)
    • FEEDBACK_TABLEPREFIX (set this to nothing, since you're (I assume) using the default schema file we linked earlier)
    • FEEDBACK_LOGIN myuser (replace with the user you created)
    • FEEDBACK_PASSWORD mypass (replace with the user you created)
  • The database is now set up for death logging, population logging, polls (Tutorial), library, privacy poll, connection logging and player logging. There are two more features which you should consider. And it's best to do so now, since adopting them later can be a pain.

Still need help? Give this guide a try.

Database based banning

Offers temporary jobbans, admin bans, cross-server bans, keeps bans logged even after they've expired or were unbanned, and allows for the use of the off-server ban log.

To enable database based banning:

  • Open config/config.txt
  • Add a # in front of BAN_LEGACY_SYSTEM, so the line looks like "#BAN_LEGACY_SYSTEM"
  • Done. Note that any legacy bans are no longer enforced once this is done! So it's a good idea to do it when you're starting up.

Database based administration

Offers a changelog for changes done to admins, which increases accountability (adding/removing admins, adding/removing permissions, changing ranks); allows admins with +PERMISSIONS to edit other admins' permissions ingame, meaning they don't need remote desktop access to edit admins; Allows for custom ranks, with permissions not being tied to ranks, offering a better ability for the removal or addition of permissions to certain admins, if they need to be punished, or need extra permissions. Enabling this can be done any time, it's just a bit tedious the first time you do it, if you don't have direct access to the database.

To enable database based administration:

  • Open config/config.txt
  • Add a # in front of ADMIN_LEGACY_SYSTEM, so the line looks like "#ADMIN_LEGACY_SYSTEM"
  • Do the steps described in Adding your first admin.
  • Done. Note that anyone in admins.txt lost admin status, including you! So do the step above! You can repeat it for everyone, as it's a lot easier to do that and just correct permissions with the ingame panel called 'permissions panel'.
  • If your database ever dies, your server will revert to the old admin system, so it is a good idea to have admins.txt and admin_ranks.txt set up with some admins too, just so the loss of the database doesn't completely destroy everything.

If you need more help contact #coderbus.

For additional database-related tutorials, see Working with the database.


Hosting Hosting a serverSetting up the databaseWorking with /tg/station as an upstream repository
Contributing Guide to contributing to the gameSetting up gitDownloading the source codeReporting issuesChangelogs
Coding Understanding SS13 codeSS13 for experienced programmersCode docsCoding standardsGetting Your Pull AcceptedBinary flags‎Text FormattingMySQL
Mapping Guide to mappingMap mergerGuide to door access
Spriting Guide to spritingResolving icon conflicts
Wiki Guide to contributing to the wikiWikicodeAutowiki