Unified events queue system #3292
arthuro555
started this conversation in
Enhancement ideas (and their technical discussions)
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
A "pattern" that can be found in GDevelop is what I like to call "events queue": the mqtt, P2P and Multitouch extensions implement it for example. It is pretty simple: it is for "translating" JavaScript events to GDevelop events by having a "Get the latest item in the queue" expression and a "Event triggered" condition that checks if the queue has an item.
It has several issues though:
Pop time: the item in the queue could be popped at the pre events, post events, manually through an action or when the expression to get the last element in the queue is called. Those are all pretty different (the last one makes it unusable in extensions since it breaks when the user used it in his events sheet for example) and give an inconsistent behavior.
It requires reinventing the pattern each time you use it (or come up with it by yourself since it is very intuitive) as it is not documented anywhere
Those problems could be addressed with two potential solutions:
Add a unified events queue abstraction to GDevelop. Each time a user needs an event queue, they create one and configure it, maybe through an action, maybe through the ide, maybe both, to behave how they prefer (for example changing the pop time). Then they could use an action to link the event they want to the events queue. That way all events queues would have the same interface and would be easier to add.
Wait for asynchronous conditions to arrive, and use them instead of the events queue pattern, by calling the resolver function of that condition each time an event is triggered.
Beta Was this translation helpful? Give feedback.
All reactions