1. When making a thread, please tag your thread accordingly using the menu to the left of the textfield where you name your thread where applicable. Server Advertisements and Mod Releases should be contained to their respective subforums.

Server Discussion Starbound Server Player Limit

Discussion in 'Multiplayer' started by helio, Dec 10, 2013.

  1. helio

    helio Orbital Explorer

    If they're just connecting and disconnecting, I think it should work even better, right? So let's say you're not full, the connect and disconnect, this show's you're a valid server running. Let's say you are full, the query you and are rejected, now you don't show up on the site and won't get people flooding you while you can't accept anyone anyway. Do I understand correctly?
     
  2. Lila

    Lila Phantasmal Quasar

    I modified this to get an online player count for display on my servers webpage. It's running on windows though and I had to modify the player_count() function to parse windows' netstat, as it is a different format.

    Here is what I did to get it working on windows:
    Code:
    def player_count():
      count = 0
      for line in parse_console_output(NETSTAT_TCP):
        if len(line) >= 4:
          port = line[1].split(':')[-1]
          status = line[3]
          if port == '21025' and status == 'ESTABLISHED':
            count += 1
      return count
    
    Basically windows' netstat does two things differently. the number of columns is different and it outputs a few extra lines that cause the original parser to choke on index errors.
     
    helio likes this.
  3. Shirou

    Shirou Aquatic Astronaut

    How can i implement this code on my website?
     
  4. cavelurker

    cavelurker Space Spelunker

    That depends on what your site is running on, a little more info and we could help you. You could let this python script run in the background each minute and send the output to a text file, which you could easily bake into the site.
     
  5. skylarhawk

    skylarhawk Aquatic Astronaut

    A touch off topic, but in the same vein, I'd advocate for admin settings or commands that let you actually control the number of concurrent connections on your server within the game server. It's all beta so now's the time for suggestions right? ;)
     
  6. Shirou

    Shirou Aquatic Astronaut

    Running a wordpress website hosted from cpanel and running server on server 2012 any help would be appreciated thanks
     
  7. helio

    helio Orbital Explorer

    I could probably do this, actually. The problem is that I don't think I could give you any sort of feedback in the chat box you'd type the command in (also everyone would see the command you're typing). But, I mean, we could probably have you preconfigure which IP/name combo is allowed to make the changes.
     
  8. skylarhawk

    skylarhawk Aquatic Astronaut

    Sure, it could be done by reading chat logs, and potentially, you could whisper to yourself in chat and the server could know to read those specific logs for the pre-determined "admins". We could poke around ways to do it, but I'm more-so trying to make this an issue that the devs are interested in addressing. I'd like the starbound server to be able to handle a couple of these things itself.
     
  9. Lila

    Lila Phantasmal Quasar

    I replaced the code in the main function to write out the player_count() to a text file. Then on my php page I load that file and print it out.
    here is my main()
    Code:
    def main():
      while True:
        f = open("C:\Program Files (x86)\Steam\SteamApps\common\Starbound\starbound_users.txt", "w")
        players = player_count()
        print str(players)
        f.write(str(players))
        f.close()
        time.sleep(60)
    
    and here is my php:
    Code:
    <h3>Players online: <?PHP
    
    $file_handle = fopen("/tmp/users.txt", "r");
    
    while (!feof($file_handle) ) {
    print fgets($file_handle);
    }
    
    fclose($file_handle);
    
    ?></h3>
    
     
  10. BMZ_G

    BMZ_G Poptop Tamer

    I can do that myself, it's as simple as whitelisting the serverlist IP so it can query without being blocked. Unfortunately I didn't have time to do so yesterday.

    For whatever reason this script doesn't work for me, it seems to let people in anyway.

    I'm on my Amazon server now so no worries, can host as many people as there are people to join :)

    I'll try and continue to contribute code if you're interested, there are some easier ways to do some of the stuff.
     
  11. Shirou

    Shirou Aquatic Astronaut


    Thanks for this but not exactly sure how to do the first part :) only the second part in creating a php file.
     
  12. Shirou

    Shirou Aquatic Astronaut

    I have downloaded python for windows on my server where i host Starbound but not exactly sure what i must do next, please assist :)
     
  13. BMZ_G

    BMZ_G Poptop Tamer

    I would not recommend using this without prior knowledge of Python.
     
  14. Shirou

    Shirou Aquatic Astronaut

    meh, just hope some nice tools release soon and to put on your website for server/player stats :)
     

Share This Page