Menu

Setting up a server

Skylar I

So, you want to test if this thing really allows custom servers and such? Well, this is the place to learn about it!

About the server system

The server is really quite simple. All it does is synchronize the clients. Pretty much, the client makes an HTTP request to a script with the data as arguments. The server writes the stuff to a file. Then other clients grab the file and read it.

How to do it

What you need

You will need a web server that can run PHP. You will also need access to the folder you will put the scripts. The web server will need read/write permission on the folder too. You will (obviously) need to be able to upload or otherwise create the needed files.

How to do it

  • Make a folder on the web server. It must be accessible from a web browser.

  • Create a file named gs.php with the following contents:

<?php
if(isset($_GET['name']))
{
file_put_contents($_GET['name'],$_GET['input']);
}
?>Done.

  • Create a file named chat.php with the following contents:

<?php
$chatlog = file_get_contents("chat" . $_GET['room'] . ".txt");
$numChar = strlen($str);
if ($numChar > 500) {
file_put_contents("chat" . $_GET['room'] . ".txt","SERVER: Chat log too long and was cleared.");
}
file_put_contents("chat" . $_GET['room'] . ".txt",file_get_contents("chat" . $_GET['room'] . ".txt") . "\r\n" . $_GET['msg']);
?>Done.

  • When the server is accessed, other files will be automatically generated if needed.
  • You're done! Simply add the web address to the folder you made to the game!

Related

Wiki: FAQ