The International Simutrans Forum

 

Author Topic: Multiplayer server protocol?  (Read 4215 times)

0 Members and 1 Guest are viewing this topic.

Offline RichardG

  • *
  • Posts: 22
Multiplayer server protocol?
« on: July 06, 2011, 01:04:22 PM »
« Last Edit: January 18, 2019, 04:36:00 PM by RichardG »

Offline VS

  • Senior Plumber (Devotee)
  • Devotee
  • *
  • Posts: 4855
  • Vladimír Slávik
    • VS's Simutrans site
  • Languages: CS,EN
Re: Multiplayer server protocol?
« Reply #1 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...?

Offline RichardG

  • *
  • Posts: 22
Re: Multiplayer server protocol?
« Reply #2 on: July 06, 2011, 02:31:57 PM »
« Last Edit: January 18, 2019, 04:34:42 PM by RichardG »

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4556
  • Languages: EN, DE, AT
Re: Multiplayer server protocol?
« Reply #3 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

Offline RichardG

  • *
  • Posts: 22
Re: Multiplayer server protocol?
« Reply #4 on: July 06, 2011, 02:50:43 PM »
« Last Edit: January 18, 2019, 04:34:37 PM by RichardG »

Offline VS

  • Senior Plumber (Devotee)
  • Devotee
  • *
  • Posts: 4855
  • Vladimír Slávik
    • VS's Simutrans site
  • Languages: CS,EN
Re: Multiplayer server protocol?
« Reply #5 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...

Offline RichardG

  • *
  • Posts: 22
Re: Multiplayer server protocol?
« Reply #6 on: July 06, 2011, 06:01:32 PM »
« Last Edit: January 18, 2019, 04:35:56 PM by RichardG »

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4556
  • Languages: EN, DE, AT
Re: Multiplayer server protocol?
« Reply #7 on: July 06, 2011, 08:26:19 PM »
Did you try to compile a debug build of nettool? Maybe the release configuration is broken.

Offline RichardG

  • *
  • Posts: 22
Re: Multiplayer server protocol?
« Reply #8 on: July 06, 2011, 08:48:45 PM »
« Last Edit: January 18, 2019, 04:35:52 PM by RichardG »

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4556
  • Languages: EN, DE, AT
Re: Multiplayer server protocol?
« Reply #9 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.

Offline Ashley

  • Coder/Patcher
  • Devotee
  • *
  • Posts: 1288
    • entropy.me.uk
Re: Multiplayer server protocol?
« Reply #10 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.

Offline RichardG

  • *
  • Posts: 22
Re: Multiplayer server protocol?
« Reply #11 on: July 08, 2011, 12:58:52 PM »
« Last Edit: January 18, 2019, 04:35:49 PM by RichardG »

Offline Ashley

  • Coder/Patcher
  • Devotee
  • *
  • Posts: 1288
    • entropy.me.uk
Re: Multiplayer server protocol?
« Reply #12 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

Offline RichardG

  • *
  • Posts: 22
Re: Multiplayer server protocol?
« Reply #13 on: July 09, 2011, 10:08:48 PM »
« Last Edit: January 18, 2019, 04:35:17 PM by RichardG »

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4556
  • Languages: EN, DE, AT
Re: Multiplayer server protocol?
« Reply #14 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?

Offline RichardG

  • *
  • Posts: 22
Re: Multiplayer server protocol?
« Reply #15 on: July 19, 2011, 09:35:49 PM »
« Last Edit: January 18, 2019, 04:35:10 PM by RichardG »