The International Simutrans Forum

Community => Simutrans Gaming Discussion => Topic started by: Isaac Eiland-Hall on January 01, 2010, 06:18:45 pm

Title: Networking Simutrans discussion
Post by: Isaac Eiland-Hall on January 01, 2010, 06:18:45 pm
The networking code nearly reaches the first stage, where poeple can connect a game and play over the network on the same map. This long term effort is now coming into its final stage. You need a nightly and can then start a server by putting -server -log 0 -debug 0 on the commandline. In the client, you need to enter net:127.0.0.1 as name for the game to load.

This is still early code, so the nightlies actually may become instable for a little while. For playing, you might rather use 102.2.1. When reporting bugs on networking, at the moment report only those, where the client lost synchronisation reproducably and give exactly the order of commands needed and then last twenty lines of simu.log of the clients.

Bugs on joining and so on are still too early, as we know there are still many.

When this hits the nightlies - should one be able to run two copies of Simutrans to connect to the local server?
Title: Networking Simutrans discussion
Post by: prissi on January 01, 2010, 08:03:47 pm
YOu can do so now, it is already mostly in, the only problem is the logfile. But it should work.

(For non-professionals: 127.0.0.1 is your local IP address. Loading a file from net:127.0.0.1 will try to connect to a server from your local hard disk.)
Title: Networking Simutrans discussion
Post by: vilvoh on January 02, 2010, 07:03:04 pm
It works!!  ;D

One thing. If you replace the local IP by another one from a pc where there's a server active, will it work?
Title: Networking Simutrans discussion
Post by: jonasbb on January 02, 2010, 07:57:06 pm
It works.
You have to check, that the port on which ST listen is open, if you use any fireqall or router.
Title: Networking Simutrans discussion
Post by: Isaac Eiland-Hall on January 02, 2010, 08:04:13 pm
Well. I guess this means I will have to try and get it working on my secondary server. :D

Do you have to have a GUI, or will it run from command line? (for the server)
Title: Networking Simutrans discussion
Post by: jonasbb on January 02, 2010, 08:13:25 pm
I think you need a GUI, because ST-Server has also a window in which you can play.
X-Forwarding could make ST-Server run on an Unix-like system without GUI.
Title: Networking Simutrans discussion
Post by: prissi on January 02, 2010, 08:37:50 pm
You can compile with backend=posix, this will generate a server without graphics. But it is way too early for real gaming, and the interface has several points where you might try a buffer overflow, ihmo. This needs much more debugging.

The default port is 13353, but it could run on any other port.
Title: Re: Networking Simutrans discussion
Post by: Isaac Eiland-Hall on January 02, 2010, 08:45:46 pm
What bugs *do* you want reported? Or none at all? heh

So far, I found:

- Running a server and one client on a single box works fine, but trying to join a second client on the same box causes protocol error, then crash.

- Running server as public service and client as human: 1) clicking to place a station causes the server to also show the orange coverage grid, and 2) clicking 'new line' in schedule box creates the line, but doesn't pop up the box to add stops; however, "update line" works. heh

Do you want reports of these types of things? I mean, there's no expectation for instant fix - as you say, it's really really early in the development. But I don't know if reporting these things would be helpful or a waste of your time :)

Either way, thank you for letting us play with this as is. I scared my wife when I loaded the client successfully, because I accidentally let out a shout of excitement. hehehe
Title: Re: Networking Simutrans discussion
Post by: prissi on January 02, 2010, 08:55:28 pm
Second cient does not really work is a known issue.

You can report bugs, but many of them at least I am aware. So I would think best only desynchronisation issues, which I am most likely not aware.
Title: Re: Networking Simutrans discussion
Post by: Dwachs on January 02, 2010, 10:23:10 pm
@Isaac: your bugs should have been fixed already :P
Title: Re: Networking Simutrans discussion
Post by: Isaac Eiland-Hall on January 02, 2010, 10:34:03 pm
I'm sorry, I don't know where discussion takes place on bug fixing, and this was from the latest nightly. But I'll check again next nightly :)
Title: Re: Networking Simutrans discussion
Post by: VS on January 02, 2010, 10:38:02 pm
If it's in nightly, it is probably official, so I would wager a guess - bug reports go in bug reports? ;)
Title: Re: Networking Simutrans discussion
Post by: Isaac Eiland-Hall on January 02, 2010, 10:41:22 pm
Given the introduction of the feature by Prissi, I wasn't so sure. :shrug:
Title: Re: Networking Simutrans discussion
Post by: z9999+ on January 03, 2010, 01:56:08 am
Do you have a plan to support these problem below ?

- Ctrl and shift key handling.
 This is a basic feature to build roads. I mostly use it but not synchronize.
- Underground mode.
 This is also basic but not synchronize.
- Last used way ( "s", "t")
 Last used way is not player dependent currently.
- Map rotation
 Map rotation support is also not good.
Title: Re: Networking Simutrans discussion
Post by: Dwachs on January 03, 2010, 09:09:10 am
Do you have a plan to support these problem below ?
These are known bugs. The underground/visibilty checks have to be removed from the building routines, also the state of ctrl has to be transfered over network.

More known bugs:
-- pausing the game may or may not work correctly
-- the player menu is not synchronized (ie a client cannot start a new company)

@Isaac: I was not aware that no new nightlies were produced the last days. But now there is one
Title: Re: Networking Simutrans discussion
Post by: z9999+ on January 03, 2010, 10:34:38 am

Okay, it's not playable yet.
Then why announcing now ? What is near ?
Title: Re: Networking simutrans is near
Post by: jamespetts on January 03, 2010, 11:03:18 am
Excellent! This should add an exciting new dimension to Simutrans. I can only imagine that a very large amount of work has gone into this - thanks to all involved!
Title: Re: Networking Simutrans discussion
Post by: Dwachs on January 03, 2010, 12:10:45 pm
A network playable version? Near is not the same as ready.

There are limitations now, yes, but if one knows them and avoids them, it is playable.

So considere this announcement as an early pre-alpha version.
Title: Re: Networking Simutrans discussion
Post by: Isaac Eiland-Hall on January 03, 2010, 03:24:58 pm
@Isaac: I was not aware that no new nightlies were produced the last days. But now there is one

Ah! Well, that explains the confusion. :D

I'll download and test more. And try and get my wife to help. :D


Even with problems, I was able to play and test some. Sure, the bugs were out of date because the nightlies were behind, but still I know it will be helpful when I download the latest. :D



I'm very very thankful for the release of code into the nightlies, and the release of information on how to use what's there. It's exciting and fun! :D
Title: Re: Networking Simutrans discussion
Post by: sojo on January 03, 2010, 03:42:29 pm
I have only a question. Sorry, if I had not read it.

Will there be a chatfunction?
Title: Re: Networking Simutrans discussion
Post by: Dwachs on January 03, 2010, 04:02:58 pm
I have only a question. Sorry, if I had not read it.

Will there be a chatfunction?
Why not? However, the implementation only slowly catches up with all the dreams and wishes :D
Title: Re: Networking Simutrans discussion
Post by: IgorEliezer on January 03, 2010, 04:14:15 pm
While an in-game chat doesn't exit, go using Simutrans Chat. It's a poor solution, but solves things for a while.
Title: Re: Networking Simutrans discussion
Post by: Ashley on January 03, 2010, 07:21:24 pm
Wow, I missed this, how awesome :)
Title: Re: Networking Simutrans discussion
Post by: Isaac Eiland-Hall on January 04, 2010, 02:53:55 am
While an in-game chat doesn't exit, go using Simutrans Chat. It's a poor solution, but solves things for a while.

Next time someone edits simutrans.com page, should add this link:
http://webchat.quakenet.org/?channels=simutrans

No need to download a client :)

Actually... I'll see about redirecting chat.[ simutrans [dot] us (site down, do not visit) ] there (.com later maybe)
Title: Re: Networking simutrans is near
Post by: seb444 on January 06, 2010, 10:30:46 pm
Great  ;)

That's a good idea
Title: Re: Networking Simutrans discussion
Post by: Dwachs on February 03, 2010, 08:45:45 pm
- Ctrl and shift key handling.
 This is a basic feature to build roads. I mostly use it but not synchronize.
- Underground mode.
 This is also basic but not synchronize.
- Last used way ( "s", "t")
 Last used way is not player dependent currently.
This should work now with revision 3075.

Last used way is client dependent. Different players within one client share these default ways. (As it used to be without networkmode)
Title: Re: Networking Simutrans discussion
Post by: Václav on February 05, 2010, 08:44:07 pm
May be I am wrong: is server installed via (for example) VertrigoServ sufficient for net game? - or is some else server needed?

Download of VertrigoServ is available on SourceForge.
Title: Re: Networking Simutrans discussion
Post by: Dwachs on February 05, 2010, 09:43:01 pm
you do not need an extra server. Simutrans itself acts as one: just start with parameter -server (only trunk version not stable release candidate).
Title: Re: Networking Simutrans discussion
Post by: Václav on February 05, 2010, 09:44:50 pm
So: it makes own server?
Title: Re: Networking Simutrans discussion
Post by: Dwachs on February 06, 2010, 09:54:10 am
yes.

Disclaimer: current nightlies are built from the stable branch without networking.
if you want to try it out either (a) compile yourself, (b) take the last trunk nightly 3055 from january 27 or (c) wait until the stable is released and nightlies are built from trunk again.
Title: Re: Networking Simutrans discussion
Post by: Dwachs on March 29, 2010, 09:05:09 am
... the nightlies on the nightly downloadpage contain the network features (&bugs) again !

Please test!
Title: Re: Networking Simutrans discussion
Post by: jamespetts on May 17, 2010, 02:33:01 pm
How is testing of the network multiplayer mode progressing?
Title: Re: Networking Simutrans discussion
Post by: Dwachs on May 17, 2010, 04:04:53 pm
One should compile the code for himself, since the savegame version simversion.h needs to be stepped up.
Title: Re: Networking Simutrans discussion
Post by: jamespetts on May 17, 2010, 05:30:21 pm
Dwachs,

is anyone running a server for testing this...?
Title: Re: Networking Simutrans discussion
Post by: jonasbb on May 17, 2010, 06:18:08 pm
You can run your own server.
A server where you can see all available games is not possible.

You have to start your own server and give the IP to the ST-client.
Title: Re: Networking Simutrans discussion
Post by: Dwachs on May 17, 2010, 06:19:59 pm
@James: due to rl restrictions no 'official' network testing is in progress. That will have to wait after the next release.
Title: Re: Networking Simutrans discussion
Post by: prissi on May 17, 2010, 06:30:35 pm
Any server needs version 102.3 for savegame (or up) for client too!
Title: Re: Networking Simutrans discussion
Post by: jamespetts on May 17, 2010, 06:44:23 pm
As will be appreciated, running a local server and connecting to it on a local machine is not as rigorous a test as connecting to a server that is actually accross a network ;-) Nobody is running a test server somewhere...?

Has much testing actually across a network taken place?

Edit: Have only just seen Dwachs and Prissi's messages. So, the position is that network testing will recommence after the next stable release?
Title: Re: Networking Simutrans discussion
Post by: prissi on May 17, 2010, 10:03:57 pm
Problems are desync. Running over the network has been done and is working fine. The longer a line is, the longer delay setting is needed to execute stuff, which needs to be p****ed to the server. But that is all.
Title: Re: Networking Simutrans discussion
Post by: jamespetts on May 17, 2010, 11:32:42 pm
How bad are these synchronisation problems?
Title: Re: Networking Simutrans discussion
Post by: Dwachs on May 18, 2010, 07:05:19 am
Desynchronisation is as bad as losing the network connection at all. That is, the client has to connect to server again.
Title: Re: Networking Simutrans discussion
Post by: jamespetts on May 18, 2010, 09:12:59 pm
And how often does this desynchronisation occur at present? Are you optimistic that the issue will be resolved in due course to make the game playable over a network?
Title: Re: Networking Simutrans discussion
Post by: prissi on May 18, 2010, 09:17:59 pm
Desynchronisation means the core engines came out of sync. This happens when for instance the vehicles arriving at a crossroads in different order. It is checked every x frames (currently I think x=250) and if occured, it will kick the client out. Thus this needs to be addressed. However, core functionality needs to be present even before that. This is 95% done, with some stuff still pending for the player, pak detection and forestconf/cityconf decriptions.
Title: Re: Networking Simutrans discussion
Post by: jamespetts on May 18, 2010, 09:26:29 pm
Ahh, I see. I shall look forward to seeing how this progresses - excellent work so far :-)
Title: Re: Networking Simutrans discussion
Post by: Maragil on May 31, 2010, 05:08:43 pm
Sorry, not quite sure what's going on person entering chat here-

Is it usable over a Local Network?, i.e can both myself and someone else both build simultaneously on the same map from two different computers connected to a network?

Thanks,

H./
Title: Re: Networking Simutrans discussion
Post by: VS on May 31, 2010, 05:33:16 pm
Actually, over local network it should be easier than over internet...
Title: Re: Networking Simutrans discussion
Post by: TrainMith on May 31, 2010, 07:07:06 pm
prissi:  Perhaps if the networking latency gets to the point where it now kicks out the client, instead the server slows down the game speed until an acceptable level and if the latency gets larger then finally kicks the client.  Just a suggestion.
Title: Re: Networking Simutrans discussion
Post by: prissi on May 31, 2010, 08:32:23 pm
The clients speed is irrelevant. Longer latency just means you have to wait longer for clicks. Only if you latency is changing like crazy, desyncs may happen; but this may be treu for any netowrking game which needs synchronisation between all clients.
Title: Re: Networking Simutrans discussion
Post by: Dwachs on June 01, 2010, 05:13:07 am
In my (small) experience, desynchronisation occurs if the server does not run continuously. Ie, if the cpu time of simutrans on the server varies heavily. Then at some point, the client runs ahead of the server. Then if the server sents a command to be executed at a certain step, this step may be already computed on the client -> client get kicked out. This cannot be foreseen by the client etc.
Title: Re: Networking Simutrans discussion
Post by: jamespetts on June 01, 2010, 09:45:45 am
Dwachs,

in which case it may be sensible to ensure that the server is a fast machine and/or Simutrans is set to have a high processor priority on the server...
Title: Re: Networking Simutrans discussion
Post by: Maragil on June 01, 2010, 10:00:25 am
Sorry- still confused here - what's the status of Simutrans over Local Networks?
Title: Re: Networking Simutrans discussion
Post by: Dwachs on June 01, 2010, 10:23:15 am
Sorry to say that, but you need to compile your own version first (the compiled nightlies do not work over network, but the source code is there). Or wait until a new version is released. Or more technically: if the savegame version is increased (which means not more than that savegames from such nightlies cannot be loaded from the previous stable releases anymore).

The basic infrastructure for networking is in the source code, but there are stills things needed to be sorted out.
Title: Re: Networking Simutrans discussion
Post by: Dwachs on August 19, 2010, 08:09:17 am
Good news: you can test networkmode in recent nightlies. You do not have to compile yourself anymore, as the network version will use the increased savegame version automatically.
Title: Re: Networking Simutrans discussion
Post by: prissi on August 22, 2010, 08:25:58 pm
The next nightly (r3696) should have a relatively stable network modus. One of the unsolved problems is the clients sometimes very badly lagging behind. But there have been no crashes in 1h playing with haiku, windows serevr and windos client, and only one synchronisation was lost.
Title: Re: Networking Simutrans discussion
Post by: jamespetts on August 22, 2010, 08:31:23 pm
Glad to see progress with this! Multiplayer Simutrans should be very fun.
Title: Re: Networking Simutrans discussion
Post by: Xelofino on August 28, 2010, 03:13:01 pm
So i am a dummy. You are always writing from Commandline and client but i have no idea how i could make it working. Could someone write how he is doing it that he can play with himself on the same computer cause i didn't get it. sorry for being silly.

Xelofino
Title: Re: Networking Simutrans discussion
Post by: vilvoh on August 28, 2010, 05:25:34 pm
Take a look at this tutorial How to test Simutrans network mode (http://forum.simutrans.com/index.php?topic=4198.0)
Title: Re: Networking Simutrans discussion
Post by: Xelofino on August 29, 2010, 07:26:43 am
Thank you very much!!!!!!
I searched in the international Blog and in the Forums but i didnt find it.