The International Simutrans Forum

 

Author Topic: Network play - server info window on connect  (Read 2622 times)

0 Members and 1 Guest are viewing this topic.

Offline Ashley

  • Coder/Patcher
  • Devotee
  • *
  • Posts: 1288
    • entropy.me.uk
Network play - server info window on connect
« on: November 18, 2012, 11:32:04 PM »
This is actually something I'm considering implementing since it probably wouldn't be too hard (I don't have a lot of time though). I think it'd be useful to have a server info window which is automatically shown when a client connects to a game server (and which can be opened via the GUI/hotkey). This can show arbitrary text (preferably formatted text, like that of the help dialogs). The text comes from a file which is loaded by the server (so it isn't map-dependent, rather server-dependent).

I currently place signs in-game to provide basic info about the game, but this is somewhat laborious to do when creating new maps and is very limited in the information which can be written without covering the landscape with signs...

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 9565
  • Languages: De,EN,JP
Re: Network play - server info window on connect
« Reply #1 on: November 19, 2012, 01:44:49 PM »
The is certainly not too hard. It could be even a customable greeting message (instead of welcome to simutrans) shown every time you log on. If the text is not too long, you can use even the message faciliy for that. Unfourtunately anything most likely require a change of the game state, i.e. will be only available for the next version.

Offline paichtis

  • *
  • Posts: 63
Re: Network play - server info window on connect
« Reply #2 on: November 19, 2012, 05:12:01 PM »
Yes this would  be a nice addition to the game

Offline Ashley

  • Coder/Patcher
  • Devotee
  • *
  • Posts: 1288
    • entropy.me.uk
Re: Network play - server info window on connect
« Reply #3 on: November 27, 2012, 04:29:36 PM »
I'd like it to be a substantial window with formatting - like the in-game help windows. Reason being that there may be quite a bit of information for new players (too much for a small info window or scrolling line of text).

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4601
  • Languages: EN, DE, AT
Re: Network play - server info window on connect
« Reply #4 on: November 27, 2012, 08:00:06 PM »
The easiest way would be to put this in some fake scenario script, which is run at the server exclusively. Then open the scenario window after reloading the game to show the server info. (Opening the scenario window not yet implemented). Would that be an option?

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 9565
  • Languages: De,EN,JP
Re: Network play - server info window on connect
« Reply #5 on: November 28, 2012, 02:38:57 PM »
I would rather make the string part of simword. Making it a flowtext (i.e. simutrans HTML), It can be only set on the server with a commandline or simuconf.tab setting or maybe even by a special tool. If present, will show on all games after loading. That way also normal games can come with a greeting/explanation.

Offline Ashley

  • Coder/Patcher
  • Devotee
  • *
  • Posts: 1288
    • entropy.me.uk
Re: Network play - server info window on connect
« Reply #6 on: November 28, 2012, 04:19:32 PM »
Prissi's description is pretty much exactly what I was thinking.


Edit: This was pretty easy to implement. Just need to get a build set up so I can actually test it out...
« Last Edit: December 04, 2012, 12:32:31 AM by Timothy »

Offline Ashley

  • Coder/Patcher
  • Devotee
  • *
  • Posts: 1288
    • entropy.me.uk
Re: Network play - server info window on connect
« Reply #7 on: December 05, 2012, 11:21:53 AM »
Here's what I have so far, it's finished except for some cosmetic issues (which I hope someone can help me with - I am not so good at the GUI stuff).

Adds a new config entry to simuconf: server_info_file (defaults to server_info.txt) which lets you set the HTML file which will be read.

When a client connects the server sends the newly joined client a message which opens the info window on the client with the data required.

Only outstanding issue is that the scrollbar in the window doesn't work - and I can't figure out how to fix it.

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4601
  • Languages: EN, DE, AT
Re: Network play - server info window on connect
« Reply #8 on: December 05, 2012, 12:37:01 PM »
Why do you not use the help_frame_t class? It should have everything you need imho. Create the help_frame_t instance, then call set_text(...) with the text from the server.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 9565
  • Languages: De,EN,JP
Re: Network play - server info window on connect
« Reply #9 on: December 05, 2012, 02:22:02 PM »
I would also reuse the help window classes. I would also prefer to have the text saved with the game. That way also non network games (like for certain scenarios) would see this message on start.

Offline Ashley

  • Coder/Patcher
  • Devotee
  • *
  • Posts: 1288
    • entropy.me.uk
Re: Network play - server info window on connect
« Reply #10 on: December 05, 2012, 04:30:43 PM »
I can change it to use the help window class, but I don't think I have time to try and work out how to integrate it into savegames. I had intended for this to be a per-server setting to avoid having to modify the save game itself to add text to it as I do at the moment with signs.


Edit: Ok, here's a patch using the help frame instead.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 9565
  • Languages: De,EN,JP
Re: Network play - server info window on connect
« Reply #11 on: December 05, 2012, 09:20:57 PM »
Ok, I can see the use to send such windows also during later in the game. Lets leave it with the network command.

I would just suggest to read the file each time when it will be transferred to allow for updates to be put into it. I will modify the patch.

Offline Ashley

  • Coder/Patcher
  • Devotee
  • *
  • Posts: 1288
    • entropy.me.uk
Re: Network play - server info window on connect
« Reply #12 on: December 05, 2012, 10:00:47 PM »
Sounds good, thankyou :)

Offline Ashley

  • Coder/Patcher
  • Devotee
  • *
  • Posts: 1288
    • entropy.me.uk
Re: Network play - server info window on connect
« Reply #13 on: December 28, 2012, 02:06:02 PM »
This didn't make it into 112.1 right?

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4601
  • Languages: EN, DE, AT
Re: Network play - server info window on connect
« Reply #14 on: December 28, 2012, 02:23:29 PM »
Unfortunately not.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 9565
  • Languages: De,EN,JP
Re: Network play - server info window on connect
« Reply #15 on: December 28, 2012, 09:30:33 PM »
I though this was comitted? Well then lets make a 122.1.1 soon.