Checking if player has sign loaded.

Discussion in 'Plugin Development' started by Ultimate_n00b, Dec 18, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    Ultimate_n00b

    If you've been on an SCB server recently, you can see that the signs now scroll. It's getting all the players in the chunk and sending a custom packet. However - I would like to just get nearby players. Because of how it works, you don't see updated versions of signs in another chunk.

    I attempted to send the packet to all online players, but this causes the infamous "Unable to locate sign at x, y, z" message. Is there any way to check if the player has the sign loaded?
     
  2. Offline

    Ultimate_n00b

    Bump I suppose?
     
  3. Offline

    blablubbabc

    Maybe you could listen to the chunk packet and if in this chunk is at least one of those custom, updating signs, you remember the player it has been sent to in a datastructure which stores for each chunk (-coordinates) of your custom sign chunks a collection of players.
    And when you update your signs you only send your custom sign packets to the players which you have stored (when they received/been sent the chunk packet) for the specific chunk of this custom sign, IF they are still in the view range of the server (this should be a fast check as you only have to compare the player's current chunk coordinates with the sign chunk coordinates), otherwise you remove the player again from the storage for this chunk.

    However, I have no idea how complicated this gets or how this works out for many players. And if there are issues with the sign update packet being able to pass by the chunk packet if being sent shortly afterwards, so maybe have have a short delay from the chunk packet before you put the player in the datastructure, or mark him as "ready to receive".
     
  4. Offline

    mrkirby153

    Ultimate_n00b

    I was thinking about doing something similar too by sending packets except like you mentioned above :p
     
  5. Offline

    Ultimate_n00b

    Hmph. As of now I am just getting a list of people out of game and checking their squared distance. Small amounts of lag sadly..
     
  6. Offline

    mrkirby153

  7. Offline

    Ultimate_n00b

    20 seconds to check players out of game, 13 ticks to check distance of those players.
     
  8. Offline

    blablubbabc

    How often and how many of those sign packets do you send?
    Also you don't have to do your distance checks for each sign if they are in the same chunk.
    And you can probably distribute the amount of packets to send and the amount of players to check and send them those, so that you do not calculate your stuff for all players at the same time, and that you do not send all packets at the same time to a player too. Lag can be reason of both, the calculations you do and the amount of packets you send to the players. So maybe it helps to run those stuff shifted from each other, just like you would do it with very large block changes.
     
  9. Offline

    Ultimate_n00b

    I am currently not doing in chunk.

    As well, I duplicated the update method for the sign to be used with my custom packet. Seems fixed.
     
Thread Status:
Not open for further replies.

Share This Page