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

Unsaved fields when using "Store Current Scene to Stack" or VM_PUSH_SCENE #1598

Open
KirbyKing186 opened this issue Sep 30, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@KirbyKing186
Copy link

Describe the bug

When using "Store Current Scene to Stack", the following fields get saved:

    scene_stack_ptr->scene = current_scene;
    scene_stack_ptr->pos = PLAYER.pos;
    scene_stack_ptr->dir = PLAYER.dir;

The current scene, player position, and player direction are saved (Source), but the following fields aren't:

  • Actors
    • Actor Positions
    • Actor Directions
    • Placement in their On Update, On Hit, etc. scripts
  • Projectiles
    • Same as Actors
  • Any currently-running threads
  • (Potentially more)

I am not sure whether these fields would be unfeasible to add. When "Store Current Scene to Stack" is used for something like a Pause Menu, disparities in where the actors where before and after the pause start to appear. Although you could use variables and set the position, direction, and placement in their scripts for Actors, the same does not go for projectiles.

To Reproduce
Steps to reproduce the behavior:

  1. Give an actor a script to move to a certain point in Scene A.
  2. Attach a "Store Current Scene to Stack" and "Change Scene to Scene B (Pause Menu)" to any button in the On Init of Scene A.
  3. In Scene B, attach a script to a button with the event "Restore First Scene from Stack".
  4. Compile the game and see that the "Store Current Scene to Stack" event does not save the actor's direction and position, and just reverts it to the scene default.

Video
https://github.com/user-attachments/assets/9c16cad4-2a03-4330-a067-56f1cd7f65a1

Platform (please complete the following information):

  • OS: [Windows 11]
  • App version [GBS 4.1.3]

Additional context
Adding more fields to save in the stack will undoubtably increase the amount of data stored on the stack, but anecdotes from the GB Studio servers share the opinion that this would be an acceptable compromise. If it is feasible to store the unsaved fields to the stack in a future version, I feel it would be best if the current "Store Current Scene to Stack" event stays as a more minimal version.

@KirbyKing186 KirbyKing186 added the bug Something isn't working label Sep 30, 2024
@smfhacking
Copy link

From what I can understand is that you have problems with the pause button?

or the jump button?

@KirbyKing186
Copy link
Author

No, not exactly.

In summary, Store Current Scene to Stack does not save some fields like actor position and direction, causing differences in their behavior/location if you use the event for something like a pause menu. This may be a bug, or possible intentionally done because it would be unfeasible to store all this data to the stack, but I felt it was worth reaching to the GitHub to find out.

@smfhacking
Copy link

@KirbyKing186

well, I usually use the "save scene to stack"

and after pressing pause and choosing the other level, to press pause there is the "load scene from stack"

And if it works, I'll show you an example?

@KirbyKing186
Copy link
Author

No, as I stated before, you can use that event (Store Current Scene to Stack) but, as of GBS 4.1.3, it will not save the list of unsaved fields mentioned in the first issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants