Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Network Player Listing ??

Comments in 'Plugin Development' started by Radix, Jul 8, 2015.

  1. Radix
    Offline

    Radix Active Member

    Joined:
    Jul 2, 2015
    Posts:
    211
    Minecraft User:
    Dicks123
    I've seen networks such as lbsg do this, and my team and I can't seem to figure a way to display the full numbers of players on the whole network linked. Instead of just that one single server. You have a lobby with 2 players when you have 50 People on your network. Which is a problem that only two players would be displayed!
  2. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    there are a bunch of threads about this. I think QueryRegenerateEvet, @PEMapModder?
    PEMapModder likes this.
  3. Xenturio
    Offline

    Xenturio Active Member

    Joined:
    Sep 19, 2014
    Posts:
    333
    Minecraft User:
    Xenturio
    i think u cant at the moment, u only can count the names but not shown all.
  4. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    Then what about LBSG? Lol. It is possible.
  5. Xenturio
    Offline

    Xenturio Active Member

    Joined:
    Sep 19, 2014
    Posts:
    333
    Minecraft User:
    Xenturio
    have u a picture? the minecraft server site do change all day some codes by website so sometimes it will shown sometimes not
    Radix likes this.
  6. Radix
    Offline

    Radix Active Member

    Joined:
    Jul 2, 2015
    Posts:
    211
    Minecraft User:
    Dicks123
    what the event for server chat broadcast or would you need to do it via database ( Don't want to do )
  7. Xenturio
    Offline

    Xenturio Active Member

    Joined:
    Sep 19, 2014
    Posts:
    333
    Minecraft User:
    Xenturio
    Why server chat broadcast??? u only can do it with mysql or a other database like maria
  8. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    PocketMine generates both UT3 query (used by server lists) and MCPE RakNet-level query (as shown in MCPE world list) information using data from QueryRegenerateEvent.
    I think this is not related to this thread?

    Anyway, the answer:

    If you only have two servers (and you are sure you won't have more than two) , you should not use a database. Create a socket client-server connection between your two servers. When a player talks, in addition to the local server broadcasting the chat message to its own players, also send a packet (or a command, whatever you call it) through your socket to the other server. The other server, upon receiving the packet/command/whatever, should broadcast to its players as well. This is highly efficient, and even more efficient than using a database, because data are exchanged between the two servers directly.
    However, if you have more than two servers, you shouldn't use the above method, because you will have to create a connection between every two servers. It would become something like this:
    [​IMG]
    This is the network map if you have five servers. 10 connections are created. And each server has to handle 4 connections (to the other 4 servers). This is not a very good idea.
    Instead, you should use a database. In this case, the database serves as a chat server. In a chat server, chat clients (your MCPE servers) send messages to the chat server (your database server), and the chat server relays the message to other chat clients (other MCPE servers). On the MCPE server side, each MCPE server only needs to create one connection with the database but one connection returns all the chat messages needed. This seems to be a much better idea.
    Moreover, this thing is MUCH EASIER to handle.
    First, we already have a working central server called MySQL, which is very stable (even more stable than PocketMine), and we also have a relatively stable MySQL connector called MySQLi in PHP, so no coding or debugging needed for the connection itself.
    Second, you can safely ignore the existence of other servers. In the custom socket case, you have trouble to determine which server is the socket server and which one is the socket client. Furthermore, MySQL automatically listens for connections, and other servers don't have to know whether a certain server is online; as long as the database is online, everything can be used, and they don't even need to know (unless you want to, of course) which server the message comes from. Everything gets much neater.

    Edit: one to many is actually not that bad, but don't make it a pentagon star. Instead, make it like a tree. The IRC server network concept may inspire you.
    Read above ^
    Last edited: Jul 8, 2015
    Andrey Nazarchuk and Lambo like this.
  9. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    I am sure the code would bw hard. XF
  10. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    It works with some queries.
  11. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Here is a graph for more elaboration, although it probably just makes it harder to understand.
    Screenshot_2015-07-08-23-23-32.png
    Andrey Nazarchuk, Lambo and Xenturio like this.
  12. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Maybe I'm an odd born, but I think the theory behind the choice is more important than how you actually implement it. Maybe it is because I'm the artist who concerns more about the code beauty and code quality and ignore whether the code is ever used? But instead of saying "use MySQL qurries", I hope you can think more about why, and don't appeal to traditions.
    Lambo likes this.
  13. Xenturio
    Offline

    Xenturio Active Member

    Joined:
    Sep 19, 2014
    Posts:
    333
    Minecraft User:
    Xenturio
  14. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Example implementation:
    Code:
    Player sends chat
      |__> cancel chat event
      |__> upload to MySQL using an INSERT query
    
    For each server, per tick
      |__> download new chat messages using a SELECT query
      |__> Broadcast each new chat message to local players
    
    In this implementation, server A uploads the chat message to MySQL and download it a tick later. I think the half/one tick latency of the chat message being handled usually doesn't matter. Instead, it makes things more organized. It is just like a company's treasury putting money into the company's bank to store and taking them out later when he gets money and later spends it.
  15. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Edit: the star pentagon system is actually not too bad. The IRC concepts may provide some good ideas for you.
    Andrey Nazarchuk likes this.
  16. Xenturio
    Offline

    Xenturio Active Member

    Joined:
    Sep 19, 2014
    Posts:
    333
    Minecraft User:
    Xenturio
    this is how i do it
  17. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder

Share This Page

Advertisement