News:

Simutrans Sites
Know our official sites. Find tools and resources for Simutrans.

Testing Simutrans-Experimental with online play

Started by jamespetts, December 19, 2010, 12:29:18 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

jamespetts

#35
Hmm, it looks as though it may well be passenger/goods routing: running a test game with lots of short railway tracks with different sorts of electrification and no stations that I use for testing new vehicles for a considerable amount of time works successfully with no desyncs, even when I set a train going on each of the lines on the client, let them run for a while, use the replace feature, then let them run for a while again, and there are a goodly number of pedestrians in the towns.

Routing of passengers/goods is, of course, something that is very different in Standard than Experimental, so I shall have to look into that. Thank you for your help on this.

Edit: Further testing shows that it is specifically a problem with passenger routing, as setting up a game with a moderately complicated set of industries and routes (rail and road) between them, building the industries with public player, buying the vehicles, setting the infrastructure, changing the schedules, using the replace tool, adding vehicles, linking industries and so forth has worked stably for a long period of time with no desyncs; yet joining a moderately developed game with a passenger network desyncs almost immediately.

Edit 2: On further experimentation, it seems that the problem does not so much arise from passenger routing as from a state of affairs in which passengers/goods have to choose between two or more ways of getting to their destination: in the freight only game to which I referred above, I added another line transporting grain from the grain farm to the flour mill, and the game desynced shortly afterwards. There also seem to be occasional desyncs associated with connecting electricity.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

jamespetts

Update

Knightly has very kindly been working on making his centralised pathing system compatible with network mode for some days now, and posted a patch recently on Github with a finalised fix. That patch, applied, is now on my devel branch on Github.

With that new code, and with the centralised path searching system on, Simutrans-Experimental now works over a network without more than occasional desyncs: it seems that Prissi deduced correctly that the problem had been due to the route-finding algorithm. I am not sure what the problem was with the distributed route finding algorithm, but that is now of little consequence, because the superior centralised system written by Knightly now works fully in network mode, avoiding the need to use the distributed system; indeed, the only reason that the distributed system was retained was because of concerns that the centralised system might not work in network mode.

I hope to release version 9.2 of Simutrans-Experimental very soon so that some more serious testing of playing Experimental over a network can take place, and so that those who are not in a position to compile from source can take part in the testing.

Thanks to Knightly and Prissi for their very kind help in getting Experimental to work in network mode.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

jamespetts

Simutrans-Experimental 9.2 has now been released, including Kinghtly's fixes to the pathfinding system. My very preliminary tests found it to be stable on a smaller map, although there were still some desyncs on a larger map.

9.2 is probably a good version to start testing Experimental using online play properly and see how we go with a small map and several players in a Pak128.Britain-Ex 0.7.1 (or possibly Pak.German.Exp if there is any interest) game. Frank has very kindly set up a server list specifically for Simutrans-Experimental at: http://simutrans-germany.com/serverlist_ex/ so that that the game listing feature in Standard should also work in Experimental (such that Standard games won't show up on the Experimental list and vice versa; needless to say, a player with a Standard client cannot join an Experimental server, and vice versa).

Any test assistance would be most gratefully received!
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

neroden

#38
Comment deleted, as I hadn't finished reading the thread...  :palm:

EDIT: the remaining useful parts from my deleted comment:
ANYway, it's possible to spot all the new uses of simrand in experimental quite easily, using grepdiff.  The only ones are in these files.

a/bauer/hausbauer.cc
a/simcity.cc
a/simfab.cc
a/simworld.cc


It's worth noting that map generation is almost certainly not network-safe, as it uses the new-to-experimental simrand_gauss routine, which relies on the local computer's rand function (which may vary from machine to machine).  This is likely worth fixing in experimental, even if it doesn't create any actual issues....

The rest of this all looks fine in hand-audit.

The only changes to the use of dr_time from standard to experimental are in the following files:

b/path_explorer.cc
a/simhalt.cc


I'm going to assume Knightly mostly knew what he was doing when he fixed path_explorer.cc.  However, I am still suspicious of bits of this code, particularly the part which touches simhalt.cc, and the fact that the networkmode test is *inside* the test for if ( projected_iterations > 0 ).

jamespetts

Nathanael,

thank you for your input on this. I really don't think that the centralised pathing search is to blame, as I know that Knightly has tested it quite thoroughly, and he certainly seems to know what he's doing.

The other things, however, merit further investigation. One complication is that we cannot be sure that the simrand calls in question originate in code where Experimental has added a new simrand call, can we? Suppose that experimental calls method A, which calls method B, and, after an arbitrary further number of method calls, some other method calls simrand in circumstances in which it would not be called in Standard although the calling method and the method calling that (etc.) are all present in Standard? Likewise, might there not be subtle alterations to existing methods calling Simrand that might be to blame?

One thing that does interest me is the use of dr_time in simhalt.cc - if that is not associated with the path searching system (either the centralised system that has been checked thoroughly, or the distributed system which we do not need to use if we use the centralised system) that might be worth looking into further. I thought that I had tracked down dr_time instances and found none.

Incidentally, one thing that does seem to cause desyncs is connecting a substation to an industry, although that has not been checked thoroughly. I do know, however, that Experimental handles electricity in a different way to Standard in a number of respects, and, for example, allows electrification of cities.

In any event, good to have you back, and your assistance in this respect is much appreciated - being able to play Experimental online with others is a very exciting prospect!
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

jamespetts

9.3 should now work with online play, but I have only tested it locally with the loopback interface - I should be very interested if anyone wants to set up test Simutrans-Experimental servers so that we can see how Simutrans-Experimental games play out in practice.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.