Spring-Chobby / Chobby

Spring RTS Ingame lobby project
24 stars 63 forks source link

Supporting multiple games and servers properly #404

Closed gajop closed 7 years ago

gajop commented 7 years ago

Currently one needs to edit Chobby source files to specify the default game, protocol and server. This makes it difficult to distribute the lobby directly from the Github repository. The configuration should thus be provided by the wrapper, and Chobby should load this file.

Here is my proposal on how to achieve this kind of flexibility:

Specify a chobby_config.json file that sits outside of the Chobby archive, and has three things specified in it: 1) default protocol (ZKS or Uber) 2) default host and port 3) default game (with one possible option being generic

Then there are two options: a) On its first load, Chobby would read those values from the files and save it in the configuration for future use b) It would always read from that file and those things couldn't be configured using the lobby settings

I think option b) is much simpler, at least as far as the protocol is concerned (we may want to allow changing the game and host/port as it currently works).

Additionally, Chobby should run with isolated Spring, so settings of different Chobbys don't conflict with each other. Basically each game should have its own wrapper, including one for a generic/dev Chobby. Sharing settings between games is a bad thing and should be avoided.

TLDR: Make the wrapper create a chobby_config.json file (in the Spring directory) with the following values

{
  "protocol": "uber",
  "host": "springrts.com", 
  "port": 12345,
  "game": "generic"
}

or

{
  "protocol": "zk",
  "host": ""zero-k.info"", 
  "port": 12345,
  "game": "zk"
}

PS: Want feedback from @GoogleFrog , @Licho1 , @ashdnazg and others.

Licho1 commented 7 years ago

Wrapper already sends host and port in "WrapperOnline" command ..

gajop commented 7 years ago

@Licho1 I'd appreciate it if you could include a file as describe above (in a failed attempt to use Markdown in commits). Currently this commit shouldn't change any logic for ZK (so as not to complicate ongoing development), but eventually I plan to reset defaults to "generic" and "spring" so it will be necessary.

I may extend it further, for things such as wrapper host/port, but generally I'd like this file to be minimal.