Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(1 edit)

The problem is the one I mentioned before: because of how the viewports are updated and the fact that the scene is taken out of one side and inserted into another, animations like the one you show end up becoming desynchronized by a few frames. You have to control that manually in your scripts.

I’ve added two signals to the pageflip script. You can download the new file and play with those signals to “synchronize your scenes.” The signals are started_page_flip_animation and ended_page_flip_animation, and they are emitted when the page-flip animation is about to start and when it finishes.

To connect those signals to your scripts, you can use the BookAPI so your scenes can retrieve the active book when they enter the scene tree (var book: PageFlip = BookAPI.get_current_book()). From there, you can connect to the book’s signals to synchronize your scenes.

You can do this when the scenes enter the tree: get the book, check that you’re not already connected to it, and then connect it to your script. The logic to actually synchronize the pages is something you’ll need to implement yourself.

By the way, in the pageflip inspector, if you enable enable_composite_pages and assign a page texture (the blank sheet of paper) to blank_page_texture, textures/scenes with transparency will be drawn on top of the paper.

Thank you.
Connecting the signal fixed the misalignment when turning pages.
During scenes with intense movement while viewing pages, synchronization may lag between left and right pages, but we can minimize this by aligning it to one page.
I had overlooked enable_composite_pages.

https://x.com/ponidog/status/2000035087170339267

For the lag, you could connect the signals as deferred (.connect(_any_method, CONNECT_DEFERRED)) so the synchronization is pushed to the next frame, when the engine has some free time, instead of overloading a single frame with both page creation and synchronization.

Alternatively, you could use several awaits to wait a few frames before synchronizing. If it’s a heavy function, you could split it into multiple functions that do a small part each frame, or even use a secondary thread to run the synchronization.

All of these approaches could help reduce the initial micro-lag.