Events, Tweens, Timers. Timers have worse performance than tweens?! Events are best... WHAT?

3 favourites
From the Asset Store
Best car suspension with spring effect and very cool terrain generation.
  • Ashley do you think there is a chance that one day the Addon SDK would supports new "function-like True Triggers" for Timers or any plugin/behavior that wants to implement some kind of "Self-Functions" ?

    The triggers system is not designed to be used for performance-sensitive cases. Basically it's quite slow, but for things like input events, that doesn't matter. The built-in functions are specifically designed to be used in performance-sensitive cases, but they are deeply integrated in to the event engine and so aren't easily extendable. So I'd say if you really need maximum performance, use the built-in functions, but as I was saying before, probably the vast majority of cases don't need extreme performance, so some other solution is probably usually fine anyway.

    I did not expect timers to be this complex :V

    A good rule of thumb is everything is more complicated than you think! For example, want to know how long a string is? It's complicated.

  • Maybe the Timer behavior could add an "exact calculation" property that is enabled by default. People who are more performance-critical can disable it to get a limited version of a timer?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Then you could add "unpredictable tick order", "single timer only mode", etc. all to make up the performance difference... and now what's meant to be a simple feature is full of complicated configuration options, which makes it harder to use, unfriendly to beginners, makes the code much more complicated, and usually ends in lots more bugs. It's not worth it. It's pretty much the approach we took with Construct Classic years ago, and it ended in development hell.

  • > Ashley do you think there is a chance that one day the Addon SDK would supports new "function-like True Triggers" for Timers or any plugin/behavior that wants to implement some kind of "Self-Functions" ?

    The triggers system is not designed to be used for performance-sensitive cases. Basically it's quite slow, but for things like input events, that doesn't matter. The built-in functions are specifically designed to be used in performance-sensitive cases, but they are deeply integrated in to the event engine and so aren't easily extendable. So I'd say if you really need maximum performance, use the built-in functions, but as I was saying before, probably the vast majority of cases don't need extreme performance, so some other solution is probably usually fine anyway.

    Yeah I know existing "Real Trigger" aren't performant enough to handle Trigger events such as On Timer X or On Self Function X where X is a specific tag as it would trigger all the events for every tag every time any timer or any self function is called just to check in each event block if they match the right tag.

    This is why I wonder if it wouldn't be cool to bring the power/efficency of Functions/Custom Actions to the Addon SDK as a new Trigger type in addition to Real Trigger and Fake Trigger let's call them "Signal Trigger".

    I know it wouldn't work exactly as built-in Function as they would need to be on an active group/Eventsheet but as they would not allow any expression to be their "name" or "tag", C3 could map them more efficiently and so they would be more efficient than existing Real Triggers .

    It would only need to restrict the "Signal Trigger condition" tag to a user-generated enums/dropdown list (corresponding to the Timer Tags for example, or the Self Function Names).

    (But there could be both a expression based ("by name") and a drop-down variant for the related action that call those signals)

    It would be for a different purpose than Real Triggers and built in Functions/Custom Actions.

    And it would solve the longstanding issue that there is no way to create Performant Signals supporting multiple parameters that can trigger multiple event blocks efficiently. Which is a shame in a Eventsheet based game engine.

    But anyway regarding Better Signals this would probably be a better solution : construct23.ideas.aha.io/ideas/C23-I-165

  • Thanks, great post!

    I use a billion timers throughout my events, they're so efficiently convenient!

    Sounds like it's better to let them go and to just use the old fashioned DT event method, I need all the performance I can get.

    I mean, the ease of use might trump the performance. In my case I was using them on bullets in a bullet hell and well... performance was getting chewed up the way I was using them for EVERYTHING.

  • I did not expect timers to be this complex :V

    Haha, Ashley #2 point is super important in some types of situations. Many times not, but when it is, it def is.

    But, I understand that it does all that, but why does the tween not have the overhead for "OnFinished" that the "OnTimer" does? I haven't looked through the tween code, but I assumed it handles its time in a similarly accurate manner?

    It would be nice if both tween and timer had built a built in dt scale though. Sometimes it would be nice to scale dt for per obejct slow motion or speed up.

  • Then you could add "unpredictable tick order", "single timer only mode", etc. all to make up the performance difference... and now what's meant to be a simple feature is full of complicated configuration options, which makes it harder to use, unfriendly to beginners, makes the code much more complicated, and usually ends in lots more bugs. It's not worth it. It's pretty much the approach we took with Construct Classic years ago, and it ended in development hell.

    Yeah, I agree with all of that - I think it would be way better to have to have a seperate behavior/or custom script altogether. Which incidentally is the way I already went.

  • And it would solve the longstanding issue that there is no way to create Performant Signals supporting multiple parameters that can trigger multiple event blocks efficiently. Which is a shame in a Eventsheet based game engine.

    But anyway regarding Better Signals this would probably be a better solution : construct23.ideas.aha.io/ideas/C23-I-165

    Yeah, That would be nice.

  • I just want to chime in and agree with Overboy, better (signals / triggers / event Listeners, pub/sub support ... ie whatever you want to call it) would be really awesome for cases like this. and not just from the Addon SDK to event sheets, from the JS Side of things to the event sheet would also be great.

    something that does not necessarily go thru the trigger (condition overhead), but instead acts like a jump statement in way to a specific section of the event sheet (by tag). and having multiple consumer points would help with develop experiences, it will let us structure and organize the event sheet in a more maintainable way.

  • Well, there's the "Signal" system action and "On signal" trigger, which provides a basic event listener system.

  • But if you have 20 different signals in your game with 2 different listener (very low number for a big project), it would trigger 40 places in the Eventsheet each time you call any trigger because of the limitation I explained. Not performant at all.

    Also the issue I pointed out is that you can't pass any parameters, so you can't do anything per instance as Custom Actions are doing but with this signals, you can't pass a UID or the current SOL of that Object type.

    This is too limited and not performant at all. I wrote very detailed posts about that multiple time in the past, current On Signals doesn't solve the issue at all

  • Does the performance overhead actually matter? Are you firing signals 1000 times a frame or something? If so why? If it's not actually a problem, then it doesn't actually need optimising.

  • Yes the performance does matter a lot.

    And it's not even just a performance issue, as I said it's just impossible to create signals with parameters or passing instances sélection or UID.

    I first opted for a versatile tag-based Self Function's behaviors to be able to achieve the feature I wanted but it was not performant enough because of the "everything is triggered everytime I call any Self Function". As you said Triggers are not very performant in C3, it can get bad pretty fast.

    So now the way I do it is for each Signal I want, I create a specific Real Trigger via the Addon SDK. So I need to manually add a new Trigger Condition such "On Hit Received" to my "Entity" Behavior everytime I need a Signal. It is not modular at all, all the most used Family in my project now have their own custom behaviors with a bunch of hardcoded Real Triggers.

    I don't fire any signal every tick, but some stuff in my game need to happen very often : such as Entity : "On hit Received", "On damage dealt".

    The way I'm doing it now solved all my perf issue but it feels weird I need to create new Trigger condition via Addon SDK everytime. Also it took me a while to find this hacks way of doing things after rewriting my whole logic from scratch a bunch of times

  • I detailed the suggestion extensively in this post :

    construct.net/en/forum/construct-3/general-discussion-7/custom-actionsfunctions-175063

    The idea behind this is that C3 would be able to optimize those "Signal Triggers" almost as good as the built-in Function/Custom Actions.

    No need to check every single Signal Trigger that exists in the project to check if the "tag" is the same, just the ones mapped to the right Custom Action or Functions. (It would still need to check if the Trigger Eventsheet and Group is active though which is why I said "almost as performant")

    There is probably even better way to achieve this UX wise, but I tried to suggest something that could be built on top of existing stuff instead of creating a brand new customAction-style Signal feature. (Which should work per instance). Creating a brand new feature for this could be cool though

  • Also to add to some of the points made, the current "Signal" system action and "On signal" trigger are event sheet only...

    Adding them to the addon SDK or the Javascript API, greatly improves the flexibility of the system.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)