StarMade 0.09381: Critical server fix

    schema

    Cat God
    Joined
    Feb 17, 2012
    Messages
    1,552
    Reaction score
    2,604
    • Schine
    Hello and welcome to StarMade,

    as you can see this version does only increase the build number. That means that old clients from the same version can join updated servers, and updated clients can join old servers.

    The main thing for this version is a critical fix for the server I've been hunting a long time for. It's symptoms are lags, and complete server freezes (disconnects via ping timeouts, and unable to join again). It seemed to be caused by some clients with bad connection and/or high ping.



    Technical:

    Some people suggested that I should put each connection into its own thread, so let me start by assuring: It was never done any other way. The game wouldn't be able to run at all in multiplayer had I every connection handled in one thread. The thing about threads is, that they need to synchronize in certain parts. This is done by locking certain objects so only one thread at a time can access. You cant have multiple threads accessing the same list for example as that would cause unpredictable behavior and crashes. However using locks can lead to something called a deadlock. In it's simplest form: Thread X waits for Object A and locked Object B already while Thread Y waits for Object B and locked Object A already. In this case it was much more complicated. Bottom line is that there was a possible never returning method (flush for client with certain type of connection not answering) in a locked part of a thread making all other threads and the main thread itself wait for that method to return and unlock that part. I moved that method out of that locked part, and while the method can still be stuck, it will no no longer block the other threads.



    Other fixes:

    - fixed spawning point mess up when rejoining a game
    - fixed critical (especially on servers with many players) bug where possibly an update could be skipped for players when another player joined the game
    - added external thread to check if the server has frozen. It will produce a threaddump every 5 seconds of freeze to really help with debugging



    Thanks for playing StarMade,

    - schema
     
    Joined
    Jun 25, 2013
    Messages
    1
    Reaction score
    0
    • Legacy Citizen 2
    • Legacy Citizen
    Laymans: Jibberish and magic, he done fixed the do dad with the thing-a-ma-jig.
     
    Joined
    Jun 23, 2013
    Messages
    1
    Reaction score
    0
    I was looking at the note about the void->system transfer and rotation around stars/suns.

    When playing the game I have only been aware of a single sun, but the game could be extended to multiple solar systems. Transfer between solar systems could be done using a Warp computer connected to warp drive blocks. The blocks would require energy to recharge and the number of warp drive blocks needed could be linked to the mass of the ship (e.g. Am + Bm1/2 where A and B are constants and m is the mass).

    A solar system could be represented by a spherical grid rotating around the sun (at location 0,0,0). A sector will be within the sphere if x2 + y2 + z2 <= radius. You could set the outer layers of blocks as being outside the solar system and prevent movement further than the maximum radius (by moving to the nearest sector if you try).

    Moving from one solar system to another would involve choosing the target system from a map using the Warp computer. It is probably easiest to assume that nothing happens between solar systems and that you could not be stranded between systems. There could, however, be a random chance you will end up somewhere other than your intended target.

    What do others think?