Announcement

Collapse
No announcement yet.

[Free] Event Subsystem

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [PLUGIN] [Free] Event Subsystem

    GitHub:
    You can download the source code and view the wiki here.

    What is the Event Subsystem?

    The Event Subsystem implements a framework to pass system-wide events anonymously allowing classes to be decoupled. Whenever an important event has occurred (informing event), or is about to happen (interactive event) the system in question may broadcast this information and all listeners registered may act accordingly. If the event is called before an actual action is taken, it is even possible for listeners to modify the event's data and the event caller may continue its task with the overridden data.

    An example use case would be this: Consider an arrow class which just hit a player and now needs to apply damage. Using the system, an event containing information on the arrow in question, the player damage will be applied to, and the actual damage that will be applied may be called BEFORE the damage is actually applied. Listeners can then override this damage and when all listeners have been run, the arrow class uses the damage that was set in the event. Why do this? It allows the arrow class to be simple: the arrow no longer needs to know the logic that is behind how much damage must be applied - it can simply set a default value and a system of arbitrary complexity can determine the damage.

    This system first originated in Bukkit, an old set of server hosting software that used to run the majority of Minecraft servers at the time; it is a proven system that was used to make thousands of plug-ins. In case you are a veteran Minecraft developer like me, go ahead and post it in the comments; it'd be intersting to know.

    What do I want?
    I'd like to help you out. I ask nothing of you for it; the software is placed on an unmodified MIT license, the most liberal license out there. If you'd like to reciprocate, it would be nice to be receive a spot in your project's credits . I also do custom work, so if you'd like me to extend the code, or work on something for you, feel free to give me a shout.
    Last edited by Univise; 07-23-2017, 12:15 PM.
    Take a look at my game: Crusoe

    Here are some useful tools for you: Event Subsystem and First Person Animator Tool

    #2
    good ideas and tools

    Comment


      #3
      any documentation´╝č

      Comment


        #4
        Hi Univise,

        Awesome plugin, I can definitely see some very useful scenarios for this! Thanks for making it available under such a gracious license, and for free- you're a rockstar!

        Also, I used to run a small Minecraft server a few years back, and heck yeah I used Bukkit and several plugins. Were you a developer on Bukkit? If so, what an awesome transition (Minecraft -> Unreal Engine)! Keep up the good work

        Comment


          #5
          @Univise : Starting using this for Ground Branch.
          I've modified it some now, figured I should be fork your repo and contribute.

          One thing I'm trying now is to replace the set priorities with a simple integer.
          Event are inserted in the corresponding array based on this priority.
          I don't see this having any particular negative impact on performance, but if I'm wrong, please correct me.
          Last edited by Kris; 07-05-2017, 08:29 PM.
          Rule#21: Be polite, be professional, but have a plan to kill everyone you meet.

          Comment


            #6
            Hello,

            I am replying quite late: sorry.

            Originally posted by zhaishengfu View Post
            any documentation´╝č
            Yes, the code is fully documented. Furthermore, there is a wiki article covering how to use the system.
            Last edited by Univise; 07-23-2017, 12:16 PM.
            Take a look at my game: Crusoe

            Here are some useful tools for you: Event Subsystem and First Person Animator Tool

            Comment


              #7
              Originally posted by Kris View Post
              @Univise : Starting using this for Ground Branch.
              I've modified it some now, figured I should be fork your repo and contribute.

              One thing I'm trying now is to replace the set priorities with a simple integer.
              Event are inserted in the corresponding array based on this priority.
              I don't see this having any particular negative impact on performance, but if I'm wrong, please correct me.
              In the end, the pre-defined priorities are interpreted by the compiler as one byte each. Making it an integer will not have any measurable difference in the efficiency of your software. What will affect the code's efficiency is the mutli-threading support. Whenever you call an event, there is some synchronisation that has to be performed. It is a constant overhead that is not even needed for most projects. For instance, if it is possible to register all event listeners at the beginning of the game and know you will not have to dynamically register/unregister more listeners during the game, you can disablle multi-threading support.

              Great to see you are using the code in your project, Ground Branch. I took a look at it and it's shaping up nicely.

              Cheers,
              Univise
              Take a look at my game: Crusoe

              Here are some useful tools for you: Event Subsystem and First Person Animator Tool

              Comment


                #8
                Originally posted by Univise View Post
                Great to see you are using the code in your project, Ground Branch. I took a look at it and it's shaping up nicely.

                Cheers,
                Univise
                Thank you kindly.

                Your reply has come at an interesting time actually.

                When working with C++, everything was fine.
                When it came to Blueprints, I had managed to get Register/Unregister to correctly list the events, but was unable to call events or modify event values.

                I decided to change the events from struct based to UObject based.
                By this stage, there was so little left of the original EventManager class, I ended up just making a new plugin.

                If I didn't need to work with Blueprints, there would be no need, but alas...
                It also takes worlds into account, allowing for world specific events (allows PIE multiplayer to work) or global (ignores world).
                Rule#21: Be polite, be professional, but have a plan to kill everyone you meet.

                Comment

                Working...
                X