Make gameplay settings available to the player.

Discuss the new AI features ("NoAI") introduced into OpenTTD 0.7, allowing you to implement custom AIs, and the new Game Scripts available in OpenTTD 1.2 and higher.

Moderator: OpenTTD Developers

Post Reply
agentw4b
Traffic Manager
Traffic Manager
Posts: 216
Joined: 14 Apr 2017 15:51
Location: Czech Republic

Make gameplay settings available to the player.

Post by agentw4b »

If the variables with CONFIG_INGAME are defined in the info.nut gamescript file, these parameters can be changed by the player in the running game. This works in a single player game, but in a multiplayer game, the player does not have the option to click on the gameplay settings to change some of the values. Is there a possibility to make the relevant "Game Script Parameters" window available for some players to change?

I tried to call the window through the GSWindow class, but there are only window checking or window closing functions but there are no window opening functions.
Owner and admin of servers with names "Experimental games" .
My heightmaps: Flat Earth Map and United nations logo
My scenarios: Game Fallout 1,2,3 Map scenario
My gamescripts: City Founder GS
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: Make gameplay settings available to the player.

Post by Alberth »

There are OpenFooWindow ShowFooWindow functions to open a window.
It won't do much good though, as there is no script running at a non-server machine in an MP game.
Being a retired OpenTTD developer does not mean I know what I am doing.
agentw4b
Traffic Manager
Traffic Manager
Posts: 216
Joined: 14 Apr 2017 15:51
Location: Czech Republic

Re: Make gameplay settings available to the player.

Post by agentw4b »

Alberth wrote:There are OpenFooWindow ShowFooWindow functions to open a window.
It won't do much good though, as there is no script running at a non-server machine in an MP game.
Yes, and that's a problem. The user, even though he has the right to change the settings script, can not change it in multiplayer settings. If there were at least some windows where it could be changed. The Goal window is not very appropriate.
Owner and admin of servers with names "Experimental games" .
My heightmaps: Flat Earth Map and United nations logo
My scenarios: Game Fallout 1,2,3 Map scenario
My gamescripts: City Founder GS
agentw4b
Traffic Manager
Traffic Manager
Posts: 216
Joined: 14 Apr 2017 15:51
Location: Czech Republic

Re: Make gameplay settings available to the player.

Post by agentw4b »

agentw4b wrote:
Alberth wrote:There are OpenFooWindow ShowFooWindow functions to open a window.
It won't do much good though, as there is no script running at a non-server machine in an MP game.
Yes, and that's a problem. The user, even though he has the right to change the settings script, can not change it in multiplayer settings. If there were at least some windows where it could be changed. The Goal window is not very appropriate.
ShowFooWindow functions is not on https://nogo.openttd.org/api/1.7.2/
Owner and admin of servers with names "Experimental games" .
My heightmaps: Flat Earth Map and United nations logo
My scenarios: Game Fallout 1,2,3 Map scenario
My gamescripts: City Founder GS
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: Make gameplay settings available to the player.

Post by Zuu »

You can ask yes/no questions to companies using GSGoal::Question It is possible to customize the buttons with up to 3 buttons from a set of available button types.

If you do not need input, you can display longer texts and call up the story book to all players in a company using GSStoryPage::ShowPage. This can be used to explain non-standard interface like placing a sign with some special code to send a message to the script.

A third option is to have a webserver that talks with a GameScript in OpenTTD via the admin port.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
agentw4b
Traffic Manager
Traffic Manager
Posts: 216
Joined: 14 Apr 2017 15:51
Location: Czech Republic

Re: Make gameplay settings available to the player.

Post by agentw4b »

I've read a lot about the Admin port, but there are very few tools for it and they are mostly not well documented.
Owner and admin of servers with names "Experimental games" .
My heightmaps: Flat Earth Map and United nations logo
My scenarios: Game Fallout 1,2,3 Map scenario
My gamescripts: City Founder GS
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: Make gameplay settings available to the player.

Post by Zuu »

Using the admin port is probably the most complex solution, but it depends on your set of skills.

There are docs for the actual admin port protocol:
http://svn.openttd.org/trunk/docs/admin_network.txt

But if you can do with GSGoal::Question or sign based input, that is probably significantly less work than going via admin port and a web interface.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 5 guests