News:

Use the "Forum Search"
It may help you to find anything in the forum ;).

New 64-bit SDL2 builds for Windows (part of fix for multiplayer lag)

Started by jamespetts, January 18, 2018, 01:43:46 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

jamespetts

After reports recently of people having trouble playing online due to excessive lag (caused ultimately by poor performance on client machines), I have been investigating ways to improve performance. I have previously done some work in optimising the code, but changing the graphics/sound backend from GDI to SDL2 also makes a big difference to performance. Setting up cross-compiling for this (so that I could have automatic nightly builds compatible with Windows produced on the Bridgewater-Brunel Linux server) took some time, but I have now managed to produce an SDL2 build for Windows, which can be downloaded from the Windows subfolder of the nightly download folder on the Bridgewater-Brunel server. Currently, the existing 32-bit GDI builds retain the name Simutrans-Extended.exe, whereas these new builds are named Simutrans-Extended-64.exe.

Testing with my own computer (an Intel i7950) connecting to the Bridgewater-Brunel server, at normal levels of zoom, even after several minutes over an area with much sea, and scrolling around the map, there was no command lag. This is due in part to the improved performance of the newer builds and in part to the fact that I have now set the target framerate on the server to 20fps instead of 30fps as it has been set before. The game still seems to be reasonably smooth at 20fps.

I have also taken the opportunity to make some other improvements to technical aspects of the way in which Simutrans-Extended is built for Windows. Firstly, this is now a 64-bit build rather than a 32-bit build. Although this does not positively affect performance, it does allow Simutrans-Extended to access more than 4Gb of RAM. Given that the current Bridgewater-Brunel server game is taking somewhere close to this now, and it is only 1773, more than 4Gb of RAM may very well be required by the 20th century, and it would not have been possible for people using Windows to play if only 32-bit builds were available.

Further, I have switched to the SDL sound backend. This means that it is now possible for multiple sounds to play simultaneously, ending the very annoying behaviour of the old GDI build in which any sound playing would be stopped part-way through when another sound tried to play. Now, all sounds can finish playing to the end properly, which should make the audio experience much better. I do not think that the Windows SDL2 version works with the MIDI music, but I also do not think that anyone actually listens to the Simutrans MIDI music in any event. I have also improved the quality of the sound that the game asks the SDL backend to play (where suitable quality sound files are available): the default is now 48,000 samples/second.

I should note one issue at present with the 64-bit SDL2 builds is that the game appears to crash on quitting. I am not entirely sure why this is yet - it is not a very serious problem, as it is only when one actually quits the game, rather than unloads the map to load a new game, that this occurs, although it does have the unfortunate effect that the game will not auto-save on exiting. I will have to look into this problem when I have the time.

You might also need a 64-bit version of the pthreads dynamic library - if you get an error when starting Simutrans-Extended, please let me know, and I will upload this library (although this will displace the 32-bit version, so you will only be able to have one at a time).

I plan to keep the old 32-bit GDI builds available indefinitely to allow those with 32-bit systems to continue to use Simutrans-Extended and also as a backup in case of difficulty with the 64-bit builds, but they may well be given a legacy name in the future, with the 64-bit SDL2 builds receiving the generic Simutrans-Extended.exe name.

I should be very grateful if people could test these new builds to let me know whether they work and whether you are able to stay connected to the Bridgewater-Brunel server for an extended period of time without accumulating a large input lag.
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.