The International Simutrans Forum

Development => Bug Reports => Topic started by: RichardG on July 06, 2011, 01:04:22 PM

Title: Multiplayer server protocol?
Post by: RichardG on July 06, 2011, 01:04:22 PM
Title: Re: Multiplayer server protocol?
Post by: VS on July 06, 2011, 01:55:57 PM
There's the "nettool" which can be used for querying servers. It's a standalone binary, partially sharing code with Simutrans. I think it's not part of releases, though...?
Title: Re: Multiplayer server protocol?
Post by: RichardG on July 06, 2011, 02:31:57 PM
Title: Re: Multiplayer server protocol?
Post by: Dwachs on July 06, 2011, 02:45:20 PM
There is a webpage of servers

http://simutrans-germany.com/serverlist/index.php

See the wiki for the calls simutrans makes to reach the master server:

http://simutrans-germany.com/wiki/wiki/tiki-index.php?page=en_listserver_dev
Title: Re: Multiplayer server protocol?
Post by: RichardG on July 06, 2011, 02:50:43 PM
Title: Re: Multiplayer server protocol?
Post by: VS on July 06, 2011, 03:15:55 PM
As to the compilation errors, maybe you are missing some files or defines. The project file might be outdated...
Title: Re: Multiplayer server protocol?
Post by: RichardG on July 06, 2011, 06:01:32 PM
Title: Re: Multiplayer server protocol?
Post by: Dwachs on July 06, 2011, 08:26:19 PM
Did you try to compile a debug build of nettool? Maybe the release configuration is broken.
Title: Re: Multiplayer server protocol?
Post by: RichardG on July 06, 2011, 08:48:45 PM
Title: Re: Multiplayer server protocol?
Post by: Dwachs on July 07, 2011, 05:16:42 AM
But one more issue left... where do I set the "password" nettool uses?
In simuconf.tab (see the file in the svn repo at trunk/simutrans/config/simuconf.tab) or as command line option.
Title: Re: Multiplayer server protocol?
Post by: Ashley on July 07, 2011, 10:15:37 PM
Nettool doesn't have the ability to query the gameinfo for a server. I wrote a little python script which can do this by reverse engineering the protocol using the C++ code. It'd be better to build that functionality into Nettool (in case the protocol changes).

One thing to consider is the additional bandwidth drain which continual gameinfo queries would place on servers. Especially if this was generating the image regularly. A gameinfo query isn't an insignificant amount of data primarily due to the image contained within.

I'd recommend you seek the permission of individual server administrators before running such a service against their servers, and determine what the bandwidth usage would be.
Title: Re: Multiplayer server protocol?
Post by: RichardG on July 08, 2011, 12:58:52 PM
Title: Re: Multiplayer server protocol?
Post by: Ashley on July 08, 2011, 03:21:16 PM
It's not a terribly complex modification, but it may be better to think about exactly what information is needed for such a purpose and then set up a custom object which can be queried for using Nettool. Most of the Nettool functions are password protected, so maybe we can leave it up to the server admin as to whether this extended query mechanism requires a password or not (or allow it to rate limit the requests or something like that).

So what fields do you need? Currently the gameinfo object contains:

Code: [Select]
        # 1, xml version, none
        # 2, simutrans version, tag params - version, pak
        # 3, object name (gameinfo_t), none
        # 4, x dimensions of map, i32
        # 5, y dimensions of map, i32
        # 6 - 4101, minimap data (64x64px), i8
        # 4102, no. of industries, i32
        # 4103, no. of tourist attractions, i32
        # 4104, no. of cities, i32
        # 4105, population, i32
        # 4106, number of vehicles, i16
        # 4107, number of stops, i16
        # 4108, total passengers transported, i64
        # 4109, total mail transported, i64
        # 4110, total goods transported, i64
        # 4111, total goods transported, i64
        # 4112, freeplay on/off, bool
        # 4113, timeline on/off, bool
        # 4114, starting money, i64
        # 4115, current year/month  (how is this field represented?), i32
        # 4116, bits per month, i16
        # 4117, language code, CDATA
        # 4118, game comment, CDATA
        # 4119, samegame file name, CDATA
        # 4120, pak name, CDATA
        # 4121, game engine revision (svn version), i32
        # 4122 - 4137, player type in each slot (1-16), i8
        # 4138, total number of clients, i8
        # 4139 - 4158, checksum??, i8
        # 4159, closing object name tag, none
        # 4160, blank, none
        # 4161, closing simutrans tag, none
Title: Re: Multiplayer server protocol?
Post by: RichardG on July 09, 2011, 10:08:48 PM
Title: Re: Multiplayer server protocol?
Post by: Dwachs on July 13, 2011, 08:54:57 AM
I do not understand what you try to achieve. Do you want to build a site that is equivalent to http://simutrans-germany.com/serverlist/index.php ?

Or do you want to do something different?
Title: Re: Multiplayer server protocol?
Post by: RichardG on July 19, 2011, 09:35:49 PM