The International Simutrans Forum

 

Author Topic: -pause flag with -server  (Read 346 times)

0 Members and 1 Guest are viewing this topic.

Offline Freahk

  • Devotee
  • *
  • Posts: 1311
  • Languages: DE, EN
-pause flag with -server
« on: April 16, 2020, 12:28:09 AM »
I was about to start a paused server to prepare a new map. using the commandline
./simutrans-extended -server -objects Pak128.Britain-Ex/ -server_admin_pw "that's not the pw ;)" -load Vienna-Krakow-Budapest.sve -pause
It seems the -pause flag is simply ignored.

Offline ceeac

  • Devotee
  • *
  • Posts: 201
Re: -pause flag with -server
« Reply #1 on: April 16, 2020, 06:10:03 AM »
simmain.cc line 1440 (this is for Standard, but Extended is unchanged):
Code: [Select]
if(  !env_t::networkmode  &&  !env_t::server  ) {
welt->set_pause( pause_after_load );
pause_after_load = false;
}
It seems that it is disabled on purpose. For clients connecting to a server this is reasonable to prevent immediate desyncs, but I cannot think of a reason on the spot to disable pause on load for servers, too.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 10228
  • Languages: De,EN,JP
Re: -pause flag with -server
« Reply #2 on: April 16, 2020, 03:01:17 PM »
The server cannot "pause" but without clients it will immediately autopause. That is set with simuconf.tab, not the commandline. Because the GUI pause mode is different from the network pause mode. (For the same reason networking clients cannot pause.)

Offline Freahk

  • Devotee
  • *
  • Posts: 1311
  • Languages: DE, EN
Re: -pause flag with -server
« Reply #3 on: April 16, 2020, 03:12:59 PM »
I am aware of the pause_server_no_clients setting but that's not what I want to achieve here as it will only pause the game when nobody is connected.
Without being connected to the server one obviously cannot modify the map, so we can't prepare Vienna-Budapest-Krakow map as a team.

I see the point in not allowing pause/unpause being triggered by players in network mode but why can't the server stay paused after a player has connected when started with -pause?
Optimally, nettool or any connected player with access to the public player should be able to pause/unpause the server but that might be technically more difficult.
« Last Edit: April 16, 2020, 03:49:30 PM by Freahk »

Offline TurfIt

  • Dev Team, Coder/patcher
  • Devotee
  • *
  • Posts: 1394
Re: -pause flag with -server
« Reply #4 on: April 16, 2020, 04:51:53 PM »
As prissi stated, the server cannot pause. There is no provision in the networking code to allow commands to be processed without time progressing. When a client performs an action, it sends a request to the server. The server marks a time in the future to execute the action, and broadcasts that to all connected clients. Once that time is reached, all clients (and the server) actually perform the action. Without time passing, the future action time will not be reached. Such a feature could be added, but there's really been no call for it...

For jointly preparing a map, you could set the map's starting year before the intended actual start year; And/Or set a high bits_per_month and just let time progress while preparing. Loading the game in singleplayer mode you can then run/fastforward/skip time until the desired start.