Blockland Forums > General Discussion

Tutorial - How to make a Dedicated Server (Batch File)

Pages: << < (8/9) > >>

deathrider:


--- Quote from: otto-san on March 29, 2012, 10:18:44 PM ---just a note

Program Files (x86) will only exist if you have a 64-bit computer or if you made it yourself.


EDIT:
you could also have a batch file like this to allow you to choose map when starting the server with a small modification


--- Code: ---@echo off
SET /p map="Type in a map name:    "
C:\Program Files (x86)\Blockland\BlocklandLauncher.exe -dedicated -map %map%
--- End code ---

--- End quote ---
forget you stole my post was going to say that

joe411:

This dosn't work for me, when I do it the box imeditly closes.

K3k0m@n:


--- Quote from: Ipquarx on April 02, 2012, 10:29:05 PM ---do you people not realize that you get this exact same file by clicking a damn checkbox? The "how to make a dedicated server" question has been answered an uncountable number of times.

--- End quote ---
when i re-installed blockland to get v20, it came up with the checkbox. i checked both lan and internet dedicated checkboxes and installed.
then when i re-started my computer the files dissapeared the next time i started up my computer.
however, the normal blockland shortcut was still there.
so i had to do

--- Quote from: Nexus on March 30, 2012, 06:00:56 PM ---make a shortcut with the following target:
"C:\Program Files (x86)\Blockland\BlocklandLauncher.exe" -dedicated -map SPAAAAAAACE

--- End quote ---


Port:

When I want to set up a new dedicated server, I create a folder for it, paste key.dat into it and add the following file:
update.py

--- Code: ---import sys, subprocess, urllib2, os, hashlib

def update(manifestPath):
print "Downloading manifest...",
try:
                manifestRequest = urllib2.Request(manifestPath, headers={"User-Agent": "blocklandWIN/2.0"})
                manifestFile = urllib2.urlopen(manifestRequest)
                manifest = manifestFile.readlines(False)
        except IOError:
                print "ERROR"
                return
        except _socket.error:
                print "ERROR"
                return
print "DONE"

print "Processing manifest...",
downloadPath = manifest[0].split("\t")[1].strip()
files = {}
open("ignored.txt", "a")
ignoredFiles = open("ignored.txt").readlines(False)
ignoredFiles2 = []
for item in ignoredFiles:
                ignoredFiles2.append(item.strip())
        ignoredFiles = ignoredFiles2
        del ignoredFiles2
for i in manifest[1:]:
i = i.strip()[1:].split("\t")
digest = ""
if os.path.exists(i[0]):
digest = hashlib.sha1()
digest.update(open(i[0], "rb").read())
digest = digest.hexdigest()
if i[0] not in ignoredFiles and digest.lower() != i[1].lower():
files[i[0]] = i[1]
print "DONE"

downloadedFiles = 0
for i in files:
downloadedFiles += 1
print "Downloading " + i + " (file " + str(downloadedFiles)  + "/" + str(len(files)) + ")...",
download = urllib2.urlopen(downloadPath + "/" + files[i])
folders = i.split("/")[:-1]
for j in range(len(folders)):
path = "/".join(folders[:j + 1])
if not os.path.exists(path):
os.mkdir(path)
open(i, "wb").write(download.read())
print "DONE"

update("http://update.blockland.us/latestVersion.php")

if '-updateOnly' not in sys.argv:
        process = subprocess.Popen(["Blockland.exe", "ptlaaxobimwroe"] + sys.argv[1:])

--- End code ---

I create a shortcut to it named launch with these arguments: -dedicated -map whatever
I create a shortcut to it named update with these arguments: -updateOnly

Then, I run the 'update' shortcut, wait for it to download all the files, run the 'launch' shortcut, wait for the server to start fully and type quit();.

Then, I edit files in config/server to change things such as enabled add-ons, quotas, port, server name, max players, etc.
When I want to start the server, I simply run the 'launch' shortcut.

This method is rather advanced and requires Python 2.7, but it allows for running dedicated servers on computers with such low graphics hardware that they cannot display the launcher. This runs more than five times faster than the normal launcher in any case, and allows you to add file paths to the 'ignored.txt' file to easily use custom content.

adam savage:

Make it for mac?

Pages: << < (8/9) > >>

Go to full version