1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

RFC Add tickable class/interface

Discussion in 'Contributing & RFCs' started by Jack Noordhuis, Oct 13, 2017.

  1. Jack Noordhuis

    Jack Noordhuis Zombie Pigman Poggit Reviewer

    Messages:
    618
    GitHub:
    JackNoordhuis
    PocketMine already somewhat provides this functionality through the use of tasks but it is somewhat limited.

    Adding the ability to attach a tickable object directly to the server, a level or maybe entities (some sort of child tickable implementation?) will assist in the separation of CPU-time intensive tasks which take most of, if not an entire tick or more. An example of where this could be applied to the core would be in the execution of explosions -- instead of freezing up the entire server with a huge loop it could be broken down into separate ticks by only procesing so many blocks per tick.

    This will come with some issues that will need to be addressed, such as what would warrant a tickable object over a task? or if a task itself should be an extension of the tickable implementation.

    Let me know your thoughts, suggestions and opnions on this and we'll see where it ends up :)
     
  2. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    Jack Noordhuis and HBIDamian like this.
  3. HBIDamian

    HBIDamian HBIDamian Staff Member

    Messages:
    365
    GitHub:
    HBIDamian
    Am I the only one who read it as "tickle-able"?
     
  4. Jack Noordhuis

    Jack Noordhuis Zombie Pigman Poggit Reviewer

    Messages:
    618
    GitHub:
    JackNoordhuis
    Yea, that looks great! :)

    It would be good if the tickable interfaces and/or traits were implemented by all existing objects that require ticking (entities, tiles, levels, etc), along with adding API methods to attach child tickable objects that are bound to that object at runtime. This way you can schedule the equivalent of a task but only run the task when the parent object is ticked.

    This should probably be discussed amongst the core team before any changes are made, due to the amount of potentially breaking changes and generalisation of everything that can be ticked.

    I read it that way myself a few times while I was writing this up :p
     
  5. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    I think you are referring to something like the level tick rate, right?
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.