britzl / monarch

Monarch is a Defold screen manager with transition support and a straight forward API
MIT License
157 stars 22 forks source link

Strange transition behavior on the second replay #108

Closed Morgerion closed 3 months ago

Morgerion commented 7 months ago

Situation: there is a project in which transitions between windows are made through black. To make the implementation work as convenient as possible, it is done through the third window "black", which simply contains a full-screen black node. Everything works correctly, but in one case a strange thing happens - when you reopen the window, its contents start to be displayed after the transition is complete.

https://github.com/britzl/monarch/assets/7888071/fbbbb7f3-8cc5-4a5b-89c6-81d1d1562553

https://github.com/britzl/monarch/assets/7888071/3e543d61-bf16-42e6-9de7-c0991d14baff

This is strange, because the log file shows that window initialization occurs at the moment of transition start, and a dozen frames pass before transition completion. But during these frames the window is not on the screen. But after the transition is completed, it appears suddenly.

https://github.com/britzl/monarch/assets/7888071/1fa88df1-2c1c-41ad-9409-4f7d4b210d6e

The conclusion I made after studying this situation is that the window is processed correctly when restarted, before the transition starts, but REALLY appears on the screen only after the transition is completed. It is not clear where the window is during the transition - but it is not on the screen, that's a fact.

I have already encountered this behavior of monarch in another project of mine. General conclusions:

  1. this behavior occurs only if "*.script" and GO-objects are present in the collection.
  2. if the collection contains only GUIs, there are no problems with transitions.

P.S. I apologize for the google translation in video, my English is not good enough to explain it clearly.

Morgerion commented 7 months ago

I can send access to the project on github, I need your email for that.

britzl commented 6 months ago

I have already encountered this behavior of monarch in another project of mine. General conclusions:

  1. this behavior occurs only if "*.script" and GO-objects are present in the collection.
  2. if the collection contains only GUIs, there are no problems with transitions.

Very strange. I don't quite understand what the script files have to do about anything, unless perhaps there's some code in the script that blocks the main thread or something?

I can send access to the project on github, I need your email for that.

I would prefer if it is possible to reproduce in a minimal project of some kind. Can you reproduce it in a test project?

Morgerion commented 6 months ago

I have a project where everything is working correctly. It has a direct launch: "lobby" -> "black" -> "gameplay". There everything works correctly always.

But everything is different in the project, the video from which is demonstrated here. Here the launch of transition to "gameplay" happens from "popup". That is, the "popup" closes first, and then the transition to "black" starts. This is probably the only significant difference.

I have some ideas, I'll think about it and post here. And also I will put together a minimal example of the project.

Morgerion commented 3 months ago

I've managed to overcome this problem. The problem turned out to be project-specific (because the same solution works stably in another project). The solution was strange, but the main thing is that it works.

britzl commented 3 months ago

Good to hear that you managed to solve it. I'll close this bug report.