Skip to main content

A homemade reproduction of the VintageStory Master Server as a Django app.

Project description

VintageStory MasterServer

A homemade reproduction of the VintageStory Master Server as a Django app, making the server list available to the rest of your project.

What is a "master server"? It's what allows the server browser to work. Essentially a catalogue that game servers register with so players can discover them.

Why? Besides haunting some individuals on the VS Discord server? Because I can. Personally, I use this to show a marker on my personal website for when my game server is online. The limit is merely your imagination.

Why not Python 3.xyz? More than likely this will work on your Python version, I've just not tested it. Please tell me if it works for you!

Installation

pip install vintagestory-masterserver

Add to your installed apps in project/settings.py:

INSTALLED_APPS = [
    ...,
    'vintagestory_masterserver',
]

Modify project/urls.py to add the urls:

urlpatterns = [
    ...,
    path("vsmaster/", include("vsmaster.urls"))
]

Obviously you can change "vsmaster/" to your preferred choice, but be aware this readme will use this in all examples.

Please remember to then run python manage.py makemigrations and migrate.

Usage

Verify it is working:

curl http://127.0.0.1:8000/vsmaster/list

example output:

{"status": "ok", "data": [{"serverName": "VintageStory Server", "serverIP": "127.0.0.1:42420", "playstyle": {"id": "surviveandbuild", "langCode": "surviveandbuild-bands"}, "Mods": [{"id": "game", "version": "1.20.3"}, {"id": "betterruins", "version": "0.4.6"}], "maxPlayers": 16, "gameVersion": "1.20.3", "hasPassword": true, "whitelisted": true, "gameDescription": "A Vintage Story Server"}]}

Get a list of all servers with heartbeats within the last 6 minutes:

 servers = VSServer.objects.filter(last_heartbeat__gte=timezone.now()-timezone.timedelta(minutes=6))

Modifying game server config

In serverconfig.json, modify the MasterserverUrl line to point to your base url.

e.g. "MasterserverUrl": "http://127.0.0.1:8000/vsmaster/".

The location of the config file will depend on your operating system and the particulars of your set up, but if you're reading this I sure hope you've figured that out already.

Modifying game client config

There is no in-game UI to change this so you'll need to locate your settings file.

On Windows, this defaults to %APPDATA%\VintageStoryData\clientsettings.json.

Change the masterserverUrl line to direct to your own root url, e.g.: "masterserverUrl": "http://127.0.0.1:8000/vsmaster/"

n.b. doing this will obviously prevent you from seeing the normal public server list in-game. You may still connect to any server for which you have the address. You can always change it back later.

Background

This API attempts to replicate everything I could observe the game server and client querying, and the sort of responses I could get from the official master server.

I should say I had some light assistance/encouragement from a couple of strange people in the official VintageStory Discord guild whilst figuring this out.

Contributing

While I've tried to imagine the sorts of odd situations that could cause errors and test/correct them to match the real server's behaviour, I will surely have missed something. If you find something behaving wrongly please do raise an issue or pull request!

Also, if you have any idea how to write proper tests, that would be grand.

Thank you.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vintagestory_masterserver-1.0.3.tar.gz (45.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vintagestory_masterserver-1.0.3-py3-none-any.whl (34.4 kB view details)

Uploaded Python 3

File details

Details for the file vintagestory_masterserver-1.0.3.tar.gz.

File metadata

File hashes

Hashes for vintagestory_masterserver-1.0.3.tar.gz
Algorithm Hash digest
SHA256 80998f85a18003773390a44e68ff630d5d055e34a17777180ba7568f9ba68752
MD5 0037e72682559dfcb43f67d39b907473
BLAKE2b-256 00648d621f66eb2799fa90c7691999af01d7b2937fb02b89264f36a8133c04e9

See more details on using hashes here.

File details

Details for the file vintagestory_masterserver-1.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for vintagestory_masterserver-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 cdc2bcc1ba1890726988dc98eff8b14c7c7ca287f44b5ec72d82eb764450937c
MD5 d3ca7ee901b7768a788687bc6851e05d
BLAKE2b-256 2e339a7b10a28fffda9396199bc08e131bd4023c356085d048812cda0c4147a4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page