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

3 favourites
From the Asset Store
Very simple code without excess options (15 events for server and 11 events for client)
  • 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.

    Yes ! A good start for this would be to add Custom Action scripting interfaces : construct23.ideas.aha.io/ideas/C23-I-272

    But yes it would be awesome if we could also have JS event for Signals, Functions AND Custom Actions ! (We need per-instance Signals)

  • I added a suggestion for Functions and Custom Actions JS events support ! construct23.ideas.aha.io/ideas/C23-I-456

  • Yes the performance does matter a lot.

    Do you have performance benchmarks that demonstrate the performance overhead of "On signal" is too much for reasonable use cases? I think it would be surprising - why would you need something like thousands of signals per frame? If you are doing something like that wouldn't another feature like functions be a better approach anyway?

  • > Yes the performance does matter a lot.

    Do you have performance benchmarks that demonstrate the performance overhead of "On signal" is too much for reasonable use cases? I think it would be surprising - why would you need something like thousands of signals per frame? If you are doing something like that wouldn't another feature like functions be a better approach anyway?

    This is exactly what i'm suggesting here and what i've been suggesting for several months with the "Listener Blocks" feature built on top of Custom Actions and Functions, i never used or even suggested to enhance the current "on signal" feature for many reasons i explained. (no parameters, no way to pass an instance or SOL, bad perf, bad UX)

    I never needed thousands of signals per frame, I had actual performance issue on my real world project using the various methods i mentionned until I opted for my hacky "create a Real Trigger via Addon SDK" anytime I want a new instance Signal. It wasn't even triggering thousands of signal, just some specific events of my game like when 10ish entities were hit at the same frame was freezing my game. (Because of the exponential performance overhead of tag-based Real Triggers I explained in my first posts of this thread) I didn't have stable 60 FPS until many many optimization tricks I did.

    I find my own solutions for this after weeks if not months of work extanding the engine in multiple ways using both JS scripting and Addon SDK.

    I already spend several days explaining this issue, a bunch of example usecases and different suggestion that could fix it on various occasions.

    From your answers, i have the feeling you still didn't understand what is the issue (the performance is only a part of the problem - a big one - but also we just can't create at all Signals per instance supporting multiple listener blocks with the current features of the engine, i think i already reported that 15 times), and what are the solutions i'm suggesting (nothing related to current limited and not perfromant signal feature)

    I have the feeling any benchmark i could provide won't change anything, as there here is no recognition of the problem in the first place, so i'll probably just avoid overworking even more on this.

  • So one of the main limitations of using functions for this is that the handler logic is only defined in one place and is defined explicitly so everytime you call a function your get the exact same behavior.

    I think the actual ask is to have a similar mechanism to trigger and some event. But then have the ability to define different logic for handling that trigger probably based on context.

    This adds an extra layer of flexibility, and also gives the user the tools to keep the event sheet better organized and grouped together.

    A simple example let's say we have a player health bar on one event sheet and the in a different layout we need same infor for different display but still relies on the same info.

    Without having to duplicate a bunch of event in layouts. You can have your player object emit signal player.health.changed and pass a value for player health

    In each layout you can have a trigger for player.health.changed and then each layout event sheet can handle this logic differently.

    It provides another tool to help the user decouple some of there systems. And this is very simple example but I think illustrates the point a bit better.

    This condition does not rely on every frame check, and has the same flexibility as custom object when picking. The signal should be able to traverse different object types. But also be handled on a per instance basis so only the picked instances execute the logic.

    And it should hopefully be in the JS api as well.

  • I think this thread has deviated a bit from its original intent. But the whole discussion of these "real trigger function signals" are still kinda relevant

  • I think this thread has deviated a bit from its original intent. But the whole discussion of these "real trigger function signals" are still kinda relevant

    Oh, I'm happily sipping tea over here. Might even grab some popcorn. In all seriousness, I agree with much of what Overboy is advocating for. Though, personally, I have never created a project that relies on broadcasting signals. I like callback methods to drive communication, but that is more tightly coupled for sure/

  • The reason I am asking is not because I don't understand it - we use the addEventListener model a great deal in our own JavaScript code - but because I need to understand the relative priority. This year alone around 7 years or more of feature suggestions have already been filed on the suggestions platform. It's an absurd, totally inconceivable amount of work, and people keep suggesting yet more things in threads like this. How do we figure out what to work on? In part, by figuring out how bad the problem is.

    Even if you had performance issues with your project, how do we know you're not literally the only person to ever have a performance issue with that particular feature? We can't afford to build features that only one person needs - there are far too many other features that could improve things for lots of users that would be better to work on. It could well be that the performance is fine for 98% of projects, and not fast enough for 2% of projects, in which case I'd probably say it's not something that should be prioritised. However if performance is only OK for 25% of projects and is poor for 75% of projects, I'd probably say it's a more important thing to look at.

    The best way to make your case that it's the latter rather than the former is to make a project file that is reasonably designed and demonstrates a performance problem. That can make it clear that many projects may be affected. And then I have a real project I can try out - it may be possible to make tweaks to the engine that solve the performance problem with much less effort than building entire new features.

    That approach can much more quickly arrive at a good understanding of the problem, or more quickly identify workarounds or other solutions that help. I'm afraid that writing long posts doesn't achieve that.

    So I'd ask for your understanding and co-operation: I'm not refusing to understand, I want to better understand the actual problem in a meaningful way, and long forum threads like this do not generally help with that. I'm asking for the things I really need, and if nobody provides them, then probably nothing much will happen: we just have far, far, far, far too much other work that's already been proposed, and some of it already looks compelling, so that will take priority.

  • The thing is that very few people are facing this performance issue because again : the feature just doesn't exist at all in Vanilla Construct : this is the main issue. We just can't create Per Instance Signals supporting multiple listener blocks (and multiple parameters) to be able to decouple stuff for example (but it's not just an organization issue, it's just impossible to develop a modular Roguelike without those for example). This is the problem number 1.

    I think a lot of users are happy that they can have several different places in their eventsheet to apply logic using vanilla Triggers. For example, i think it's common that people have multiple "On Main Player Created" blocks in their big project to initialize stuff on their Player (one for UI, one for Visual, one for Gameplay stuff, or even one for "Arena Layout" that differs for the one of "Dungeon Layout"). But we just can't create our own Triggers like that for stuff like "On Main Player Hit".

    The same way people are happy to have a bunch of "On Start Layout" events in the same project, could you imagine making a big project were you would need to put everything you want to happen On start of Layout but in a single place in the eventsheets, no matter what is the current Layout (so we would need to make a huge else if statement in a single place), no matter what object you want to act on, the game feature that is relevant ?

    I created various solutions myself by writing Addons to be able to do this. Including a Tag-based versatile Self Function behavior solution and later a "Create a new Real Trigger each time i need a new Signal".

    So I don't get the point to prove the performance issue for a feature that just doesn't exist at all in C3 to prove it is worth developping it ? Again we just can't do that in Vanilla C3.

    I totally understand the priority stuff, and i don't care if the feature isn't developped any time soon or even isn't developped at all, I think a lot of other stuff are 10X more important and urgent to have in the engine such as some stuff i listed in this post from an other thread : construct.net/en/forum/construct-3/general-discussion-7/good-time-construct-great-178657/page-6

    The issue is that it happens very often that the answers I get from reports totally ignore the main points I'm raising. There is zero acknowledgment about the missing spot, just oversimplification of the issue and potential solutions i report and some suspicions i'm doing stupid stuff on my project that makes it slow or i'm trying to achieve things that are useless to do. I get why it could be the first answer that is provided to challenge the idea/the issue : it's totally fine, but i just don't understand why after maybe 25 detailed messages over 10 months we're still stuck on the comprehension/acknowledgement of the important thing ?

    And i'm still feeling this about that issue C3 has that :

    1. We can't create our own Triggers in C3. (Working per instance/SOL and supporting multiple listeners blocks).

    2. Even after spending weeks developing my own solutions for this there are either performance issue (tag-based Self Function) or the process is just too hacky and cumbersome (need to create Behaviors and Real Triggers via SDK for every single Signals I want for every project i make)

  • The thing is that very few people are facing this performance issue because again : the feature just doesn't exist at all in Vanilla Construct : this is the main issue.

    I was talking about "On signal", a feature that does exist. It might not do everything you want, but it does exist, and I thought its performance should be OK, even if not perfectly optimal. That's what I was talking about, but I think you're trying to talk about a whole bunch of other things, which I think makes it hard for me to get anywhere in this discussion, so I think it's best I stop posting in this thread.

  • As I said I never used or suggested anything related to the too limited On Signal feature because they have no parameters + no way to pass instance or SOL (+ perf can get exponentially worse and the UX is pretty bad). Same for all the other convos we had about this during the past 10 months 🤷‍♂️

    That feature doesn't help at all with the issue I'm describing and the performance gets exponentially worse the more you use it.

    You always told us how much cooler and performant Builtin Functions were versus True Triggers (x3.5 perf i think ?), so the perf diff is even bigger if you compare builtin Functions versus tag-based true Triggers with increasingly bigger number of triggers and signals, because it will trigger every single Signal block even if it's not the same Signal string you just called.

    There are your own blog posts explaining this :

    - construct.net/en/blogs/construct-official-blog-1/construct-3s-new-redesigned-1059

    - construct.net/en/blogs/construct-official-blog-1/constructs-new-functions-1060

    Here is your own graphic showing the difference between a between function and a old tag-based functions.

    (+ note that the difference would be even bigger with tag-based True Triggers as old functions were already optimized via the deprecated Fast Trigger feature AFAIK !)

    I still don't understand why asking for perf benchmark as you're well aware of this and you already did it yourself

    The suggestion I made for "Better Signals" via a Emit Signal option for Functions/Custom Actions, allowing to add extra Listeners Blocks would solve all the issues mentionned (and even more as it could also feature an execution order option) :

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

    By default you would create a Function or a Custom Actions (nice UX and optimal perf for the "First Listener Block" at least), and if latter you realize that you'd like an additional listener blocks for it (for decoupling/organisation or because you want to apply different logic depending on the Layout or because you want to apply different logic depending on active groups/eventsheets as explained by me and other in different examples in this thread), you would just tick the "Emit Signal" boolean, and you could now create as many extra Listeners Blocks via the usual Object Conditions creation worklow. (that could probably be a bit more efficient than existing True Triggers for reasons mentionned on my first posts)

    Some advantages of building Better Signals on top of Functions/Custom Actions instead of current On Signal Event :

    Perf advantages : Built-in function perf + no need to trigger every signal every time + no need to do shenanigans to pass parameters + no need to do picking for each listeners

    UX advantage : no typo due to strings, automatic bulk rename, parameters are automatically accessible as local variables in each listener block, Find all references support

    + if JS Events and scripting interfaces for calling Custom Actions are added, it would also work for this feature.

    Other potential advantages from this suggestion : listeners blocks could be added via the same workflow as regular Conditions (the same way custom actions calls are added via regular Action workflow), execution order feature

  • Just to be super clear, like, having a special "On Signal" that can pass SOL and parameters, which is almost exactly like a function except with ability to have multiple event blocks with same "On Signal" tag, right? Correct me if I'm missing something!

    If that's the case, then, at this moment, I don't see what could be made with this updated "On Signal" that couldn't be made with a function. By having multiple event blocks with same trigger name, then, well, any time you do a "Signal" event and enter some parameters and pass SOL, it's gonna pass all these paramsters and SOL to each event block with same signal tag... So it kinda just works like a function, except separated into different blocks? So the one benefit being organisation? Or is there a logical/technical thing that can be gained that I'm missing?

    So assuming signal was updated, then upon doing a signal, it'd instantly trigger all those event blocks with same signal tag, one after the other - so if this is the case, couldn't the same exact results be achieved by using a function? The signals will only run one after each other, so could just use function and place all events in same order as your multiple "on signal" triggers.

    Perhaps if there's a quick easy example, like an explainable situation that can fit in a paragraph or two?

    I want to agree if it's going to grant us power, but just need to understand better.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I think I know what Overboy means and I'm pretty dumb with programming. Correct if I'm wrong but a good example of this is Godot's custom signals + autoload(singleton) and the possibility to assign this trigger to any block without caring who is listening and who is calling and to assign parameters/objects. However, I want to say this respectfully: through all these years I always have had the impression that Scirra should literally use other game engines more to know why some features are so important but somehow is treated like a minor thing because sometimes feels like Construct is more of a general purpose software than a game engine due to the, perhaps, the lack of a proper game engine experience and its needs

  • I want to agree if it's going to grant us power, but just need to understand better.

    I think Iʻll give it a shot, Overboy can clear up anything I get wrong.

    Imagine you are creating a game. In said game you have a spaceship. The space ship is really just a frame with many components. Engines, shields, thrusters, weapons, hull parts and so on. Each component on the ship doesnʻt need to know about other components implementations. The shield doesnʻt care what type of engine exists, so long as the power output is sufficient. The issue with the using functions, is that component specific code now needs to be placed under the ownership of other components which is BAD for maintainability and scaleability.

    Lets say your dynamic spaceship is all set up and built by the player. Then lets say during a mission, an enemy fires a vampire hull mine that is triggered by arcane engine output excess. Where do you put that code?

    The easiest and best answer is that it should go in the eventsheet/script for the vampire hull mine, not the arcane engine script. When the custom action to activate the engine triggers, there should only be code related to what the engine does. It doesnʻt care it there is a mine on the hull or not. you shouldnʻt have to write "if vampirehullmine is attached, then call vampirehullmine.activate". Instead, that should be in the vampire mineʻs script : "On specific engine type on a specific craft activates...".

    What if you have a shield that autoactivates on the ship hull taking damage? Imagine all the code tangle that will become impossible to manage once you have 10 different types of energy storage systems, dozens of weapon types, dozens of engine types, modules that add unique and specific abilities, components that dynamically react to specific situations or the pressence of other components, and so forth. A single ship could easily have dozens of parts. Just like a character in a rougue action game could have dozens of dynamic abilities, plus equipment, plus weapons.

    The issue seems not so bad when you make a single spaceship object in an arcade shooter and just hardcode everything. But the moment you try to make complex interacting systems, you need architecture/organization to handle it. In my experience, you have to add alot of custom boiler plate code to handle message passing in construct. I use callbacks, but that means every object has to maintain a list of listeners and iterate through it in order to callback to them when some event takes place. That equates to alot of foreach/pickbyUID/callback function.

    AND I didnʻt even get into passing parameters! Which is an absolute must. Many times, you want to pass several, or a whole object... ("UID to ANYTHING" ) probably the best 3rd part asset ever.

  • I have a general question about performance.

    Ashley if we want to help by making performance benchmark projects, where would we send them?

    Should we open a GitHub issue and add "performance" in the title, or should we post it here on the forum, or send a mail?

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