Navigation Menu

Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Protocol handler to join network games #7735

Closed
nielsmh opened this issue Sep 11, 2019 · 4 comments
Closed

Protocol handler to join network games #7735

nielsmh opened this issue Sep 11, 2019 · 4 comments
Labels
component: interface This is an interface issue enhancement Issue would be a good enhancement; we accept Pull Requests! good first issue Good for newcomers

Comments

@nielsmh
Copy link
Contributor

nielsmh commented Sep 11, 2019

It could be some good UI to support a protocol handler to join network games.
A protocol handler could allow players to make links to a server directly from a website or social service and have players join through that. It would also make the browser at http://servers.openttd.org/ more accessible.

URI scheme

Example of what an OpenTTD server link could look like:
openttd://127.0.0.1:3981?version=1.9.3&password=asdf&join=4&companypassword=qwerty

Suggested parts:

  • openttd: because a scheme name is required
  • // because everyone else does it
  • 127.0.0.1:3981 IP address (or hostname) and port
  • ? make a HTTP-like query string
  • version=1.9.3 could in the future allow having a meta-handler that selects between multiple installed versions of the game for the required one
  • password= server password, leave out if not required (prompt user if server needs one or the provided is wrong)
  • join= join a company (leave out to spectate)
  • join=new create a new company on connect, if possible
  • companypassword= password to join company, or to set on the new company created (spectate if provided password is wrong)

Implementation

Every OS has its own way of registering URI handlers, the installers/packaging would have to handle that.

The implementation in game would be a commandline parameter such as -U <uri>. The game should perhaps ask the player for confirmation before beginning to connect, so they don't accidentally connect to random servers.

@nielsmh nielsmh added good first issue Good for newcomers component: interface This is an interface issue enhancement Issue would be a good enhancement; we accept Pull Requests! labels Sep 11, 2019
@sdcloudt
Copy link
Contributor

Working on it.

@sdcloudt sdcloudt mentioned this issue Oct 22, 2019
@JMcKiern
Copy link
Contributor

JMcKiern commented Jan 27, 2020

I was looking into this over the weekend. I have a working parser but I couldn't figure out how to call NetworkClientConnectGame() at the right time. I tried calling it before VideoDriver::GetInstance()->MainLoop() to see what would happen but it didn't seem to work. Maybe there is some network initialization that needs to be performed beforehand?

Presumably, the main menu needs to load first and then this function needs to be called.
Any ideas on how to "queue" this join game command?

Is there perhaps a function similar to ShowQuery() that would allow passing of the game server info to the callback function?

@nielsmh
Copy link
Contributor Author

nielsmh commented Jan 27, 2020

Have you looked at how the "traditional" command line parameters for joining a network game from the command line are handled in openttd_main() in openttd.cpp?

@JMcKiern
Copy link
Contributor

Oh yeah, it's the AfterNewGRFScan variable, right? Don't know why I didn't look into that... I'll give it another go when I get some time

JMcKiern added a commit to JMcKiern/OpenTTD that referenced this issue Feb 6, 2020
JMcKiern added a commit to JMcKiern/OpenTTD that referenced this issue Feb 6, 2020
JMcKiern added a commit to JMcKiern/OpenTTD that referenced this issue Feb 6, 2020
JMcKiern added a commit to JMcKiern/OpenTTD that referenced this issue Feb 6, 2020
JMcKiern added a commit to JMcKiern/OpenTTD that referenced this issue Mar 29, 2020
@TrueBrain TrueBrain removed the pinned label Jan 3, 2021
@OpenTTD OpenTTD locked and limited conversation to collaborators Jan 9, 2024
@2TallTyler 2TallTyler converted this issue into discussion #11741 Jan 9, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
component: interface This is an interface issue enhancement Issue would be a good enhancement; we accept Pull Requests! good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

4 participants