The International Simutrans Forum

 

Author Topic: Multiplayer: which way to go?  (Read 6567 times)

0 Members and 1 Guest are viewing this topic.

Offline isidoro

  • Devotee
  • *
  • Posts: 1129
Multiplayer: which way to go?
« on: December 17, 2008, 03:16:45 AM »
When trying "Widelands", an open source clone of "The Settlers", a simulation game, I came across this piece of documentation:
Quote
Parallel Simulation
-------------------
The game logic is supposed to be affected only by the following factors:
  • the pseudo RNG (which is completely determined by the initial seed)
  • the starting conditions
  • the sequence of player commands sent to the Cmd_Queue

As long as the gameplay logic stays the same (no code changes / no changes to conf files), and the above factors remain the same, the outcome must be the same.

This property of the Widelands game logic is extremely important for two reasons:
  • Multiplayer by parallel simulation:
      Every host keeps the complete state of the simulation in memory, and only  player commands are exchanged to keep network traffic low. The properties  above guarantuee that there is no desync.
  • Demo recording
      By creating a savegame followed by a sequence of player commands, it is  possible to create a demo recording of a game (similar to Age of Empires,  for example)

Is it possible/desirable parallel simulation in Simutrans when multiplaying?

Offline VS

  • Senior Plumber (Devotee)
  • Devotee
  • *
  • Posts: 4855
  • Vladimír Slávik
    • VS's Simutrans site
  • Languages: CS,EN
Re: Multiplayer: which way to go?
« Reply #1 on: December 17, 2008, 09:32:49 AM »
Also worth considering: In Wesnoth, RNG also depends on the game data, so that you can't cheat easily - if you change numbers, clients have different RNG and go out of sync.

This could be ensured by less brutal means of course, but it shows possible security element and also a possible pitfall if the player has some addons.

iirc Simutrans has something almost akin to threads. With all the implications this can have on synchronization...?
« Last Edit: December 17, 2008, 09:42:05 AM by VS »

Offline vilvoh

  • One of the good guys
  • Administrator (Inactive)
  • *
  • Posts: 4504
  • I'm the constructor, the architect
    • Escala real
Re: Multiplayer: which way to go?
« Reply #2 on: December 17, 2008, 09:54:55 AM »
Many applicatins, not only games, use that network model. The best thing is that it opens the possibility of record games, something that Hajo & Prissi have confessed is in the TODO list since ages. Btw, how are you going to manage the addons issue in multiplayer? just ignoring the ones that are not common to all players or downloading them from other players before starting the game?

Other thing that may seem obvious but I want to ask, won't be possible to play against players that have different pakset (128pak and 64pak players mixed in the same game), will be?

Offline jbode

  • Devotees (Inactive)
  • *
  • Posts: 84
Re: Multiplayer: which way to go?
« Reply #3 on: December 17, 2008, 11:28:02 AM »
hmmm, the various pak sets will impose significant issues ... I would the suggest to give the pak sets a unique fingerprint (also separating the versions) which can be checked and the network game restricted to those commom paks. A proper fingerprinting would also enable to identify missing or conflicting paks when loading existing games. The Simutrans console could this way tell "pak set xyz is missing and needed to load this game".

Another point is that the network mode must be started before the pak sets are loaded. At the moment the pak sets are loaded during the Simutrans start up

Offline Spike

  • *
  • Posts: 1361
  • First Simutrans Developer and Graphics Artist
Re: Multiplayer: which way to go?
« Reply #4 on: December 17, 2008, 02:31:19 PM »
.. won't be possible to play against players that have different pakset (128pak and 64pak players mixed in the same game), will be?

It might be possible - but that means to transfer the PAK data to the player who is missing it.

So I assume the first networked Simutrans versions will require all players, who want to play a game together, to have the same pak sets installed. Even the very same versions of the pak sets.

Offline leopard

  • Devotees (Inactive)
  • *
  • Posts: 97
  • Life in the Urban Jungle
    • A Leopard's Tail
Re: Multiplayer: which way to go?
« Reply #5 on: January 01, 2009, 04:30:46 PM »
the way to get round the pak issue is to have one machine designated the 'master' with the ability for the others to request paks from the master as required. hence everyone gets the same stuff, and one person gets to decide the set. essentially you have one person setting up a scenario and others playing it.


Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 9566
  • Languages: De,EN,JP
Re: Multiplayer: which way to go?
« Reply #6 on: January 01, 2009, 09:01:09 PM »
Well, I though just seperating the add-folder from the pak folder. Network games would have to have the pak folder.

However, as any command ist confirmed by the server, and maps are only send from server to client, additional vehciles will not break a game. (Additional building levels would).

Offline VS

  • Senior Plumber (Devotee)
  • Devotee
  • *
  • Posts: 4855
  • Vladimír Slávik
    • VS's Simutrans site
  • Languages: CS,EN
Re: Multiplayer: which way to go?
« Reply #7 on: January 01, 2009, 09:48:33 PM »
Separating addons folder -> 100% support.

Offline vilvoh

  • One of the good guys
  • Administrator (Inactive)
  • *
  • Posts: 4504
  • I'm the constructor, the architect
    • Escala real
Re: Multiplayer: which way to go?
« Reply #8 on: January 01, 2009, 10:03:05 PM »
It's the most reasonable way to deal with addons, and would help to install and manage them in a easy way. I support this idea too.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 9566
  • Languages: De,EN,JP
Re: Multiplayer: which way to go?
« Reply #9 on: January 02, 2009, 08:43:17 PM »
If I ever get to release the stable I will work on it.

Offline IgorEliezer br

  • Devotee
  • Administrator
  • *
  • Posts: 4087
  • Cake recipes are cool... REALLY!
    • Igor Eliezer Architect and Urban Planner/Arquiteto e Urbanista
  • Languages: PT, EN, AutoLISP, Python
Re: Multiplayer: which way to go?
« Reply #10 on: January 02, 2009, 11:02:59 PM »
Let me speak a few... but I don't know if I can explain well.

1) If I want to join a netgame, how do I "connect" my Simutrans to host's one. Say, I host a netgame on Internet, how will a player discover me and join me?

What I/we could do is:

a) Join by IP: send him my IP via MP, e-mail or chat, and he joins me by IP, in Simutrans' GUI could have a dialog box with a field where you can type a IP number.

b) Join by public list: we could have a database in simutrans.com where all active netgames are listed. When I host a netgame on Internet, my IP and a server name (e.g. "IgorTekton's server") are sent to a database. Another player who wants to play could open an dialog box that consults that database and a list of active netgames is created in Simutrans' GUI. He merely chooses one netgame from list and clicks on.

IP number  | Server name  | Version
00.00.00   | Join me plz  | 101.0
11.11.11   | Fun server   | 101.0
22.22.22   | Smith server | 101.0

Also, we could have a dynamic page that is updated every time that someone hosts or closes a netgame. This page is buit with data obtained from database. I could open such page, choose a IP and join by IP.

2) About netgame compatibility:

If I have a way of connecting to a netgame (by IP or public list), Simutrans will need to check compatibility between me and hoster upon trying a join.

1. Try connection with server/netgame;
2. If netgame is up and accepting new players, check Simutrans version compatibility;
3. If compatible, check pak compatibility (or missed add-ons);
4. If compatible, go ahead; if no, try to donwload from hoster needed/missed paks in a "Download" folder;
5. If OK, join is acepted, new player is announced in mensage centre and he chooses a player and a name.

About 2: host can set a maximum limit of players and can turn on and off new joins. Depending on host's connection, too much players may cause game lags.

About 4: host can tun on or off and/or limit a maximum size for downloads, once it can cause game lags too.
« Last Edit: January 02, 2009, 11:14:48 PM by IgorTekton »

Offline Ashley

  • Coder/Patcher
  • Devotee
  • *
  • Posts: 1288
    • entropy.me.uk
Re: Multiplayer: which way to go?
« Reply #11 on: January 03, 2009, 12:06:38 AM »
You simply have a "lobby server" which all clients connect to to arrange games, this can incorperate a chatroom and rankings systems, if required. Just about every multiplayer game since forever does this :)

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 9566
  • Languages: De,EN,JP
Re: Multiplayer: which way to go?
« Reply #12 on: January 03, 2009, 09:44:54 PM »
However, please before going overboard, basic functionality must ensured.