Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Application lifecycle manual page is inaccurate and is missing points where messages are dispatch #391

Open
redoak opened this issue Feb 10, 2024 · 0 comments

Comments

@redoak
Copy link

redoak commented Feb 10, 2024

The manual section on Application lifecycle - The update loop is missing certain steps, and the order of operations appears to be described incorrectly in the page text.

The following description is based on this repro case project: https://github.com/redoak/defold-message-dispatch-order

I have this simple structure in the project.

main collection:
    go: script
    go: gui + gui_script
    go: collectionproxy + script
        go: script
        go: gui + gui_script

Each script and gui_script implements init, final, update, fixed_update (only in script), on_message, and on_input. Each function posts a message to "#" in order to see when the message is dispatched and handled. I didn't implement `fixed_update for gui_script, since I suspect that's not supposed to be supported (see #8524).

This is the order of operations I see, with Defold version 1.6.3:

main: script and gui_script init
main: message dispatch
    proxy: script and gui_script init
    proxy: message dispatch

main: script + gui_script on_input
    proxy: script + gui_script on_input
    proxy: message dispatch
    proxy: script update
    proxy: message dispatch
    proxy: gui_script update
    proxy: message dispatch
    proxy: script fixed_update
    proxy: message dispatch
main: message dispatch
main: script update
main: message dispatch
main: gui_script update
main: message dispatch
main: script fixed_update
main: message dispatch

    proxy: script + gui_script final
    proxy: message dispatch
main: script + gui_script final
main: message dispatch

Interestingly, even though I load, init and enable the collectionproxy during init, no input will be passed on to the proxy on the first frame. It seems like a bug to me, but I don't know. Either way, it's unlikely to ever really matter.

Manual inaccuracies:

  • The message dispatch between on_input and update is not shown in the graphic or mentioned under Input.
  • The Input and Update description makes it sound like the sequence should be main on_input, proxy on_input, main update, proxy update. As seen above, this is not the case, and instead all the proxy functions are called in one go after main's on_input.
  • The Update description also suggests that script update, script fixed_update, and gui_script update will all be called before a message dispatch. This is not the case as seen above.

I haven't looked at when these are received/called:

On a side note, to make the three images on the page easier to edit, and make their content show up in searches, perhaps they could be replaced with text. It would be fairly easy to recreate the same 3-column layout with markup tables (if that's desired). If you want to keep the iconography, and you are able to display emojis, you can use emojis such as ✉️ and 🏭.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant