News:

Want to praise Simutrans?
Your feedback is important for us ;D.

Network play - server info window on connect

Started by Ashley, November 18, 2012, 11:32:04 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Ashley

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...
Use Firefox? Interested in IPv6? Try SixOrNot the IPv6 status indicator for Firefox.
Why not try playing Simutrans online? See the Game Servers board for details.

prissi

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.

paichtis

Yes this would  be a nice addition to the game

Ashley

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).
Use Firefox? Interested in IPv6? Try SixOrNot the IPv6 status indicator for Firefox.
Why not try playing Simutrans online? See the Game Servers board for details.

Dwachs

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?
Parsley, sage, rosemary, and maggikraut.

prissi

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.

Ashley

#6
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...
Use Firefox? Interested in IPv6? Try SixOrNot the IPv6 status indicator for Firefox.
Why not try playing Simutrans online? See the Game Servers board for details.

Ashley

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.
Use Firefox? Interested in IPv6? Try SixOrNot the IPv6 status indicator for Firefox.
Why not try playing Simutrans online? See the Game Servers board for details.

Dwachs

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.
Parsley, sage, rosemary, and maggikraut.

prissi

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.

Ashley

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.
Use Firefox? Interested in IPv6? Try SixOrNot the IPv6 status indicator for Firefox.
Why not try playing Simutrans online? See the Game Servers board for details.

prissi

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.

Ashley

Use Firefox? Interested in IPv6? Try SixOrNot the IPv6 status indicator for Firefox.
Why not try playing Simutrans online? See the Game Servers board for details.

Ashley

Use Firefox? Interested in IPv6? Try SixOrNot the IPv6 status indicator for Firefox.
Why not try playing Simutrans online? See the Game Servers board for details.

Dwachs

Parsley, sage, rosemary, and maggikraut.

prissi

I though this was comitted? Well then lets make a 122.1.1 soon.