Command line option to pause multiplayer games

Got an idea for OpenTTD? Post it here!

Moderator: OpenTTD Developers

Post Reply
weepup
Engineer
Engineer
Posts: 2
Joined: 21 Jan 2024 03:58

Command line option to pause multiplayer games

Post by weepup »

After searching the forums, I didn't see this request or any suitable automated alternative (apologies if I have missed it)

I'd like to make a request to be able to pause multiplayer games from the command line. Having said that if anyone has any other alternative, feel free to suggest.

Scenario: I have my kids playing openttd but want to enforce time limits so they actually go to bed.

Suggestion: I was thinking that a quick switch to the openttd command line like openttd -pause (-p is taken, so hence pause) and call this via a cronjob/scheduled task to start/stop the multiplayer game eg: start at 4pm, stop at 6pm.

Alternatives: The one player option is not ideal as one kid can still play past their dinner/bed/etc time. I manually pause using the console but that requires me to actually go and pause the game while having to stop other things cooking, cleaning,.. etc...

Thank you community and devs for this game
Eddi
Tycoon
Tycoon
Posts: 8272
Joined: 17 Jan 2007 00:14

Re: Command line option to pause multiplayer games

Post by Eddi »

there's three ways to pause the game: the builtin console, the admin port. and a game script.
User avatar
jfs
Tycoon
Tycoon
Posts: 1763
Joined: 08 Jan 2003 23:09
Location: Denmark

Re: Command line option to pause multiplayer games

Post by jfs »

If you want to pause the game on a timer, based on real-world time, then an admin port client that sends a pause command would probably be the most appropriate.

Piping a command into the game console automatically seems like too much a hack and potentially unreliable, unless you want to type the command yourself.
Using a Game Script is probably not doable, if you want it to be based on real world time, since I don't think it has access to the computer's clock.
User avatar
Emperor Jake
Tycoon
Tycoon
Posts: 3427
Joined: 24 Apr 2007 09:37
Skype: Discord: Emperor Jake #4106
Location: Not Actually Japan
Contact:

Re: Command line option to pause multiplayer games

Post by Emperor Jake »

In JGRPP there is a settings_access command that lets multiplayer clients use the pause button, as well as change settings and use cheats.
weepup
Engineer
Engineer
Posts: 2
Joined: 21 Jan 2024 03:58

Re: Command line option to pause multiplayer games

Post by weepup »

Thanks all for the replies.

JFS' solution for the admin port (and considering the other pros/cons) looks like the best solution at the moment.

I don't want the kids to control the game, hence anything client side is not suitable. So a script connecting to the admin port on the server would be the best option here.

For reference, I'm looking at the python and php options at the moment and looks simple enough to implement (cronjob to run some py or php):
https://wiki.openttd.org/en/Development ... min%20port
https://github.com/Xaroth/libottdadmin2
https://github.com/toomeenoo/php-opentt ... xample.php
Last edited by weepup on 24 Jan 2024 01:27, edited 3 times in total.
_dp_
Transport Coordinator
Transport Coordinator
Posts: 278
Joined: 18 Dec 2013 12:32

Re: Command line option to pause multiplayer games

Post by _dp_ »

There is also a highly minimalistic admin port client in grf-py that does exactly what you need (sending a single command). https://github.com/citymania-org/grf-py ... py#L18-L59
weepup
Engineer
Engineer
Posts: 2
Joined: 21 Jan 2024 03:58

Re: Command line option to pause multiplayer games

Post by weepup »

Thanks _dp_, yes, that's pretty close, I could create a small function like reload_newgrfs specifically for pausing.
Post Reply

Return to “OpenTTD Suggestions”

Who is online

Users browsing this forum: Google Adsense [Bot] and 24 guests