Steam Workshop

Forum for alternative clients, mods & discussions on the same.

Steam Workshop

Postby loftar » Mon Sep 30, 2024 4:43 pm

I'm writing this post to document how to upload custom clients to the Steam Workshop. Right now before the release, you will need to request a Beta key from me to be able to access the game and its workshop, but as soon as the game is launched, this will be open to anyone without any sort of prior approval.

Introduction
To begin with, in Steam terminology, an uploaded client is a "Workshop item", and on a technical level, a Workshop item is basically just a directory of files along with some metadata (like name, description and such). It works such that items are uploaded to the Workshop along with their metadata, where users can "subscribe" to them, at which point the Steam client will download the associated directory and whatever files it contains and make them available to the game.

Haven implements this by having the default client check for subscribed items at launch, before the primary main function is invoked, and if there are subscribed items, it will present the user with a dialog to choose which one to launch (this is the haven.WorkshopLauncher class). In order to know how to launch said client, the uploader needs to provide a file named workshop-client.properties in the item's root directory. This file is in Java's standard property format, and currently there are two separate ways to launch a client, each with its own pros and cons. More details further down.

Uploading
For uploading clients, Steam has no tools on its own, and instead relies on individual games to implement their own upload interfaces. Since Haven's custom client uploading is primarily aimed at programmers, Haven implements this with a command-line tool, in the haven.SteamWorkshop class. The idea is that you prepare your item directory, which needs to contain at least the workshop-client.properties file, and invoke the main function on this class to upload it. Said main function is prepared to support different subcommands, but right now, there is only one, "upload". You would call it as such:
Code: Select all
java -cp build/hafen.jar haven.SteamWorkshop upload /path/to/my/item

The command supports standard POSIX option syntax, and the -h option (ie. haven.SteamWorkshop upload -h) will provide the ordinary usage message as a shorthand. It also supports a -q option to silence the progress messages it will otherwise output by default (which might be useful for automated build-and-upload scripts or such). Additionally, Steam allows for something similar to a "commit message" to be specified with an upload, which can be given as an optional extra argument after the path to the item directory, should you find this feature useful.

As for metadata, the upload tool reuses the workshop-client.properties file to specify it. There are four properties that are required for a steam upload:
  • name: The name of the client as presented to the user.
  • description: The description of the client as presented to the user.
  • preview-image: An image presented as the icon to the user. Must be the name of an image file relative to the item's root directory. I realize a "preview image" might not make a whole lot of sense for a custom client, but Steam requires it, so it is what it is.
  • visibility: A Workshop item can be set to different levels of visibility, as per so:
    • private: The client can only be seen by its creator.
    • friends: The client can only be seen by its creator and those on his/her friend list.
    • public: The client can be seen by anyone.
In addition to those, by default, the upload tool will create a new Steam item whenever it is run. When it does so, it will print the Item ID that Steam gives it, and you can enter this into the properties file in order to update the item on future calls instead of creating new items. The upload tool reads it from the workshop-id property.

Launching
As mentioned, when a user chooses a custom client to launch, the workshop-client.properties file is consulted on how to actually launch said client. Currently, the WorkshopLauncher supports two methods of launching, as follows.

"Direct" launching
By specifying the main-class and class-path properties, the Workshop launcher will load the specified classpath into the currently running JVM and run the public static void main(String[]) function of that class (with an empty argument array). As such, it starts rather quickly, but it otherwise inherits the JVM settings (classpath, system properties, heap size, &c) of the main client. Besides inheriting sysprops, sysprops can also be added and/or modified by setting sysprop.NAME=VALUE properties; for example sysprop.haven.errorurl=http://your-error-reporter.com/. Multiple Jar files can be specified in the class-path by specifying a colon-separated list, where each filename is relative to the item's root directory. Taken together a workshop-client.properties file for direct launching might look as such:
Code: Select all
name=My Client
description=Some of features, I guess?
preview-image=icon.png
visibility=public
workshop-id=XXX

main-class=haven.MainFrame
class-path=my-hafen.jar:my-resources.jar
sysprop.haven.errorurl=stderr


Chained launching
By specifying the launcher property, the normal Haven launcher will be started with that launcher file, which will load your client however you see fit. The advantages are mainly that it allows you to specify JVM parameters freely and that it allows you to reuse your existing setup in case you're already using the Haven launcher, but given that it launches a new JVM, it increases startup time. It can be used as such:
Code: Select all
name=My Client
description=Some of features, I guess?
preview-image=icon.png
visibility=public
workshop-id=XXX

launcher=launcher.hl

Where in turn, the launcher.hl file (also resolved relative to the item's root directory) might contain the follow to find your main launcher file if you host it on your own site:
Code: Select all
validate always
title "Haven & Hearth"
icon "https://game.havenandhearth.com/java/icon.gif"
splash-image "https://game.havenandhearth.com/java/splash.gif"

validate tls-cert:key:rsa:99118FA7C13D9686021FFDB74F8FFE77CA5EB7D356A8D31BB907A31AFAE04D46
include https://game.havenandhearth.com/java/hafen.hl

Or something like that.

Miscellaneous
In order to make uploaded items visible in the workshop, Steam requires you to agree to the Workshop Legal Agreement, which is available to agree to in the Workshop tab in your Steam client. The upload tool will warn you if you haven't agreed.

If you don't like the above launching schemes, I'm open to adding others, as long as it's reasonable. Tell me what you'd like, and I'll consider adding it.

The JVM is the same one that ships with the default client, which is currently Java 21. Might be upgraded in the future if there's something interesting about newer Java releases.

As for malware in clients, obviously, just like any other custom client, a client can do anything any other program can do. My understanding is that it is common for other games as well to work like this in the Steam Workshop, so while it feels a bit weird, if it works for other games, I guess it works for Haven. I guess Steam simply relies on the Workshop Legal Agreement to police abuse?
"Object-oriented design is the roman numerals of computing." -- Rob Pike
User avatar
loftar
 
Posts: 9045
Joined: Fri Apr 03, 2009 7:05 am

Re: Steam Workshop

Postby 송태권 » Mon Sep 30, 2024 5:01 pm

Cool. It doesn't look that complicated.
But how can i make custom client to login steam server?
Will you post a git for steam client?
송태권
 
Posts: 9
Joined: Thu Jun 16, 2016 1:47 pm

Re: Steam Workshop

Postby loftar » Mon Sep 30, 2024 5:14 pm

송태권 wrote:Will you post a git for steam client?

Yes, I will as soon as I get the keys.
"Object-oriented design is the roman numerals of computing." -- Rob Pike
User avatar
loftar
 
Posts: 9045
Joined: Fri Apr 03, 2009 7:05 am

Re: Steam Workshop

Postby strpk0 » Mon Sep 30, 2024 5:17 pm

This overall sounds reasonable, thanks

Couple of questions:

1. What does the client "get" when you launch it, that allows it to authenticate to the server? Is it some sort of authentication token that is passed in through the command line arguments?
2. Going off the first question, are there any plans to:
a. Support logging in without the steam launcher being involved
b. If a) is possible, support logging into multiple steam accounts on the same computer (without resorting to hacky workarounds like VMs and whatnot)
Granger wrote:Fuck off, please go grow yourself some decency.

Image
User avatar
strpk0
 
Posts: 1188
Joined: Sat Sep 03, 2011 11:44 pm

Re: Steam Workshop

Postby Katodiy » Mon Sep 30, 2024 5:19 pm

Will there be a beta server running for testing before release?
User avatar
Katodiy
 
Posts: 16
Joined: Sun Apr 04, 2021 11:41 pm

Re: Steam Workshop

Postby Pills » Mon Sep 30, 2024 6:31 pm

loftar wrote:
송태권 wrote:Will you post a git for steam client?

Yes, I will as soon as I get the keys.


Do we need keys to start working with it and see what wrapper you've used for SteamSDK? Does it actually have a full separate client?
jorb wrote:I dub you Sir Pills of the Mighty Spruce.
Thank you for your service. :pray:
User avatar
Pills
 
Posts: 641
Joined: Thu Apr 04, 2019 1:21 am

Re: Steam Workshop

Postby derkami » Mon Sep 30, 2024 6:44 pm

Pin please.
Can't wait.

Also testserver would be nice, to verify functionality.
Image
Image
Image
User avatar
derkami
 
Posts: 145
Joined: Thu Jun 02, 2016 11:28 pm

Re: Steam Workshop

Postby loftar » Mon Sep 30, 2024 6:45 pm

Katodiy wrote:Will there be a beta server running for testing before release?

The client will connect to W15 for the time being, quite simply.

strpk0 wrote:1. What does the client "get" when you launch it, that allows it to authenticate to the server? Is it some sort of authentication token that is passed in through the command line arguments?

The authentication ticket is acquired via the Steam SDK library, which in turn obtains it by talking to the Steam client. I believe that also answers your other questions, right?

Pills wrote:Do we need keys to start working with it and see what wrapper you've used for SteamSDK?

To be fair, it's not so much that I needed to wait for the keys, but just that I wanted some time to check the diff and see so that there wasn't anything wrong with it, but I've done so now and pushed it.

Pills wrote:Does it actually have a full separate client?

It's all on the master branch, so no, it's not a separate client. The use of Steam features is enabled by way of sysprops (haven.authmech and haven.steamsvc) for the default client. Basically, the default client on Steam will just use an alternate launcher file.
"Object-oriented design is the roman numerals of computing." -- Rob Pike
User avatar
loftar
 
Posts: 9045
Joined: Fri Apr 03, 2009 7:05 am

Re: Steam Workshop

Postby APXEOLOG » Mon Sep 30, 2024 6:51 pm

Thanks for the information. Does the chained launch allow to use another JVM version? We're currently running on GraalVM for JS support.
W10 Meme Plot | W9 Mantis Garden | W8 Core | W7 Ofir | W6 the City of Dis | W5 Vitterstad | W4 A.D. | W3 Mirniy
jorb wrote:All your characters will be deleted, and I will level every village any one of them were ever members of.
User avatar
APXEOLOG
 
Posts: 1296
Joined: Fri Apr 23, 2010 7:58 am
Location: Somewhere on Earth

Re: Steam Workshop

Postby loftar » Mon Sep 30, 2024 6:57 pm

APXEOLOG wrote:Thanks for the information. Does the chained launch allow to use another JVM version? We're currently running on GraalVM for JS support.

I see. The launcher currently doesn't support separate JVMs natively, but it does support extensions, so in theory you could add support for that rather easily.

Let me consider if I want to add support for different JVMs natively to it. It makes some sense, but I also want to keep the size of the non-extended launcher down as small as possible, so I've been trying to be careful about adding built-in features frivolously.
"Object-oriented design is the roman numerals of computing." -- Rob Pike
User avatar
loftar
 
Posts: 9045
Joined: Fri Apr 03, 2009 7:05 am

Next

Return to The Wizards' Tower

Who is online

Users browsing this forum: No registered users and 37 guests